from sys import stdin from random import randint from collections import deque, defaultdict as dd from copy import deepcopy input = stdin.readline MOD = 998244353 INF = 1 << 60 xor = randint(100, INF) def extended_gcd(a, b): if b == 0: return a, 1, 0 else: g, x, y = extended_gcd(b, a % b) return g, y, x - (a // b) * y def mod_inverse(a, m): _, x, _ = extended_gcd(a, m) return (x % m + m) % m def fast_mod_pow(x, p): res = 1 t = x z = p while z > 0: if z % 2 == 1: res = (res * t) t = (t * t) z //= 2 return res def main(): a, b = map(float, input().split()) div = 10000 a = int(a*div) b = int(b*div) if not b: print("Yes") return g1 = extended_gcd(a, div)[0] if not (div//g1==1 and b > 0 or a//g1==1 and b < 0): print("No") return if b < 0: a = div//g1 else: a //= g1 l = 0 r = 1<<30 g2 = div//extended_gcd(b, div)[0] while l+1 < r: m = (l+r)//2 if fast_mod_pow(m, g2) <= a: l = m else: r = m if fast_mod_pow(l, g2)==a or fast_mod_pow(r, g2)==a: print("Yes") else: print("No") if __name__ == "__main__": main()