import std.stdio;void main(){for(int x,y,z,n;~scanf("%d%d%d",&x,&y,&z);writeln(x>y?xx-6?x:y>z+5&n?(y+~z)%5-~z:x