#include #include using namespace std; long long gcd(long long n1, long long n2) { long long ret = n1 % n2; return (ret == 0) ? n2 : gcd(n2, ret); } double A, B; int main() { cin>>A>>B; if(B>=0) { double p = 10000/gcd((long long)B*10000, 10000); long long r = round(pow(A, 1.0 / p)); if(A == pow(r, p)) cout<<"Yes"<