import java.util.*;
public class Main {
private class Node{
Node left;
Node right;
int data;
}
private Node root;
void constract(int ar[]){
this.root=constract(ar,0,ar.length);
}
private Node constract(int ar[],int low,int high) {
if(low>=high)
{
return null;
}
int mid=(low + high)/2;
Node nn=new Node();
nn.data=ar[mid];
nn.left=constract(ar,low,mid);
nn.right=constract(ar,mid+1,high);
return nn;
}
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
int n=sc.nextInt();
int ar[]=new int [n];
for(int i=0;i<n;i++) {
ar[i]=sc.nextInt();
}
Main tree=new Main();
tree.constract(ar);
//tree.preOrder();
tree.replaceWithSum();
// System.out.println();
tree.preOrder();
}
public void replaceWithSum(){
replaceWithSum(this.root);
}
static int sum=0;
private void replaceWithSum(Node node) {
if(node==null) {
return ;
}
replaceWithSum(node.right);
sum+=node.data;
node.data=sum;
replaceWithSum(node.left);
}
public void preOrder() {
preOrder(this.root);
}
private void preOrder(Node node) {
if(node==null) {
return ;
}
System.out.print(node.data+" ");
preOrder(node.left);
preOrder(node.right);
}
}