#include <algorithm>
#include <array>
#include <cassert>
#include <iostream>
#include <vector>
using namespace std;

template<typename T> ostream& operator<<(ostream &os, const vector<T> &v) { os << '{'; string sep; for (const auto &x : v) os << sep << x, sep = ", "; return os << '}'; }
template<typename T, size_t size> ostream& operator<<(ostream &os, const array<T, size> &arr) { os << '{'; string sep; for (const auto &x : arr) os << sep << x, sep = ", "; return os << '}'; }
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }

void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T) { cerr << ' ' << H; dbg_out(T...); }

#ifdef NEAL_DEBUG
#define dbg(...) cerr << "(" << #__VA_ARGS__ << "):", dbg_out(__VA_ARGS__)
#else
#define dbg(...)
#endif


int main() {
    ios::sync_with_stdio(false);
#ifndef NEAL_DEBUG
    cin.tie(nullptr);
#endif

    int N;
    cin >> N;
    vector<int64_t> A(N), B(N);

    for (auto &a : A)
        cin >> a;

    for (auto &b : B)
        cin >> b;

    vector<int64_t> change;
    int64_t sum = 0;

    for (int i = 0; i < N; i++) {
        int64_t take = i % 2 == 0 ? A[i] : B[i];
        int64_t other = i % 2 == 0 ? B[i] : A[i];
        sum += take;
        change.push_back(other - take);
    }

    nth_element(change.begin(), change.begin() + N / 2, change.end(), greater<int64_t>());

    for (int i = 0; i < N / 2; i++)
        sum += change[i];

    cout << sum << '\n';
}

#include <cmath>
#include <iostream>
#include <map>
#include <utility>
#include <vector>

#define LOOP(n) for (int _i = 0; _i < (n); _i++)
#define REP(i, n) for (int i = 0; i < (n); ++i)
#define RREP(i, n) for (int i = (n); i >= 0; --i)
#define FOR(i, r, n) for (int i = (r); i < (n); ++i)
using namespace std;
using ll = long long;
using ld = long double;
using std::map;
using std::vector;

int main() {
    int n;
    cin >> n;

    ll a[n];
    ll max = 0;
    ll cursumA = 0;
    ll b = 0;
    REP(i, n) {
        cin >> a[i];
        max = std::max(max, a[i]);
        b += cursumA + a[i];
        cout << max * (i + 1) + b << endl;
        cursumA += a[i];
    }

    return 0;
}