public static void main ( String [ ] args ) {
  FastReader input = new FastReader ( ) ;
  PrintWriter out = new PrintWriter ( System . out ) ;
  int T = 1 ;
  while ( T -- > 0 ) {
    int l = input . nextInt ( ) ;
    Stack < Long > st = new Stack < > ( ) ;
    long ans = 0 ;
    long inf = ( long ) Math . pow ( 2 , 32 ) ;
    st . push ( 1L ) ;
    for ( int i = 0 ;
    i < l ;
    i ++ ) {
      String s = input . next ( ) ;
      if ( s . equals ( "for" ) ) {
        int n = input . nextInt ( ) ;
        long x = st . peek ( ) ;
        x = x * n ;
        st . push ( Math . min ( inf , x ) ) ;
      }
      else if ( s . equals ( "add" ) ) {
        ans += st . peek ( ) ;
      }
      else {
        st . pop ( ) ;
      }
    }
    if ( ans >= inf ) {
      out . println ( "OVERFLOW!!!" ) ;
    }
    else {
      out . println ( ans ) ;
    }
  }
  out . close ( ) ;
}

public static void main ( String [ ] args ) { FastReader input = new FastReader ( ) ; PrintWriter out = new PrintWriter ( System . out ) ; int T = 1 ; while ( T -- > 0 ) { int l = input . nextInt ( ) ; Stack < Long > st = new Stack < > ( ) ; long ans = 0 ; long inf = ( long ) Math . pow ( 2 , 32 ) ; st . push ( 1L ) ; for ( int i = 0 ; i < l ; i ++ ) { String s = input . next ( ) ; if ( s . equals ( " for " ) ) { int n = input . nextInt ( ) ; long x = st . peek ( ) ; x = x * n ; st . push ( Math . min ( inf , x ) ) ; } else if ( s . equals ( " add " ) ) { ans += st . peek ( ) ; } else { st . pop ( ) ; } } if ( ans >= inf ) { out . println ( " OVERFLOW ! ! ! " ) ; } else { out . println ( ans ) ; } } out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (update_expression (identifier)) right: (decimal_integer_literal))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal)))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))) alternative: (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))