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

vector<int> input(int N) {
  vector<int> vec(N);
  for (int i = 0; i < N; i++) {
    cin >> vec.at(i);
  }
  return vec;
}

void output(int a) {
  cout << a << endl;
}

int mod(vector<int> A, int N, int max){
  long mmax = -1;
  for (int i=0; i<max; i++){
    long sum = 0;
    for (int j=0; j<N; j++){
      sum += i % A[j];
    }
    if (mmax < sum){
      cout << sum << endl;
      mmax = sum;
    }
  }
  return mmax;
}

int main() {
  int N;
  cin >> N;
  vector<int> A;
  A = input(N);
  long max = 1;
  for (int i=0; i<N; i++){
    max = lcm(max, A[i]);
  }
  cout << max << endl;
  cout << mod(A, N, max) << endl;
}
