#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define rrep(i,n) for (int i = 1; i <= (n); i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using ll = long long;
using Graph = vector<vector<int>>;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
const long long INF = 1LL << 60;
const int dh[4] = {1,-1,0,0};
const int dw[4] = {0,0,1,-1};
const int MOD = 1000000009;
void add(ll &a, ll b) {a = (a+b) % MOD;}


int main() {
  ll N; cin >> N;
  ll a = 3;
  ll ai = 1;
  while(N >= a) {
    ll tmp = N - a;
    ll b = 5,bi = 1;
    while (tmp >= b) {
      if (tmp - b == 0) {
        cout << ai << " " << bi << endl;
        return 0;
      }
      b *= 5;
      bi++;
    }
    a *= 3;
    ai++;
  }
  cout << -1 << endl;
}

#include<bits/stdc++.h>
using namespace std;
#define  	fastt       ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define  	debug       printf("\n<<CameHere>>\n")
#define  	mem(x,y)    memset(x, y, sizeof(x))
#define  	all(qz)     qz.begin(),qz.end()
#define  	rall(qz)    qz.rbegin(),qz.rend()
#define  	inf         1000000000000000000
#define     mod         1000000007
#define     Sqr(x)      ((x)*(x))
#define     ll          long long
#define     mk          make_pair
#define     pb          push_back
#define     pi          acos(-1.0)
#define     cos(a)      cos(a*pi/180)
#define     sin(a)      sin(a*pi/180)
#define     tan(a)      tan(a*pi/180)

#define toll(a) atoll(a.c_str())
string tostr(ll a) {stringstream rr;rr<<a;return rr.str();}
ll ppow(ll c,ll d){return d==0?:c*pow(c,d-1);}
ll gcd(ll a,ll b) {return b==0? a:gcd(b,a%b);}
ll lcm(ll a,ll b) {return ((a*b)/gcd(a,b));}
/*---------AL ASAD NUR RIYAD------------*/


int main()
{
	fastt


    ll n;
    cin>>n;
    vector<ll> v;
    ll cnt=1;
    for(ll i=1;i<40;i++){
    	cnt=cnt*3;
    	v.push_back(cnt);
    	//cout<<cnt<<endl;
    }
    for(ll i=0;i<v.size();i++){
    	ll x=n-v[i];
    	if(x>0){
    		ll y=0;
    		while(x%5==0){
    			x/=5;
    			y++;
    		}
    		if(x==1&&y!=0){
    			cout<<i+1<<" "<<y<<endl;
    			return 0;
    		}
    	}
    }
    cout<<-1<<endl;

    return 0;
}