from decimal import Decimal import decimal import sys import math a,b=map(int,input().split()) a=abs(a) b=abs(b) decimal.getcontext().prec = 400 if a==0 and b==0: print("0.25") sys.exit() k=math.gcd(a,b) ans=Decimal(0) for i in range(1,100): for j in range(1,100): if i%k==1 and j%k==1: if (i//k+j//k)%2==0 or (a//k+b//k)%2==1: ans+=Decimal(1)/Decimal((i+j)**(i+j)) if k==1: if (i//k+j//k)%2==0 or (a//k+b//k)%2==1: ans+=Decimal(1)/Decimal((i+j)**(i+j)) print(ans)