#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
typedef long long ll;
const int INF = 1<<30;
const ll INFLL = 1LL<<60;
const ll MOD = 998244353;
const double INFD = 1.0E10;
const int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};
using Pair = pair<ll, ll>;
using Graph = vector<vector<int>>;
using mint = atcoder::modint998244353;


int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    double a, b; cin >> a >> b;
    if (b == 0) cout << "Yes" << endl;
    else {
        ll x = a * 10000;
        if (b < 0){
            x = 1.0 / a * 1'000'000'000;
            if (x % 100'000 != 0){
                cout << "No" << endl;
                return 0;
            }
            x /= 100'000;
            b *= -1;
        }
        if (x % 10000 == 0){
            x /= 10000;
            ll y = x;
            ll m = INF;
            //cout << x << endl;
            for (int i = 2; i <= y; i++){
                ll cnt = 0;
                while (x % i == 0){
                    x /= i;
                    cnt++;
                }
                if (cnt) m = min(m, cnt);
            }
            //cout << m << endl;
            cout << (ll(m * b * 10000) % 10000 == 0 ? "Yes" : "No") << endl;
        }
        else cout << "No" << endl;
    }
    return 0;
}