#include<bits/stdc++.h>
using namespace std;

typedef long long int ll;

int main()
{
    unsigned long long n;
    cin >> n;

    unsigned long long sa = 3, sb = 5, a, b;
    for(a = 1;sa <= n;a++){
        sb = 5;
        for(b = 1;sb <= n;b++){
            if(sa == n - sb){
                cout << a << " " << b;
                return 0;
            }
            else if(sa > n - sb){
                break;
            }
            unsigned long long t = sb;
            sb *= (unsigned long long)5;
            if(sb / (unsigned long long)5 != t){
                break;
            }
        }
        unsigned long long t = sa;
        sa *= (unsigned long long)3;
        if(sa / (unsigned long long)3 != t){
            break;
        }
    }

    cout << -1;

    return 0;

}
#include <bits/stdc++.h>

using namespace std;

#define x first
#define y second
#define mp make_pair
#define pb push_back
#define sqr(a) ((a) * (a))
#define sz(a) int(a.size())
#define all(a) a.begin(), a.end()
#define forn(i, n) for(int i = 0; i < int(n); i++) 
#define fore(i, l, r) for(int i = int(l); i < int(r); i++)

typedef long long li;
typedef long double ld;
typedef pair<int, int> pt;

template <class A, class B> ostream& operator << (ostream& out, const pair<A, B> &a) {
	return out << "(" << a.x << ", " << a.y << ")";
}

template <class A> ostream& operator << (ostream& out, const vector<A> &v) {
	out << "[";
	forn(i, sz(v)) {
		if(i) out << ", ";
		out << v[i];
	}
	return out << "]";
}

mt19937 rnd(time(NULL));

const int INF = int(1e9);
const li INF64 = li(1e18);
const int MOD = int(1e9) + 7;
const ld EPS = 1e-9;
const ld PI = acos(-1.0);

li n, m;

bool read () {
	if (scanf("%lld%lld", &n, &m) != 2)
		return false;
	return true;
}

void solve() {
	for (li i = 1; i * i <= m; ++i) if (m % i == 0){
		li x = i, y = m / i;
		if (x + y == n){
			puts("Yes");
			return;
		}
	}
	puts("No");
}

int main() {
#ifdef _DEBUG
	freopen("input.txt", "r", stdin);
//	freopen("output.txt", "w", stdout);
	
	int tt = clock();
#endif
	
	cerr.precision(15);
	cout.precision(15);
	cerr << fixed;
	cout << fixed;

#ifdef _DEBUG
	while(read()) {	
#else
	if(read()) {
#endif
		solve();
		
#ifdef _DEBUG
	cerr << "TIME = " << clock() - tt << endl;
	tt = clock();
#endif

	}
}