#include <iostream>
#include <vector>
using namespace std;
signed main() {
const int n = 7;
vector<int> a(n),pref(n);
int mx = -INT_MAX,l = 0, r = n-1;
for(int i = 0; i < n; i++){
cin >> a[i];
if(i == 0) pref[i] = a[i] * a[i];
else pref[i] = pref[i-1] + a[i] * a[i];
if(a[i] > mx){
mx = a[i];
l = i;
}
cout << pref[r] - pref[l];
#include <iostream>
#include <vector>
using namespace std;
signed main() {
const int n = 7;
vector<int> a(n),pref(n);
int mx = -INT_MAX,l = 0, r = n-1;
for(int i = 0; i < n; i++){
cin >> a[i];
if(i == 0) pref[i] = a[i] * a[i];
else pref[i] = pref[i-1] + a[i] * a[i];
if(a[i] > mx){
mx = a[i];
l = i;
}
}
cout << pref[r] - pref[l];
}