#include<bits/stdc++.h>
using namespace std;
using ll = int64_t;
using LL = uint64_t;
typedef vector<ll>VI;
typedef pair<ll,ll>P;
#define VV(T) vector<vector<T>>
#define sz(x) int(x.size())
#define rep(i, n) for (int i = 0; i < (int)n; i++)
#define ALL(a)  (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
#define c_max(a,b) (((ll)a)>((ll)b)?(a):(b))
#define c_min(a,b) (((ll)a)<((ll)b)?(a):(b))
#define vmax(v) *max_element(ALL(v))
#define vmin(v) *min_element(ALL(v))
#define $(x) {cout<<#x<<" = " <<(x)<<endl;}
#define fi first
#define se second
#define MAX 100100
#define MAX6 1001001
#define MAX7 10010010
#define INF 1<<30
#define INFTY 1LL<<61
#define MAX_INT INT_MAX
#define MAX_LL LLONG_MAX
#define CLR(mat) memset(mat, 0, sizeof(mat))
template<class T, class U> inline bool chmax(T& a, U b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class U> inline bool chmin(T& a, U b) { if (a > b) { a = b; return 1; } return 0; }
#define MOD 1000000007
//const ll inf=1e18;
//const int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
// vector型から重複を削除 list.erase(unique(ALL(list)),list.end());
// g++ -o a a.cpp -Wall -lm -std=c++17
//push_back -> emplace_back

int main(){
   ll N;
   cin>>N;
   int B=0;
   VI vec;
   for(ll b=5;b<N;b*=5){
      B++;
      ll x=N-b;
      vec.emplace_back(x);
   }
   VI three;
   for(ll a=3;a<N;a*=3){
      three.emplace_back(a);
   }
   for(int i=0;i<sz(vec);i++){
      if(binary_search(ALL(three), vec[i])){
         cout<<distance(three.begin(), lower_bound(ALL(three), vec[i]))+1<<" "<<i+1<<endl;
         return 0;
      }
   }
   cout<<-1<<endl;
   return 0;
}
#include <bits/stdc++.h>
using namespace std;

int main() {
  
  long long N,M;
  cin >> N;
  
  long long n3 = 1;
  long long n5;
  
  for (int i=1; i<100; i++) {
    n3 *= 3ll;
    M = N-n3;
    n5 = 1;
    if (M <= 1) {
      cout << -1 << endl;
      return 0;
    }
    for (int j=1; j<100; j++) {
      n5 *= 5;
      if (n5 > M) {
        break;
      }
      if (n5 == M) {
        cout << i << " " << j << endl;
        return 0;
      }
    }
  }
  
  return 0;
}

