/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define ll long long

inline int inint(istream& in) {int x; in >> x; return x;}
inline ll inll(istream& in) {ll x; in >> x; return x;}
inline string instr(istream& in) {string x; in >> x; return x;}

#define REP(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
#define FOR(i, a, b) for (int i = (a), i##_len = (b); i <= i##_len; ++i)
#define REV(i, a, b) for (int i = (a); i >= (b); --i)
#define CLR(a, b) memset((a), (b), sizeof(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define INF 1001001001001001001ll
#define fcout cout << fixed << setprecision(12)


class AChinchirorin {
public:
void solve(std::istream& in, std::ostream& out) {
    int a = inint(in);
    int b = inint(in);
    int c = inint(in);

    if(a == b){
        out << c << endl;
    }else if(b == c){
        out << a << endl;
    }else if(a == c){
        out << b << endl;
    }else{
        out << 0 << endl;
    }

}
};

int main() {
	AChinchirorin solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define f(i,a,b) for(int i=a; i<b; i++)
#define fr(i,a,b) for(int i=a; i>=b; i--)
#define fll(i,a,b) for(ll i=a; i<b; i++)
#define frll(i,a,b) for(ll i=a; i>=b; i--)
typedef vector<int> vi;
typedef long long int ll;
typedef vector<ll> vll;

#define fastio std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define PI 3.1415926535
ll Mod = 1e9+7;
ll N = 1e5;

// ll Mod = 998244353;

// ll mult(ll a, ll b) {
//     ll ret = 1;
//     ret = ((a%Mod) * (b%Mod))%Mod;
//     return ret;
// }

// ll power(ll a, ll b = Mod-2) {
//     if(b == 0) return 1;
//     ll ret = 1;
//     while(b) {
//         if(b&1) {
//             ret = mult(ret,a);
//         }
//         a = mult(a,a);
//         b>>=1;
//     }
//     return ret;
// }

// ll sub(ll a, ll b) {
//     ll ret = (a%Mod - b%Mod + Mod)%Mod;
//     return ret;
// }

// void seive(vector<bool> &status) {
//      f(i,2,2e6+1) {
//          if(status[i]) {
//                 for(ll j = i*i; j<=2e6; j+=i) status[j] = 0;
//          }
//      }
//  }

// int getmex(vi& occr, int n, int mex) {
//     for(int i = mex; i<n; i++) {
//         if(occr[i] == 0) return i;
//     }
//     return n;
// }

// int gcd(int a, int b) {
//     if(b == 0) return a;
//     return gcd(b,a%b);
// }

void solve_case() {
    int n;
    cin>>n;
    vll a(n), p_max(n,-1), p_sum(n,0);

    f(i,0,n) {
        cin>>a[i];
        if(i == 0) {
            p_max[i] = a[i];
            p_sum[i] = a[i];
        } else { 
            p_max[i] = max(a[i],p_max[i-1]);
            p_sum[i] = p_sum[i-1] + a[i];
        }
    }

    f(i,1,n) p_sum[i] = p_sum[i] + p_sum[i-1];

    ll p_ans = 0, ans = 0;

    f(i,0,n) {
        cout<<p_sum[i] + (i+1)*p_max[i]<<'\n';
    }
    return;
}


int main() {
    #ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif

    fastio;
    // vector<bool> status(2e6+1,1);
    int t = 1;
    // vi primes;
    // seive(status);
    // f(i,2, 2e6+1) {
    //     if(i > 5000) {
    //         break;
    //     }
    //     if(status[i]) primes.push_back(i);
    // } 
    // cin>>t;
    while(t--) {
        solve_case();
    }
}