#include #define _ ios_base::sync_with_stdio(false);cin.tie(0); using namespace std; #define pb push_back #define pob pop_back #define pf push_front #define pof pop_front #define mp make_pair #define all(a) a.begin(),a.end() #define bitcnt(x) __builtin_popcountll(x) #define MOD 1000000007 #define PI 3.14159265 #define tot 300005 #define BLOCK 20000 #define MAXN 1000000000000000 typedef unsigned long long int uint64; typedef long long int int64; int a[10005]; int64 comp( int l ,int r ){ int64 g = 0; int64 s=0,m=0; for(int i = l ; i <=r ; i++ ){ g=__gcd(g,a[i]); s+=a[i]; m=max(m,a[i]); } s-=m; return g*s; } int main(){ int n; cin>>n; for( int i = 0 ; i >a[i]; int64 ans=0; for( int i = 0; i