#define rep(i,n) for (int i=0;i<n;i++)
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
 

int main() {

	unsigned long long n;
  int a,b;
  cin >> n;
  bool torf=false;
  for(unsigned long long i=0;i<37;i++){
    for(unsigned long long j=0;j<25;j++){
      //for(k,i)
      unsigned long long c=1;//=pow(5,j+1);
      unsigned long long d=1;//pow(3,i+1);
      //cout << pow(5,j+1) << endl;
      rep(k,i+1)
        c*=3;
      rep(l,j+1)
        d*=5;
      
      //cout << d << endl;
      unsigned long long temp=c+d;
      if(temp==n){
        torf=true;
        a=i+1;
        b=j+1;
      }
    }
  }
  if(torf==false)
 	 cout << -1 << endl;
  else
    cout << a << ' ' << b << endl;
}
#include <bits/stdc++.h>
using namespace std;
int64_t I=2e18;
int main() {
	int64_t N;
	cin>>N;
	vector<int64_t> p={1};
	vector<int64_t> q={1}; 
	int A=0,B=0;
	while(I/3>=p[A]){
		p.push_back(p[A]*3);
		A++;
	}
	while(I/5>=q[B]){
		q.push_back(q[B]*5);
		B++;
	}
	for(int i=1;i<A;i++){
		for(int j=1;j<B;j++){
			if(p[i]+q[j]==N){
				cout<<i<<" "<<j<<endl;
				return 0;
			}
		}
	}
	cout<<"-1"<<endl;
}