#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
const int MAXN = 2e5 + 2;
long long max1(long long a, long long b) { return (a < b) ? b : a; }
int a[2 * MAXN];
int n;
int vmin = INF;
int id[MAXN];
int cs;
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i + n] = a[i];
    if (a[i] < vmin) {
      vmin = a[i];
      cs = i;
    }
  }
  cs += n;
  long long res = -1ll * INF * INF;
  id[n] = cs;
  if (a[n] == vmin) id[n] = n;
  for (int i = n - 1; i >= 1; i--) {
    if (a[i] == vmin) {
      id[i] = i;
    } else {
      id[i] = id[i + 1];
    }
  }
  for (int i = 1; i <= n; i++) {
    res = max(res, 1ll * vmin * n + (id[i] - i));
  }
  cout << res;
  return 0;
}
