System.in.eachLine{{a,b,c->println a.modPow(b,c)}it.split()*.toBigInteger()}