#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef long double LD;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<LD> VLD;
typedef vector<string> VS;
#define rep(i, max) for (LL i = 0; i < (LL)(max); i++)
#define repm(i, min, max) for (LL i = (LL)(min); i < (LL)(max); i++)
#define rev(i, max) for (LL i = (LL)(max) - 1; i >= 0; i--)
#define revm(i, min, max) for (LL i = (LL)(max) - 1; i >= (LL)(min); i--)

int main()
{
  LL N;
  cin>>N;

  LL a = 3;
  int p = 1;
  while(a < N){
    LL b = 5;
    int q = 1;
    while(b < N){
      if(a + b == N){
        cout<<p<<" "<<q<<endl;
        return 0;
      }
      q++;
      b *= 5;
    }
    p++;
    a *= 3;
  }
  cout<<-1<<endl;
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
#define rep(i,n) for (int i=0; i<(n);++i)
ll n,p,q,mod=pow(10,9)+7;

int main(){
    cin >> n;
    p = n%5;
    if(p==0){
        cout << -1;
        return 0;
    }
    if(p==1) q=4;
    else if(p==2) q=3;
    else if(p==3) q=1;
    else q=2;
    ll t=1,ans=q,ans2=0;
    set<ll> s;
    while(true){
        if(t<pow(10,18)){
            t*=5;
            s.insert(t);
        }
        else break;
    }
    q = pow(3,q);
    rep(i,20){
        if(n>q){
            if(s.count(n-q)){
                ll r=n-q;
                while(true){
                    if(r%5==0){
                        ans2++;
                        r/=5;
                    }
                    else break;
                }
                cout << ans << ' ' << ans2 << endl; 
                return 0;
            }
        }
        else{
            cout << -1;
            return 0;
        }
        q*=81;
        ans+=4;
    }
}