#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i, s, n) for (int i = (s); i < (n); ++i)
#define all(a) a.begin(), a.end()
#define len(x) (int)(x).size()
#define dup(x, y) (((x) + (y)-1) / (y))
#define pb push_back
#define Field(T) vector<vector<T>>
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  long N;
  cin >> N;
  for (long i = 1, a = 3; a < N; i++, a *= 3) {
    for (long j = 1, b = 5; b < N; j++, b *= 5) {
      if (a + b == N) return cout << i << " " << j << "\n", 0;
    }
  }
  cout << -1 << endl;
  return 0;
}

template <class T>
inline bool chmin(T& a, T b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}
#include<bits/stdc++.h>
#define ll long long int 
#define dd double
using namespace std;
const ll MOD = 1e9 + 7;

int main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin>>n;
  ll sum=0;
  ll i=0;
  for(i=1;i<=n;i++){
  	sum=sum+i;
//  	cout<<sum<<endl;
   if(sum>=n){
   	break;
   }
  }
  
  cout<<i<<endl;

  return 0;
}
