CF1139A.Even Substrings

传统题 时间 2000 ms 内存 256 MiB 3 尝试 1 已通过 1 标签

Even Substrings

You are given a string s=s1s2sns=s_1s_2\dots s_n of length nn, which only contains digits 11, 22, ..., 99.

A substring s[lr]s[l \dots r] of ss is a string slsl+1sl+2srs_l s_{l + 1} s_{l + 2} \ldots s_r. A substring s[lr]s[l \dots r] of ss is called even if the number represented by it is even.

Find the number of even substrings of ss. Note, that even if some substrings are equal as strings, but have different ll and rr, they are counted as different substrings.

Input

The first line contains an integer nn (1n650001 \le n \le 65000) — the length of the string ss.

The second line contains a string ss of length nn. The string ss consists only of digits 11, 22, ..., 99.

Output

Print the number of even substrings of ss.

Note

In the first example, the [l,r][l, r] pairs corresponding to even substrings are:

  • s[12]s[1 \dots 2]
  • s[22]s[2 \dots 2]
  • s[14]s[1 \dots 4]
  • s[24]s[2 \dots 4]
  • s[34]s[3 \dots 4]
  • s[44]s[4 \dots 4]

In the second example, all 1010 substrings of ss are even substrings. Note, that while substrings s[11]s[1 \dots 1] and s[22]s[2 \dots 2] both define the substring "2", they are still counted as different substrings.

Samples

4
1234
6
4
2244
10

在线编程 IDE

建议全屏模式获得最佳体验