/*
 * Author       : YangDavid
 * Created Time : 2020.10.24 20:00:41
 */

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

const ll INF = 2e18;
int main() {
	ll x, p3 = 3, p5 = 5, deg3 = 1, deg5 = 1;
	map<ll, int> st;
	while(p5 < INF) {
		st[p5] = deg5;
		p5 *= 5, ++deg5;
	}
	cin >> x;
	while(p3 <= x) {
		if(st.count(x-p3)) {
			printf("%lld %d\n", deg3, st[x-p3]);
			return 0;
		}
		p3 *= 3, deg3++;
	}
	puts("-1");

    return 0;
}


#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <map>
#include <queue>
#include <iomanip>
#include <set>
#include <tuple>
#define mkp make_pair
#define mkt make_tuple
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll MOD=1e9+7;
template<class T> void chmin(T &a,const T &b){if(a>b) a=b;}
template<class T> void chmax(T &a,const T &b){if(a<b) a=b;}

const ll INF=2e18;

bool overf(ll x,ll y){
  if(x>INF/y) return true;
  return false;
}

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

  ll N;
  cin>>N;

  ll three=3;
  for(ll a=1;a<60;a++){
    ll five=5;
    for(ll b=1;b<60;b++){
      if(three+five==N){
        cout<<a<<" "<<b<<endl;
        return 0;
      }else if(three+five>N) break;

      if(overf(five,5)) break;
      five*=5;
    }
    if(overf(three,3)) break;
    three*=3;
  }

  cout<<-1<<endl;

  return 0;
}
