N,B = list(map(int,input().split())) try: print(pow(N,-1,B)) except: print("NaN")