#include <bits/stdc++.h>   using namespace std;   template <class T>   void DBGpair(T a, string s =   ) {     cerr << s << (s ==    ?    :  :  ) << a.first <<  ,   << a.second <<   n ;   }   template <class T>   void DBGvec(vector<T> a) {     for (T i : a) cerr << i <<    ;     cerr <<   n ;   }   int dx[] = {0, 0, 1, -1};   int dy[] = {1, -1, 0, 0};   char dir[] = { R ,  L ,  D ,  U };   const int MOD = 1e9 + 7;   const long long INF = 1e9;   void setIO(string filename) {     if (fopen((filename +  .in ).c_str(),  r )) {       freopen((filename +  .in ).c_str(),  r , stdin);       freopen((filename +  .out ).c_str(),  w , stdout);     }   }   struct bit {     vector<long long> tree;     bit(int n) { tree = vector<long long>(n + 5, 0); }     long long rsq(int idx) {       long long sum = 0;       while (idx > 0) {         sum += tree[idx];         idx -= idx & -idx;       }       return sum;     }     long long rsq(int a, int b) {       a++;       b++;       return rsq(b) - (a == 1 ? 0 : rsq(a - 1));     }     void upd(int idx, int val) {       idx++;       while (idx < tree.size() - 1) {         tree[idx] += val;         idx += idx & -idx;       }     }   };   void solve() {     int n;     cin >> n;     vector<long long> a(n);     for (auto &i : a) cin >> i;     vector<long long> t(n);     for (auto &i : t) cin >> i;     vector<long long> psums(n + 1);     for (int i = 1; i <= n; i++) psums[i] = psums[i - 1] + t[i - 1];     bit tree(n);     vector<long long> pos(n + 1);     for (int i = 0; i < n; i++) tree.upd(i, 1);     for (int i = 0; i < n; i++) {       int idx = upper_bound((psums).begin(), (psums).end(), a[i] + psums[i]) -                 psums.begin();       if (idx == psums.size()) continue;       idx--;       pos[idx] += a[i] + psums[i] - psums[idx];       tree.upd(idx, -1);     }     for (int i = 0; i < n; i++) {       long long ans = tree.rsq(0, i) * t[i] + pos[i];       cout << ans <<    ;     }     cout <<   n ;   }   int main() {     ios_base::sync_with_stdio(false);     cin.tie(0);     int t = 1;     for (int i = 1; i <= t; i++) solve();   }   