#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;

void solve() {
	ll n;
	cin >> n;
	ll pw5 = 5;
	int cnt5 = 1;
	while (n >= pw5) {
		ll cur = n - pw5;
		int cnt = 0;
		while (cur > 0 && cur % 3 == 0)
			cur /= 3, cnt++;
		if (cur == 1 && cnt > 0) {
			cout << cnt << ' ' << cnt5 << endl;
			return ;
		}
		pw5 *= 5ll;
		if (pw5 >= 1e18)
			break;
		cnt5++;
	}
	cout << -1;
}

int main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// int t; cin >> t;
	// while (t--)
	solve();

}
#include <iostream>
#include <string>
using namespace std;

int main() {
    int i, j, n;
    string S, test;
    string ZONe = "ZONe";

    cin >> S;
    n = 0;
    for(i=0; i<9; i++) {
        test = "";
        for(j=i; j<i+4; j++) {
            test += S[j];
        }
        if(test == ZONe) n++;
    }
    cout << n << endl;
}