#include using namespace std; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); string A,B; cin >> A >> B; long long an = 0,ad = 10000,bn = 0,bd = 10000; for(auto c : A){ if(c == '.') continue; an *= 10; an += c-'0'; } bool minusB = false; for(auto c : B){ if(c == '.') continue; if(c == '-') minusB = true; else bn *= 10,bn += c-'0'; } long long g = gcd(an,ad); an /= g; ad /= g; g = gcd(bn,bd); bn /= g; bd /= g; if(minusB) swap(an,ad); if(ad != 1){cout << "No\n"; return 0;} int eg = 0; for(int i=2; i*i<=an; i++){ int e = 0; while(an%i == 0) e++,an /= i; eg = gcd(eg,e); } if(an != 1) eg = gcd(eg,1); if(eg%bd == 0) cout << "Yes\n"; else cout << "No\n"; }