#include<bits/stdc++.h>
#define inf INT_MAX
#define sc(a) scanf("%d",&a)
#define scc(a,b) scanf("%d %d",&a,&b)
#define sccc(a,b,c) scanf("%d %d %d",&a,&b,&c)
#define lsc(a) scanf("%lld",&a)
#define lscc(a,b) scanf("%lld %lld",&a,&b)
#define lsccc(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define pf(a) printf("%d",a)
#define pff(a,b) printf("%d %d",a,b)
#define pfff(a,b,c) printf("%d %d %d",a,b,c)
#define pb(a) push_back(a)
#define em empty()
#define fr front()
#define cl clear()
#define sz size()
#define mp(a,b) make_pair(a,b)
#define fri(b) freopen(b,"r",stdin)
#define fro(b) freopen(b,"w",stdout)


using namespace std;

vector<string> vec;
long long arr[64];

int main(){
	//fri("gir.txt");
	//fro("cik.txt");
	int n;
	cin>>n;
	long long add=1;
	arr[0]=add;
	for(int i=1;i<=60;i++){
		add*=2;
		arr[i]=add;
	}
	string sss="aaa";
	vec.pb(sss);
	long long cnt=0;
	for(int i=1;i<=n;i++){
		string asd;
		cin>>asd;
		vec.pb(asd);
		if(asd=="OR"){
			cnt+=arr[i];
		}
	}
	cnt++;
	cout<<cnt<<endl;

	return 0;
}

#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#define dlog(str) cout << "====" << str << endl;
#else
#define dlog(str)
#endif
#define INF 999999999
#define MOD 1000000007
#define LLI long long int
#define REP(i, n) for(LLI i = 0, i##_l = (n); i < i##_l; i++)
#define FOR(i, s, e) for(LLI i = s, i##_l = (e); i < i##_l; i++)
#define _min(a,b) ((a<b)?a:b)
#define _max(a,b) ((a<b)?b:a)
#define chmax(a, b) a = _max(a, b)
#define chmin(a, b) a = _min(a, b)
#define bit(a, shift) ((a>>shift)&1))
#define pm(a) ((a)?1:-1)
#define SORT(v) sort(v.begin(),v.end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
// int 2.14E±9    lli 9.2E±18    double 1.7E±380


int main()
{
	cout << fixed << setprecision(10);

	LLI n;
	cin >> n;

	vector<LLI> a(n), b(n);
	LLI am = 1, bm = 1, amt = 1;
	LLI ma = 1;
	REP(i, n)
	{
		cin >> a[i];
	}
	REP(i, n)
	{
		cin >> b[i];
	}

	REP(i, n)
	{
		chmax(ma, b[i] * am);
		chmax(am, a[i]);
		chmax(ma, b[i] * am);
		cout << ma << endl;
	}

	return 0;
}