#include<bits/stdc++.h>
using namespace std;

int main(){
  long long n;
  cin >> n;
  
  long long a = 3;
  long long b = 5;
  int ai = 1;
  int bi = 1;
  
  while(a <= n){
    while(a+b <= n){
      if(a+b == n){
        goto answer;
      }
      if((n-a)%5 != 0){
        break;
      }
      b *= 5;
      bi++;
    }
    b = 5;
    bi = 1;
    a *= 3;
    ai++;
  }
  ai = -1;
  answer:
  if(ai == -1)
    cout << -1 << endl;
  else
    cout << ai << ' ' << bi << endl;
  
}
#include<bits/stdc++.h>
using namespace std;

#define rep(i, a, n) for(int i=(a); i<(n); ++i)
#define per(i, a, n) for(int i=(a); i>(n); --i)
#define pb emplace_back
#define mp make_pair
#define clr(a, b) memset(a, b, sizeof(a))
#define all(x) (x).begin(),(x).end()
#define lowbit(x) (x & -x)
#define fi first
#define se second
#define lson o<<1
#define rson o<<1|1
#define gmid l[o]+r[o]>>1
 
using LL = long long;
using ULL = unsigned long long;
using pii = pair<int,int>;
using PLL = pair<LL, LL>;
using UI = unsigned int;
 
const int mod = 1e9 + 7;
const int inf = 0x3f3f3f3f;
const double EPS = 1e-7;
const double PI = acos(-1.0);

const int N = 1e5 + 10;

int n;
double a[N];

double cal(double x){
	double ret = 0.0;
	rep(i, 0, n){
		ret += (x + a[i] - min(a[i], 2.0*x));
	}
	return ret / n;
}

int main(){
	scanf("%d", &n);
	rep(i, 0, n)	scanf("%lf", a+i);
	double low = 0.0, top = 1e10, m1, m2, a1, a2, ans = 1e20;

	while(top - low > EPS){
		m1 = low + (top - low) / 3.0;
		m2 = top - (top - low) / 3.0;
		a1 = cal(m1);
		a2 = cal(m2);
		if(a1 >= a2){
			ans = min(ans, a2);
			low = m1 + EPS;
		} else {
			ans = min(ans, a1);
			top = m2 - EPS;
		}
	}
	printf("%.10f\n", ans);
	return 0;
}
