#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define inf32 ((int)1e9 + 7)
#define inf64 ((long long)1e18 + 7)
#define MASK32(x) (1 << (x))
#define MASK64(x) (1ll << (x))
#define BIT(mask, i) (((mask) >> (i)) & 1)
#define all(a) begin(a), end(a)
#define isz(a) ((int)a.size())
const int N = 1e5 + 1;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
long long s = 0, mn = inf32;
cin >> n;
for(int i = 1, x; i <= n; ++i) {
cin >> x;
s += x;
mn = min(mn, 1ll * x);
}
cout << (s - mn) + mn * (n - 1);
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |