#include <bits/stdc++.h>
using namespace std;
int n,a[300001];
vector <int> v;
int main()
{
scanf("%d",&n);
for (int i=0;i<n;i++) {
scanf("%d",&a[i]);
}
for (int i=1;i<n;i++) {
if (a[i-1] > a[i]) {
a[i]=a[i-1]+a[i];
}
else {
v.push_back(a[i-1]);
}
}
v.push_back(a[n-1]);
for (auto x : v) printf("%d ",x);
cout << endl;
}