Codeforces Round 548 (Div. 2)
A
Even Substrings
Codeforces
800
原题
←B →
翻译中…

You are given a string $s=s_1s_2\dots s_n$ of length $n$, which only contains digits $1$, $2$, ..., $9$.

翻译中…

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

翻译中…

Find the number of even substrings of $s$. Note, that even if some substrings are equal as strings, but have different $l$ and $r$, they are counted as different substrings.

翻译中…

Input

翻译中…

The first line contains an integer $n$ ($1 \le n \le 65000$) — the length of the string $s$.

翻译中…

The second line contains a string $s$ of length $n$. The string $s$ consists only of digits $1$, $2$, ..., $9$.

翻译中…

Output

翻译中…

Print the number of even substrings of $s$.

翻译中…

Note

翻译中…

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

翻译中…
  • $s[1 \dots 2]$
  • $s[2 \dots 2]$
  • $s[1 \dots 4]$
  • $s[2 \dots 4]$
  • $s[3 \dots 4]$
  • $s[4 \dots 4]$
翻译中…

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

翻译中…

样例

Input #1
4
1234
Output #1
6
InputCopy OutputCopy
Input #2
4
2244
Output #2
10
InputCopy OutputCopy
题目信息
题号
1139A
时间限制
0.5 s
内存限制
256 MB
标签
模拟
字符串

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。