/*#include<iostream>

using namespace std;

int main(){
int n;
while (cin >> n){
if (n == 0) break;
else if (n > 0 && n < 100){
int sum=0, max,min;
int *f = new int[n];
for (int i = 0; i < n; i++)
cin >> f[i];
max = min = f[0];
for (int i = 1; i < n; i++){
if (f[i]>max) max = f[i];
if (f[i]<min) min = f[i];
}
cout << max * 6 + (max - min) * 4 + n * 5 << endl;
}
else break;
}
return 0;
}
*/