import math;A,B=map(int,input().split()) if A|B==0:print(1/4);exit() g=math.gcd(A,B);X=0;T=8*(g<=9)+2;F=A//g%2*B//g%2+1;k=0 while k