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.*;
import java.util.*;
import java.math.*;
public class temp
{
    static Scanner s;;
    static class pair
    {
        int a,b;
        pair(int x, int y)
        {
            a=x;
            b=y;
        }
    }
    public static void main(String[] args) throws IOException
    {
        
        s = new Scanner(System.in);
        int n = s.nextInt();
        s.nextLine();
        Stack<Long> st = new Stack<>();
        long x = 1;
        //long val = 0;
        int flag = 0;
        long arr[] = new long[1000000];
        arr[0] = 1;
        int pos = 0;
        st.push(1l);
        long pow = (long)Math.pow(2, 32) -1;
        BigInteger val = new BigInteger("0");
        for (int i = 0; i < n; i++)
        {
            String temp = s.nextLine();
            String [] str = temp.split(" ");
            //println(Arrays.toString(str));
            
            if (str[0].equals("for"))
            {
                Long z = Long.parseLong(str[1]);
                x = x * z;
                x=Math.min(pow,x);
                st.push(x);
            }
            else if (str[0].equals("end"))
            {
                
                st.pop();
                x=st.peek();
            }
            else 
            {
                if (x < 0 || x >= pow)
                {
                    flag = 1;
                    break;
                }
                val = val.add(new BigInteger(Long.toString(x)));
                if (val.compareTo(new BigInteger(Long.toString(pow))) > 0)
                {
                    flag = 1;
                    break;
                }
            }
            //println(i+" "+val+" "+x);
            

        }
        if (flag == 0)
            println(val);
        else
            println("OVERFLOW!!!");
            
    }   
    
    
    
   /*

    ********if input in hashmap*********

    for (int i = 0; i < n; i++)
    {
        int x = s.nextInt();
        if (!hm.containsKey(x))
            hm.put(x, 1);
        else
            hm.put(x, hm.get(x) + 1);
    }

     */
 /*

    ********if input in 2darray*********

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            arr[i][j] = s.nextInt();
        }
    }

     */
 /*
    
    *********GCD**********

    private static int gcdThing(int a, int b)
    {
        return BigInteger.valueOf(a).gcd(BigInteger.valueOf(b)).intValue();
    }

     */
 /*

    ***********nCr**********

    static int nCr(int n, int k)
    {
        int ans = 1;
        if ( k > n - k )
            k = n - k;
        for (int i = 0; i < k; ++i)
        {
            ans *= (n - i);
            ans /= (i + 1);
        }
        return res;
    }

     */
 /*
    ******Method to check if x is power of 2********
    
    static boolean isPowerOfTwo (int x)
    {
        return x!=0 && ((x&(x-1)) == 0);
    }
     */
 /*
    *******generate all primes*******
    
    void sieveOfEratosthenes(int n)
    {
        // Create a boolean array "prime[0..n]" and initialize
        // all entries it as true. A value in prime[i] will
        // finally be false if i is Not a prime, else true.
        boolean prime[] = new boolean[n+1];
        for(int i=0;i<n;i++)
            prime[i] = true;

        for(int p = 2; p*p <=n; p++)
        {
            // If prime[p] is not changed, then it is a prime
            if(prime[p] == true)
            {
                // Update all multiples of p
                for(int i = p*2; i <= n; i += p)
                    prime[i] = false;
            }
        }

        // Print all prime numbers
        for(int i = 2; i <= n; i++)
        {
            if(prime[i] == true)
                System.out.print(i + " ");
        }
    }

     */

 /*
    *********permutaion program********

    static boolean shouldSwap(StringBuilder str, int start, int curr)
    {
        for (int i = start; i < curr; i++)
        {
            if (str.charAt(i) == str.charAt(curr))
            {
                return false;
            }
        }
        return true;
    }

    static void findPermutations(StringBuilder str, int index, int n, HashSet<Integer> hs)
    {
        if (index >= n)
        {
            int number = Integer.parseInt(str.toString(), 2);
            hs.add(number);
            return;
        }

        for (int i = index; i < n; i++)
        {

            boolean check = shouldSwap(str, index, i);
            if (check)
            {
                char temp = str.charAt(index);
                str.setCharAt(index, str.charAt(i));
                str.setCharAt(i, temp);
                findPermutations(str, index + 1, n, hs);
                temp = str.charAt(index);
                str.setCharAt(index, str.charAt(i));
                str.setCharAt(i, temp);
            }
        }
    }
     */
 /*
    ********** island program********

    public static int findisland(int[][]a,int n,int m)
    {
        int count = 0;
        int [][]visited = new int[n][m];
        for (int i = 0; i < n; i++)
        {
            for (int j = 0; j < m; j++)
            {
                if (visited[i][j] == 0 && a[i][j] == 1)
                {
                    count++;
                    island(a, n, m, i, j, visited);
                }
            }

        }
        return count;
    }
    static void island(int [][]a, int n, int m,int i, int j, int[][] visited)
    {
        if (i >= 0 && i < n && j >= 0 && j < m && visited[i][j] == 0 && a[i][j] == 1)
        {
            visited[i][j] = 1;
            for (int k = -1; k <= 1; k++)
            {
                for (int l = -1; l <= 1; l++)
                {
                    if (i+k >= 0 && i+k < n && j+l >= 0 && j+l < m )
                        island(a, n, m, i+k, j+l, visited);
                }
            }
        }
        else
            return;
    }

     */


    
    static void println(Object line) 
    {
        System.out.println(line);
    }
    static void print(Object line) 
    {
        System.out.print(line);
    }
   /* static Integer[] iarr(int n)
    {
        Integer arr[]=new Integer[n];
        for(int i = 0; i < n;i++)
            arr[i]=s.ni();
        return arr;
    }

    static Long[] larr(int n)
    {
        Long arr[]=new Long[n];
        for(int i = 0; i < n;i++)
            arr[i]=s.nl();
        return arr;
    }

    static Integer[][] i2arr(int n, int m)
    {
        Integer arr[][]=new Integer[n][m];
        for(int i = 0; i < n;i++)
            for(int j = 0; j < m;j++)
                arr[i][j]=s.ni();
        return arr;
    }

    static Long[][] l2arr(int n, int m)
    {
        Long arr[][]=new Long[n][m];
        for(int i = 0; i < n;i++)
            for(int j = 0; j < m;j++)
                arr[i][j]=s.nl();
        return arr;
    }
    static class Reader
    {

        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader()
        {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException
        {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException
        {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1)
            {
                if (c == '\n')
                {
                    break;
                }
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int ni() throws IOException
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
            {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg)
            {
                c = read();
            }
            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
            {
                return -ret;
            }
            return ret;
        }

        public long nl() throws IOException
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
            {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg)
            {
                c = read();
            }
            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
            {
                return -ret;
            }
            return ret;
        }

        public double nd() throws IOException
        {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
            {
                c = read();
            }
            boolean neg = (c == '-');
            if (neg)
            {
                c = read();
            }

            do
            {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (c == '.')
            {
                while ((c = read()) >= '0' && c <= '9')
                {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
            {
                return -ret;
            }
            return ret;
        }

        private void fillBuffer() throws IOException
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
            {
                buffer[0] = -1;
            }
        }

        private byte read() throws IOException
        {
            if (bufferPointer == bytesRead)
            {
                fillBuffer();
            }
            return buffer[bufferPointer++];
        }

        public void close() throws IOException
        {
            if (din == null)
            {
                return;
            }
            din.close();
        }
    }

    /*recommended*/
    static class FastReader
    {

        BufferedReader br;
        StringTokenizer st;

        public FastReader()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }
        public FastReader(String file_name) throws IOException
        {
            br = new BufferedReader(new FileReader(file_name));
        }
        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int ni()
        {
            return Integer.parseInt(next());
        }

        long nl()
        {
            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;
        }

    }
}
