#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
long long n;
cin>>n;
vector<long long>d(n);
for (long long i=0;i<n;i++){
cin>>d[i];
}
long long mn=*min_element(d.begin(),d.end());
long long sum = accumulate(d.begin(),d.end(), 0LL);
long long adicto=sum+(n-2)*mn;
cout<<adicto<<endl;
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... |