#include <iostream>
using namespace std;
int n, max_ = 1000, min_ = 1;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    cin >> n;
    int temp;
    for(int i = 0;i < n;++i)
    {
        cin >> temp;
        min_ = max(temp, min_);
    }
    for(int i = 0;i < n;++i)
    {
        cin >> temp;
        max_ = min(temp, max_);
    }
    if(max_ - min_ + 1 <= 0){cout << 0;}
    else{cout << max_ - min_ + 1;}
    return 0;
}
#include <stdio.h>

long long int x[200010];
long long int sum[200010],sum2[200010],max[200010];
int main()
{
	int a;
	scanf("%d",&a);
	for(int i=1;i<=a;i++) scanf("%lld",&x[i]);
	for(int i=1;i<=a;i++) sum[i] = sum[i-1] + x[i];
	for(int i=1;i<=a;i++) sum2[i] = sum2[i-1] + sum[i];
	
	max[1] = x[1];
	for(int i=1;i<=a;i++) max[i] = max[i-1]>x[i]?max[i-1]:x[i];
	
	for(int i=1;i<=a;i++)
	{
		long long int S = sum[i] + sum2[i-1] + i*max[i];
		printf("%lld\n",S);
	}
}