#include <iostream>
#include <algorithm>
#include <functional>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <cmath>

typedef long long ll;
#define rep(i,n) for(i=0;i<n;i++)
#define pub push_back
#define pob pop_back
using namespace std;
int gcd(int a,int b){int r;while((r=a%b)!=0){a=b;b=r;}return b;}//最大公約数
int lcm(int a,int b){return (a*b)/gcd(a,b);}//最小公倍数
using P=pair<int,int>;
typedef struct time{
    int score;
    string col;
} tm_t;



int main() {
    ll i,n;
    cin>>n;
    if(n==2){
        cout<<'3'<<endl;
        return 0;
    }
    ll ans=1;
    if(n<=12){
        for(i=2;i<=n;i++){
            ans*=i;
        }
        cout<<ans+1<<endl;
        return 0;
    }else{
        cout<<(ll)4*4*5*5*7*3*9*11*13*17*19*23*29+1<<endl;
        return 0;
    }
}


#include <vector>
#include <array>
#include <stack>
#include <queue>
#include <list>
#include <bitset>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <numeric>
#include <iostream>
#include <iomanip>
#include <string>
#include <chrono>
#include <random>
#include <cmath>
#include <cassert>
#include <climits>
#include <cstring>
#include <cstdlib>
#include <functional>
#include <sstream>

using namespace std;


int main(int argc, char** argv) {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(12);


    int n;
    cin >> n;
    vector<long long> A(n);

    for (int i = 0; i < n; ++i) {
        cin >> A[i];
    }

    long long sum = 0;
    long long pre = 0;
    long long res = 0;
    long long mx = 0;
    for (int i = 0; i < n; ++i) {
        mx = max(mx, A[i]);
        res = mx * (i + 1);
        pre += A[i];
        sum += pre;
        res += sum;
        cout << res << '\n';
    }

    return 0;
}