using System;
class Program
{
	static void Main(string[] args)
	{
		int n = int.Parse(Console.ReadLine());
        long[] array = new long[n];
        long[] sumArray = new long[n+1];
        sumArray[0] = 0;
        long sum = 0;
        long max = 0;
        string[] input = Console.ReadLine().Split(' ');
        for(int i=0; i<n; i++){      
            array[i] = long.Parse(input[i]);
            sum += array[i];
            sumArray[i+1] = sum;
            if(array[i] > max) max = array[i];
        }
        Console.WriteLine(max);
        for(int k=2; k<=n; k++){
            max = 0;
            for(int l=k; l<=n; l++){
                long temp = sumArray[l] - sumArray[l-k];
                if(temp > max) max = temp;
            }
            Console.WriteLine(max);
        }
        
	}
}