#include <bits/stdc++.h>

template <class T>
inline void read(T &x) {
	static char ch; 
	static bool opt; 
	while (!isdigit(ch = getchar()) && ch != '-'); 
	x = (opt = ch == '-') ? 0 : ch - '0'; 
	while (isdigit(ch = getchar()))
		x = x * 10 + ch - '0'; 
	if (opt)
		x = ~x + 1; 
}

template <class T>
inline void putint(T x) {
	static char buf[45], *tail = buf; 
	if (!x)
		putchar('0'); 
	else {
		if (x < 0)
			putchar('-'), x = ~x + 1; 
		for (; x; x /= 10) *++tail = x % 10 + '0'; 
		for (; tail != buf; --tail) putchar(*tail); 
	}
}

template <class T>
inline bool tense(T &x, const T &y) {
	return y < x ? x = y, true : false; 
}

template <class T>
inline bool relax(T &x, const T &y) {
	return x < y ? x = y, true : false; 
}

template <class T>
inline T getAbs(const T &x) {
	return x < 0 ? -x : x; 
}

typedef long long s64; 
typedef long double ld; 
typedef std::vector<int> vi; 
typedef std::pair<int, int> pii; 
#define mp(x, y) std::make_pair(x, y)

using std::cout; 
using std::cerr; 

int t, n; 

inline s64 getless(s64 k) {
	s64 l = 1, r = k + 1, res = 1; 
	while (l <= r) {
		s64 mid = (l + r) >> 1; 
		if ((100 + t) * mid / 100 > k)
			res = mid, r = mid - 1; 
		else
			l = mid + 1; 
	}
	// cerr << k << ' ' << res - 1 << '\n'; 
	return res - 1; 
}

inline s64 findnth(int n) {
	s64 l = 1, r = 1e18, res = 1; 

	while (l <= r) {
		s64 mid = (l + r) >> 1; 
		if (mid - getless(mid) >= n)
			res = mid, r = mid - 1; 
		else
			l = mid + 1; 
	}
	return res; 
}

int main() {
#ifdef orzczk
	freopen("a.in", "r", stdin); 
#endif

	read(t), read(n); 

	cout << findnth(n) << '\n'; 

	return 0; 
}
#include <bits/stdc++.h>
#define REP(i, e) for(int (i) = 0; (i) < (e); ++(i))
#define FOR(i, b, e) for(int (i) = (b); (i) < (e); ++(i))
#define ALL(c) (c).begin(), (c).end()
#define PRINT(x) cout << (x) << "\n"
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const long long MOD = 1000000007;

signed main(){
    ll N;
    cin >> N;
    ll a = 3, b = 5;
    FOR(A, 1, 100){
        b = 5;
        FOR(B, 1, 100){
            if(a + b == N){
                cout << A << " " << B << endl;
                return 0;
            }
            if(5 * b > N) break;
            else b *= 5;
        }
        if(3 * a > N) break;
        else a *= 3;
    }
    PRINT(-1);
    return 0;
}