#CCBCHBON0000036. Break của switch ở trong for (Switch Break Inside a For Loop)

Break của switch ở trong for (Switch Break Inside a For Loop)

Switch Break Inside a For Loop

Source: Phước Hưng OJ

Version: Phuoc Hung OJ Extended

Problem Statement

Given n codes in {1,2,3}, add the code value for each of all n codes. A break in a case exits only the switch, never the enclosing for loop.

Input

First n (0<=n<=1000), then exactly n codes 1..3.

Output

Print the total after all n codes.

Subtasks

  • Subtask 1 (20%): 0≤n≤100\le n\le 10; 1≤xi≤31\le x_i\le3.

  • Subtask 2 (30%): 0≤n≤1000\le n\le 100; 1≤xi≤31\le x_i\le3.

  • Subtask 3 (50%): 0≤n≤10000\le n\le 1000; 1≤xi≤31\le x_i\le3.

Examples

Example 1

Input:

4
1 2 3 2

Output:

8

Explanation:

All codes contribute; a switch break does not stop the for loop. Result: 8.

Example 2

Input:

0

Output:

0

Explanation:

All codes contribute; a switch break does not stop the for loop. Result: 0.

Example 3

Input:

3
2 2 2

Output:

6

Explanation:

All codes contribute; a switch break does not stop the for loop. Result: 6.