You are given a function f written in some basic language. The function accepts an integer value, which is immediately written into some variable x. x is an integer variable and can be assigned values from 0 to 2^{32}-1. The function contains three types of commands:

  * for n — for loop; 
  * end — every command between "for n" and corresponding "end" is executed n times; 
  * add — adds 1 to x. 



After the execution of these commands, value of x is returned.

Every "for n" is matched with "end", thus the function is guaranteed to be valid. "for n" can be immediately followed by "end"."add" command can be outside of any for loops.

Notice that "add" commands might overflow the value of x! It means that the value of x becomes greater than 2^{32}-1 after some "add" command. 

Now you run f(0) and wonder if the resulting value of x is correct or some overflow made it incorrect.

If overflow happened then output "OVERFLOW!!!", otherwise print the resulting value of x.

Input

The first line contains a single integer l (1 ≤ l ≤ 10^5) — the number of lines in the function.

Each of the next l lines contains a single command of one of three types:

  * for n (1 ≤ n ≤ 100) — for loop; 
  * end — every command between "for n" and corresponding "end" is executed n times; 
  * add — adds 1 to x. 

Output

If overflow happened during execution of f(0), then output "OVERFLOW!!!", otherwise print the resulting value of x.

Examples

Input


9
add
for 43
end
for 10
for 15
add
end
add
end


Output


161


Input


2
for 62
end


Output


0


Input


11
for 100
for 100
for 100
for 100
for 100
add
end
end
end
end
end


Output


OVERFLOW!!!

Note

In the first example the first "add" is executed 1 time, the second "add" is executed 150 times and the last "add" is executed 10 times. Note that "for n" can be immediately followed by "end" and that "add" can be outside of any for loops.

In the second example there are no commands "add", thus the returning value is 0.

In the third example "add" command is executed too many times, which causes x to go over 2^{32}-1.
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Stack;
import java.util.StringTokenizer;
import java.util.TreeMap;
import java.util.TreeSet;

public class hacker49 {

	static class FastReader 
    { 
        BufferedReader br; 
        StringTokenizer st; 
  
        public FastReader() 
        { 
            br = new BufferedReader(new
                     InputStreamReader(System.in)); 
        } 
  
        String next() 
        { 
            while (st == null || !st.hasMoreElements()) 
            { 
                try
                { 
                    st = new StringTokenizer(br.readLine()); 
                } 
                catch (IOException  e) 
                { 
                    e.printStackTrace(); 
                } 
            } 
            return st.nextToken(); 
        } 
  
        int nextInt() 
        { 
            return Integer.parseInt(next()); 
        } 
  
        long nextLong() 
        { 
            return Long.parseLong(next()); 
        } 
  
        double nextDouble() 
        { 
            return Double.parseDouble(next()); 
        } 
  
        String nextLine() 
        { 
            String str = ""; 
            try
            { 
                str = br.readLine(); 
            } 
            catch (IOException e) 
            { 
                e.printStackTrace(); 
            } 
            return str; 
        } 
    } 
	public static void main(String[] args) {
		OutputStream outputStream =System.out;
	    PrintWriter out =new PrintWriter(outputStream);
		FastReader s=new FastReader();
int l=s.nextInt();
long h=(long) (Math.pow(2, 32))-1;
Stack<Long> e=new Stack<>();
long ans=0;
int y=l;
long u=0;
//System.out.println(h);
boolean p=false;
while(l>0) {
	String str=s.next();
	if(str.charAt(0)=='f') {
		long x=s.nextLong();
		if(e.isEmpty()) {
			e.add(x);
		}else {
			long g=e.peek();
			e.add((long) Math.min(Math.pow(2, 32), g*x));
		}
	}else if(str.charAt(0)=='e') {
		e.pop();
	}else {
		if(e.isEmpty()) {
			ans+=1;
		}else {
			long r=e.peek();
			ans+=r;
		}
	}
	l--;
}
if(ans<=h) {
//	if(y==100000 && ans==0) {
//		out.println(u);
//	}
	out.println(ans);
}else {
	out.println("OVERFLOW!!!");
}
		
		out.close();
	}
	public static int upper_bound(pair[] a ,int x,int d) {
		int l=0;
		int r=d+1;
		while(r>l+1) {
			int mid=(l+r)/2;
			if(a[mid].a<x) {
				l=mid;
			}else {
				r=mid;
			}
		}
		return r;
				
	}
	
	static int[] t=new int[501];
	static class pair implements Comparable<pair>{
		private long a;
		private long b;
//		private int c;
		pair(long a,long b){
			this.a=a;
			this.b=b;
//			this.c=c;
		}
		public int compareTo(pair o) {
			return Long.compare(this.a,o.a);
		}
	}
	public static long[] merge_sort(long[] A, int start, int end) {
		if (end > start) {
			int mid = (end + start) / 2;
			long[] v = merge_sort(A, start, mid);
			long[] o = merge_sort(A, mid + 1, end);
			return (merge(v, o));
		} else {
			long[] y = new long[1];
			y[0] = A[start];
			return y;
		}
	}
	public static long[] merge(long a[], long b[]) {
//		int count=0;
		long[] temp = new long[a.length + b.length];
		int m = a.length;
		int n = b.length;
		int i = 0;
		int j = 0;
		int c = 0;
		while (i < m && j < n) {
			if (a[i] < b[j]) {
				temp[c++] = a[i++];
			
			} else {
				temp[c++] = b[j++];
			}
		}
		while (i < m) {
			temp[c++] = a[i++];
		}
		while (j < n) {
			temp[c++] = b[j++];
		}
		return temp;
	}
static ArrayList<Integer>[] f=new ArrayList[501];	
static int[] vis=new int[501];	
static PriorityQueue<pair> e1=new PriorityQueue<>();
static PriorityQueue<pair> e2=new PriorityQueue<>();
static void dfs(int node) {
		vis[node]=1;
//		e2.add(new pair(node));
//		e1.add(new pair(t[node]));
		for(int i=0;i<f[node].size();i++) {
			if(vis[f[node].get(i)]==0) {
				dfs(f[node].get(i));
			}
		}
	}
	
	public static int[] Create(int[] a,int n) {
		int[] b=new int[n+1];
		for(int i=1;i<=n;i++) {
			int j=i;
			int h=a[i];
			while(i<=n) {
				b[i]+=h;
				i=get_next(i);
			}
			i=j;
		}
		return b;
	}
public static int get_next(int a) {
	return a+(a&-a);
}
public static int get_parent(int a) {
	return a-(a&-a);
}
public static int query_1(int[] b,int index) {
	int sum=0;
	if(index<=0) {
		return 0;
	}
	while(index>0) {
		sum+=b[index];
		index=get_parent(index);
	}
	return sum;
}
public static int query(int[] b,int n,int l,int r) {
	int sum=0;
	sum+=query_1(b,r);
	sum-=query_1(b,l-1);
	return sum;
}
public static void update(int[] a,int[] b,int n,int index,int val) {
	int diff=val-a[index];
	a[index]+=diff;
	while(index<=n) {
		b[index]+=diff;
		index=get_next(index);
	}	
}
	
//	public static void Create(int[] a,pair[] segtree,int low,int high,int pos) {
//		if(low>high) {
//			return;
//		}
//		if(low==high) {
//			segtree[pos].b.add(a[low]);
//			return ;
//		}
//		int mid=(low+high)/2;
//		Create(a,segtree,low,mid,2*pos);
//		Create(a,segtree,mid+1,high,2*pos+1);
//		segtree[pos].b.addAll(segtree[2*pos].b);
//		segtree[pos].b.addAll(segtree[2*pos+1].b);
//	}
//	public static void update(pair[] segtree,int low,int high,int index,int pos,int val,int prev) {
//		if(index>high || index<low) {
//			return ;
//		}
//		if(low==high && low==index) {
//			segtree[pos].b.remove(prev);
//			segtree[pos].b.add(val);
//			return;
//		}
//			int mid=(high+low)/2;
//			 update(segtree,low,mid,index,2*pos,val,prev);
//			 update(segtree,mid+1,high,index,2*pos+1,val,prev);
//			 segtree[pos].b.clear();
//			  segtree[pos].b.addAll(segtree[2*pos].b);
//			  segtree[pos].b.addAll(segtree[2*pos+1].b);
//			  
//	}
//	public static pair query(pair[] segtree,int low,int high,int qlow,int qhigh ,int pos) {
//		if(low>=qlow && high<=qhigh) {
//			return segtree[pos];
//		}
//		if(qhigh<low || qlow>high) {
//			return new pair();
//		}
//		int mid=(low+high)/2;
//	  pair a1=query(segtree,low,mid,qlow,qhigh,2*pos);
//	  pair a2=query(segtree,mid+1,high,qlow,qhigh,2*pos+1);
//	  pair a3=new pair();
//	  a3.b.addAll(a1.b);
//	  a3.b.addAll(a2.b);
//	  return a3;
//	  
//	}
//	
//	public static int nextPowerOf2(int n) 
//	{ 
//	    n--; 
//	    n |= n >> 1; 
//	    n |= n >> 2; 
//	    n |= n >> 4; 
//	    n |= n >> 8; 
//	    n |= n >> 16; 
//	    n++;     
//	    return n; 
//	} 
//	
////	static class pair implements Comparable<pair>{
////		private int a;
////		private long b;
//////		private long c;
////		pair(int a,long b){
////			this.a=a;
////			this.b=b;
//////			this.c=c;
////		}
////		public int compareTo(pair o) {
//////		if(this.a!=o.a) {
//////			return Long.compare(this.a, o.a);
//////		}else {
////			return Long.compare(o.b,this.b);
//////		}
////		}
////	}
//	static class pair implements Comparable<pair>{
//		private int a;
//		private int b;
//		pair(int a,int b){
////			this.b=new HashSet<>();
//			this.a=a;
//			this.b=b;
//		}
//		public int compareTo(pair o) {
//			return Integer.compare(this.b, o.b);
//		}
//	}
	public static int lower_bound(ArrayList<Long> a ,int n,long x) {
		int l=0;
		int r=n;
		while(r>l+1) {
			int mid=(l+r)/2;
			if(a.get(mid)<=x) {
				l=mid;
			}else {
				r=mid;
			}
		}
		return l;		
	}

	public static int[] is_prime=new int[1000001];
	public static ArrayList<Long> primes=new ArrayList<>();
 	public static void sieve() {
		long maxN=1000000;
		for(long i=1;i<=maxN;i++) {
			is_prime[(int) i]=1;
		}
		is_prime[0]=0;
		is_prime[1]=0;
		for(long i=2;i*i<=maxN;i++) {
			if(is_prime[(int) i]==1) {
//				primes.add((int) i);
				for(long j=i*i;j<=maxN;j+=i) {
					is_prime[(int) j]=0;
				}
			}
		}
		for(long i=0;i<=maxN;i++) {
			if(is_prime[(int) i]==1) {
				primes.add(i);
			}
		}		
	}
	
	
//	public static pair[] merge_sort(pair[] A, int start, int end) {
//		if (end > start) {
//			int mid = (end + start) / 2;
//			pair[] v = merge_sort(A, start, mid);
//			pair[] o = merge_sort(A, mid + 1, end);
//			return (merge(v, o));
//		} else {
//			pair[] y = new pair[1];
//			y[0] = A[start];
//			return y;
//		}
//	}
//	public static pair[] merge(pair a[], pair b[]) {
//		pair[] temp = new pair[a.length + b.length];
//		int m = a.length;
//		int n = b.length;
//		int i = 0;
//		int j = 0;
//		int c = 0;
//		while (i < m && j < n) {
//			if (a[i].b >= b[j].b) {
//				temp[c++] = a[i++];
//			
//			} else {
//				temp[c++] = b[j++];
//			}
//		}
//		while (i < m) {
//			temp[c++] = a[i++];
//		}
//		while (j < n) {
//			temp[c++] = b[j++];
//		}
//		return temp;
//	}
	
	
//	public static long im(long a) {
//		return binary_exponentiation_1(a,mod-2)%mod;
//	}
	public static double bn1(double a,double n) {
		double res=1;
		while(n>0) {
			if(n%2!=0) {
//				res=((res)%(1000000007) * (a)%(1000000007))%(1000000007);
				res=(res*a);
				n--;
			}else {
//				a=((a)%(1000000007) *(a)%(1000000007))%(1000000007);
				a=(a*a);
				n/=2;
			}
		}
		return (res);
		
	}

	public static long bn(long a,long n) {
		long res=1;
		while(n>0) {
			if(n%2!=0) {
				res=res*a;
				n--;
			}else {
				a*=a;
				n/=2;
			}
		}
		return res;
		
	}

	public static long[] fac=new long[100001];
	public static void find_factorial() {
		fac[0]=1;
		fac[1]=1;
		for(int i=2;i<=100000;i++) {
			fac[i]=(fac[i-1]*i)%(mod);
		}
	}
	
	static long mod=1000000007;
	public static long GCD(long a,long b) {
		if(b==(long)0) {
			return a;
		}
		return GCD(b , a%b);
	}
	static long c=0;
	
		
	
}