#include <bits/stdc++.h>
#define LL long long
#define ULL unsigned long long
#define pb push_back
#define st first
#define nd second
#define INF 0x3f3f3f3f
#define LINF 0x3f3f3f3f3f3f3f3f
template <class T> T read(T &a) {
    a=0;char x=getchar();bool f=0;
    for(;x<'0'||x>'9';x=getchar())f|=x=='-';
	for(;x>='0'&&x<='9';x=getchar())a=(a<<3)+(a<<1)+x-'0';
    if(f)a=-a;
    return a;
}
using namespace std;

int main() {
    char s[10];
    scanf("%s", s);
    putchar(s[1]);
    putchar(s[2]);
    putchar(s[0]);
	return 0;
}


// Problem : A - 106
// Contest : AtCoder - AtCoder Regular Contest 106
// URL : https://atcoder.jp/contests/arc106/tasks/arc106_a
// Memory Limit : 1024 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>

using namespace std;

long long N;
long long mypow(long long a, long long b){
	long long ret = 1;
	while(b--){
		ret *= a;
	}
	return ret;
}

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin >> N;
	for(long long i = 1; i<40; i++){
		for(long long j = 1; mypow(3, i) + mypow(5, j) <= N; j++){
			if(mypow(3, i) + mypow(5, j) == N){
				cout << i << " " << j << "\n";
				return 0;
			}
		}
	}
	cout << -1;
}