#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define int long long 
#define rep(i,j,k) for(int i=j;i<k;i+=1)
#define rrep(i,j,k) for(int i=n-1;i>=0;i-=1)
#define sorti(v) sort(v.begin(),v.end())
#define sortd(v) sort(v.begin(),v.end(),greater<int>())
#define mm map<int,int>
#define vv vector<int>
#define tmm map<int,map<int,int>>
#define trav(a, x) for(auto& a : x)
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound
#define all(v) v.begin(),v.end()
#define pb push_back
#define alot(x,y) memset(x,y,sizeof(x))
#define pii pair<int,int>
#define code ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
const int MOD=1e9+7;
const double pi=acos(-1.0);
/*memset(array_name,value_to_be_intialized,sizeof(array_name));
 __builtin_popcount(n) count no of set bit in number n
next_permutation(s.begin(),s.end());
int binpow(int a,int b){
    int res=1;
    while(b>0){
        if(b&1)res*=a;
        a*=a;
        b>>=1;
        
    }
    return res;
}
// lower_bound==> if the element is present it return its first occurence else 1st element which is greater than 
// upper_bound==> it will always return iterator to element which is greater than searched element
*/
int32_t main ()
{
     code;
    int tt;
    //cin>>tt;
    tt=1;
    while(tt--){
        int n;
        cin>>n;
        mm mxa;
        int a[n+1];
        int b[n+1];
        cin>>a[0];
        mxa[0]=a[0];
        for(int i=1;i<n;i++){
            cin>>a[i];
            mxa[i]=max(mxa[i-1],a[i]);
        }
        cin>>b[0];
         for(int i=1;i<n;i++){
            cin>>b[i];
        }
        cout<<a[0]*b[0]<<'\n';
        int ans=a[0]*b[0];
        for(int i=1;i<n;i++){
             int p=mxa[i]*b[i];
             ans=max(ans,p);
             cout<<ans<<"\n";
        }
        
        cout<<"\n";
        
        
        
        
    
    }
    return 0;
    
}
# include <bits/stdc++.h>
#include <cmath>
#include <string>
#include <vector>
using namespace std;


typedef long long                                        ll;
typedef long double                                      ld;
typedef pair <int, int>                                  pii;
typedef pair <pii, int>                                  ppi;
typedef pair <int, pii>                                  pip;
typedef pair <pii, pii>                                  ppp;
typedef pair <ll, ll>                                    pll;
 
# define A                                               first
# define B                                               second
# define endl                                            '\n'
# define sep                                             ' '
# define all(x)                                          x.begin(), x.end()
# define kill(x)                                         return cout << x << endl, 0
# define SZ(x)                                           int(x.size())
# define lc                                              id << 1
# define rc                                              id << 1 | 1
#define fs(n) fixed << setprecision(n)
#define mp(i, j) make_pair(i, j);
 
ll power(ll a, ll b, ll md) {
    return (!b ? 1 : (b & 1 ? a * power(a * a % md, b / 2, md) % md : power(a * a % md, b / 2, md) % md));
}
 
const int xn = 1e5 + 10;
const int xm = - 20 + 10;
const int sq = 320;
const int inf = 1e9 + 10;
const ll INF = 1e18 + 10;
const int mod = 1e9 + 7;//998244353;
const int base = 257;

int main(){
    ios::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#ifndef ONLINE_JUDGE
 freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
#endif
int n, ans = 0;
cin >> n;
int a[n];
for(int i = 0; i < n; i++){
    cin >> a[i];
}
for(int i = 0; i < n; i++){
    if(a[i] > 10){
        ans = ans + (a[i] - 10);
    }
}
cout << ans;
}