#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

ll chk(ll x){
	ll cnt = 0;
	while(x > 1 && x % 5 == 0) {
		x /= 5;
		cnt++;
	}
	if(x == 1) return cnt;
	return 0;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll n;
	cin >> n;

	ll x = 1;
	ll cnt = 0;
	while(((double) x * 3) <= n){
		x *= 3;
		cnt++;
		ll t = chk(n - x);
		if(t > 0){
			cout << cnt << " " << t << endl;
			exit(0);
		}
	} 

	cout << -1 << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define lli         long long int

#define endl            "\n"
#define pb          push_back
void input()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    freopen("output.txt","w",stdout);
    #endif 
}
const long long mod=1e18;
void solve()
{
    lli n;
    cin>>n;
    lli power=1LL;
    vector<lli>v3;
    vector<lli>v5;
    while(power<mod)
    {
        v3.pb(power);
        power *= 3;
    }
    power=1LL;
    while(power<mod)
    {
        v5.pb(power);
        power *= 5;
    }
    for(int i=1;i<v3.size();i++)
    {
        for(int j=1;j<v5.size();j++)
        {
            if(v3[i]+v5[j]==n)
            {
                cout<<i<<" "<<j<<endl;
               return;
            }
        }
    }
    cout<<"-1"<<endl;
}

int main(){
   // input();
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(0);
    solve();

}
