def E(a,b): if b:u,v,w=E(b,a%b);return u,w,v-a/b*w return a,1,0 while 1:a,m=map(int,raw_input().split());print E(a,m)[1]%m
Note that non-ascii characters in the above source code will be escaped (such as \x9f).
download
return to the top page