from math import gcd from collections import deque A, B = map(int, input().split()) G = gcd(A, B) Closed = {(1, 1)} ans = 0.25 Dx = [G,0,-G,0,A,A,-A,-A,B,B,-B,-B] Dy = [0,G,0,-G,B,-B,B,-B,A,-A,A,-A] q = deque([(1, 1)]) for i in range(10**5): if not q: break x, y = q.popleft() for dx, dy in zip(Dx, Dy): ux, uy = x+dx, y+dy if (ux, uy) not in Closed: Closed.add((ux, uy)) q.append((ux, uy)) if 1 <= ux < 20 and 1 <= uy < 20: ans += 1 / ((ux+uy)**(ux+uy)) #print(ux, uy) print(ans)