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

int main() {
    long long int money = 1000, kabu = 0; 
    int n;
    cin >> n;
    int a[n];
    for(int i = 0; i < n; ++i) cin >> a[i];
    int b[n] = {0};

    if(a[0] < a[1]) b[0] = 1, 
    b[n-1] = -1;
    for(int i = 1; i < n-1; ++i) {
        if(a[i-1] <= a[i] && a[i+1] < a[i]) {
            b[i] = -1;
        } else if(a[i-1] >= a[i] && a[i+1] > a[i]) {
            b[i] = 1;
        } else {
            b[i] = 0;
        }
    }
    for(int i = 0; i < n; ++i) {
        if(b[i] == 1) {
            long long int canbuy = money/a[i];
            kabu += canbuy;
            money -= a[i]*canbuy;
        } else if(b[i] == -1) {
            money += kabu*a[i];
            kabu = 0;
        }
    }
    cout << kabu << '\n';
    cout << money << '\n';
}
