public static void main ( String [ ] args ) {
  Scanner inter = new Scanner ( System . in ) ;
  long n = inter . nextInt ( ) ;
  int reminder = ( int ) ( n % 4 ) ;
  int result = 0 ;
  switch ( reminder ) {
    case 0 : {
      result = 6 ;
      break ;
    }
    case 1 : {
      result = 8 ;
      break ;
    }
    case 2 : {
      result = 4 ;
      break ;
    }
    case 3 : {
      result = 2 ;
      break ;
    }
  }
  if ( n != 0 ) System . out . println ( result ) ;
  else System . out . println ( 1 ) ;
}

public static void main ( String [ ] args ) { Scanner inter = new Scanner ( System . in ) ; long n = inter . nextInt ( ) ; int reminder = ( int ) ( n % 4 ) ; int result = 0 ; switch ( reminder ) { case 0 : { result = 6 ; break ; } case 1 : { result = 8 ; break ; } case 2 : { result = 4 ; break ; } case 3 : { result = 2 ; break ; } } if ( n != 0 ) System . out . println ( result ) ; else System . out . println ( 1 ) ; }
(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 (field_access object: (identifier) field: (identifier)))))) (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: (cast_expression type: (integral_type) value: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (switch_expression condition: (parenthesized_expression (identifier)) body: (switch_block (switch_block_statement_group (switch_label (decimal_integer_literal)) (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (break_statement))) (switch_block_statement_group (switch_label (decimal_integer_literal)) (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (break_statement))) (switch_block_statement_group (switch_label (decimal_integer_literal)) (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (break_statement))) (switch_block_statement_group (switch_label (decimal_integer_literal)) (block (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (break_statement))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier)))) alternative: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (decimal_integer_literal)))))))