#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
map<ll,int>Q;
int main(){
	ll n;
	cin>>n;
	for(ll i=1,j=3;;i++){
		Q[j]=i;
		if(1e18/3<j)break;
		j*=3;
	}
	for(ll i=1,j=5;;i++,j*=5){
		if(j>n)break;
		ll k=n-j;
		if(Q[k]!=0){
			printf("%d %lld\n",Q[k],i);
			return 0;
		}
		if(1e18/5<j)break;
	}
	puts("-1");
	return 0;
} 
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <functional>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <unordered_map>
#include <cstdio>
#include <climits>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

ll n;

signed main() {
	std::random_device rnd;
	std::mt19937_64 mt(rnd());
	cin >> n;
	for (int i = 1; i <= 37; i++)for (int j = 1; j <= 25; j++) {
		ll p = 1, q = 1;
		for (int k = 0; k < i; k++)p *= 3;
		for (int k = 0; k < j; k++)q *= 5;
		if (p + q == n) {
			cout << i << " " << j << endl;
			return 0;
		}
	}
	cout << -1 << endl;
}