#include using namespace std; long long pow(long long b, long long e) { long long ret = 1; while(e) { if(e & 1) ret *= b; b *= b; e >>= 1; } return ret; } int main() { string A, B; cin >> A >> B; if(A.substr(A.size() - 4) != "0000") { cout << "No\n"; return 0; } if(B.substr(B.size() - 4) == "0000") { cout << "Yes\n"; return 0; } long long integer = stoi(A.substr(0, A.size() - 5)); long long decimal = stoi(B.substr(B.size() - 4)); for(long long i = 0; i <= 10000; i++) { if(i * decimal % 10000 == 0) { // A = j ^ iならよい for(long long j = 0; j <= integer; j++) { if(integer == pow(j, i)) { cout << "Yes\n"; return 0; } } } } cout << "No\n"; return 0; }