#CCBCHBAHAI0000153. Tổng điểm học sinh (Students Marks Sum)

Tổng điểm học sinh (Students Marks Sum)

Students Marks Sum

Source: HackerRank

Version: Phuoc Hung OJ Extended

Problem Statement

You are given marks M=(m0,m1,…,mn−1)M=(m_0,m_1,\ldots,m_{n-1}) for nn students.

  • Even indices 0,2,4,…0,2,4,\ldots are boys' marks.
  • Odd indices 1,3,5,…1,3,5,\ldots are girls' marks.

A character gg selects the required group:

  • b: sum the marks at even indices;
  • g: sum the marks at odd indices.

Compute the requested sum.

Input

  • The first line contains an integer nn.
  • Each of the next nn lines contains one integer mim_i.
  • The final line contains b or g.

Output

Print one integer: the requested sum of marks.

Subtasks

Subtask 1 (100 points): 1≤n≤10001\le n\le1000; 1≤mi≤10001\le m_i\le1000; g∈{b,g}g\in\{\texttt{b},\texttt{g}\}.

Examples

Input

5
1
2
3
4
5
g

Output

6

Explanation

For g, we add odd-indexed elements: m1+m3=2+4=6m_1+m_3=2+4=6.