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$.


-----Examples-----
Input
4
1234

Output
6
Input
4
2244

Output
10


-----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.

Difficulty: EASY
Tags: String algorithms

Implementation

Starter code:

Solutions:
def get_possible_combinations(n):
	(a, d) = (1, 1)
	return int(n / 2 * (2 * a + (n - 1) * d))

def main():
	input()
	n = input()
	tot = get_possible_combinations(len(n))
	exc = 0
	for i in range(0, len(n)):
		if int(n[i]) % 2 != 0:
			exc += i + 1
	print(tot - exc)
main()


n = input()
s = input()
ans = 0
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		ans = ans + (i + 1)
print(ans)


from sys import stdin
from sys import stdout
n = int(stdin.readline())
s = stdin.readline()
res = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		res += i + 1
print(res)


n = int(input())
s = input()
posn = []
for i in range(n):
	if int(s[i]) % 2 == 0:
		posn.append(i)
count = 0
for i in range(len(posn)):
	count += posn[i] + 1
print(count)


import sys
import math
from collections import defaultdict, deque
input = sys.stdin.readline

def inar():
	return [int(el) for el in input().split()]

def main():
	n = int(input())
	st = input().strip()
	ans = 0
	for i in range(n):
		if int(st[i]) % 2 == 0:
			ans += i + 1
	print(ans)
main()


N = int(input())
s = input()
cnt = 0
for i in range(N):
	if int(s[i]) % 2 == 0:
		cnt += i + 1
print(cnt)


import math
n = int(input().lstrip())
s = input().lstrip()
res = 0
for (i, c) in enumerate(s):
	if int(c) % 2 == 0:
		res += i + 1
print(res)


def isEven(num):
	if num % 2 == 0:
		return True
	else:
		return False
strLength = int(input())
string = input()
countEven = 0
for i in range(strLength):
	intStr = int(string[i])
	if isEven(intStr):
		countEven = countEven + i + 1
print(countEven)


n = int(input())
s = input()
c = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		c = c + (i + 1)
print(c)


n = int(input())
a = input()
ans = 0
for i in range(n):
	if int(a[i]) % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
a = str(input())
count = 0
for i in range(0, len(a)):
	if int(a[i]) % 2 == 0:
		count += i + 1
print(count)


n = int(input())
s = input()
sint = []
num = 0
for i in range(n):
	sint.append(int(s[i]))
for l in range(n):
	if sint[l] % 2 == 0:
		num += l + 1
print(num)


input()
num = input()
number_of_evens = 0
for i in range(len(num)):
	if int(num[i]) % 2 == 0:
		number_of_evens += i + 1
print(number_of_evens)


n = int(input())
s = input()
st = set(['0', '2', '4', '6', '8'])
result = 0
j = 1
for i in s:
	result += j if i in st else 0
	j += 1
print(result)


input()
s = input()
ans = sum(map(lambda x: x[0] + 1 if int(x[1]) % 2 == 0 else 0, enumerate(s)))
print(ans)


class Main:

	def __init__(self):
		pass

	@staticmethod
	def get_even_substring(s_length, string):
		even_number_index = {index + 1 for (index, digit) in enumerate(string) if int(digit) % 2 == 0}
		return sum(even_number_index)
n = input()
s = input()
print(Main.get_even_substring(n, s))


n = int(input())
s = str(input())
d = 0
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		d += i + 1
print(d)


n = int(input())
s = list(input())
tot = 0
for x in range(len(s)):
	if int(s[x]) % 2 == 0:
		tot += 1 + x
print(tot)


n = int(input())
s = input()
suma = int(0)
for i in range(0, n):
	k = int(s[i])
	if k % 2 == 0:
		suma += i + 1
print(suma)


n = int(input())
a = str(input())
s = 0
for i in range(n):
	if a[i] == '2' or a[i] == '4' or a[i] == '6' or (a[i] == '8'):
		s = s + i + 1
print(s)


import sys
sys.setrecursionlimit(10 ** 5 + 1)
inf = int(10 ** 20)
max_val = inf
min_val = -inf
RW = lambda : sys.stdin.readline().strip()
RI = lambda : int(RW())
RMI = lambda : [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda : [x for x in sys.stdin.readline().strip().split()]
lens = RI()
numb = RW()
count = 0
for (i, v) in enumerate(numb):
	if int(v) % 2 == 0:
		count += i + 1
print(count)


n = int(input())
s = input()
q = 0
z = ['2', '4', '0', '6', '8']
for i in range(n):
	if s[i] in z:
		q += i + 1
print(q)


def even(mystr):
	if mystr is None:
		return None
	eve_cnt = 0
	for i in range(len(mystr)):
		if int(mystr[i]) % 2 == 0:
			eve_cnt += i + 1
	return eve_cnt
n = int(input())
mystr = str(input())
print(even(mystr))


n = int(input())
s = input().strip()
count = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		count += i + 1
print(count)


m = int(input())
s = input()
res = 0
for i in range(0, len(s)):
	if int(s[i]) % 2 == 0:
		res += i + 1
print(res)


n = int(input())
s = input()
t = 0
for i in range(n - 1, 0, -1):
	if int(s[i]) % 2 == 0:
		t += i + 1
if int(s[0]) % 2 == 0:
	print(t + 1)
else:
	print(t)


from collections import deque, defaultdict

def prefix_sum(a):
	res = 0
	s = []
	for i in a:
		res = res + i
		s.append(res)
	return s

def bfs(g, v, s):
	q = deque()
	q.append(s)
	while q:
		vertex = q.popleft()
		for i in g[vertex]:
			if v[i] == False:
				print(i)
				q.append(i)
				v[i] = True
	print(g, v, s)
t = int(input())
p = list(input())
s = [0] * t
count = 0
for i in range(t):
	if int(p[i]) % 2 == 0:
		count = count + i + 1
print(count)


q = lambda : map(int, input().split())
qi = lambda : int(input())
qs = lambda : input().split()
n = qi()
a = input()
print(sum((i + 1 for i in range(n) if int(a[i:i + 1]) % 2 == 0)))


input()
print(sum((i * (d in '2468') for (i, d) in enumerate(input(), 1))))


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from sys import maxsize
from operator import *
from itertools import *
from collections import Counter
import math

def bin1(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = k ** mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin1(mid + 1, r, k, t, b, val, ans)
		else:
			return bin1(l, mid - 1, k, t, b, val, ans)

def bin2(l, r, k, t, b, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		v = t * k ** mid + b * mid
		if v == val:
			return v
		elif v > val:
			ans = mid
			return bin2(l, mid - 1, k, t, b, val, ans)
		else:
			return bin2(mid + 1, r, k, t, b, val, ans)

def SieveOfEratosthenes(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	l = []
	for i in range(2, n + 1):
		if prime[i]:
			l.append(i)
	return l

def bin(l, r, ll, val):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		if val >= ll[mid][0] and val <= ll[mid][1]:
			return mid
		elif val < ll[mid][0]:
			return bin(l, mid - 1, ll, val)
		else:
			return bin(mid + 1, r, ll, val)

def deci(n):
	s = ''
	while n != 0:
		if n % 2 == 0:
			n = n // 2
			s = '0' + s
		else:
			n = n // 2
			s = '1' + s
	return s

def diff(s1, s2):
	if len(s1) < len(s2):
		v = len(s1)
		while v != len(s2):
			s1 = '0' + s1
			v = v + 1
	else:
		v = len(s2)
		while v != len(s1):
			s2 = '0' + s2
			v = v + 1
	c = 0
	for i in range(len(s1)):
		if s1[i:i + 1] != s2[i:i + 1]:
			c = c + 1
	return c
from sys import stdin, stdout

def fac(a, b):
	v = a
	while a != b:
		v *= a - 1
		a = a - 1
	return v

def bino(l, r, n):
	if l > r:
		return -1
	else:
		mid = (l + r) // 2
		val1 = math.log(n / mid + 1, 2)
		val2 = int(val1)
		if val1 == val2:
			return val1
		elif val1 < 1.0:
			return bino(l, mid - 1, n)
		else:
			return bino(mid + 1, r, n)

def binary(l, r, ll, val, ans):
	if l > r:
		return ans
	else:
		mid = (l + r) // 2
		if ll[mid] == val:
			return ll[mid]
		elif ll[mid] < val:
			ans = ll[mid]
			return binary(mid + 1, r, ll, val, ans)
		else:
			return binary(l, mid - 1, ll, val, ans)

def check(n):
	v = 1
	while n != 0:
		if n % 10 == 0 or n % 10 == 1:
			n = n // 10
		else:
			v = 0
			break
	return v
n = int(input())
s = str(input())
c = 0
for i in range(n):
	if int(s[i:i + 1]) % 2 == 0:
		c += i + 1
print(c)


n = int(input())
a = list(map(int, list(input())))
result = 0
for i in range(n):
	if a[i] % 2 == 0:
		result += i + 1
print(result)


n = int(input())
s = str(input())
counter = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		counter += i + 1
print(counter)


n = int(input())
s = input()
total = 0
for (i, ch) in enumerate(s):
	if ch in '02468':
		total += i + 1
print(total)


import sys
input = sys.stdin.readline
I = lambda : list(map(int, input().split()))
(n,) = I()
s = input().strip()
an = 0
for i in range(n):
	if not int(s[i]) % 2:
		an += i + 1
print(an)


total = 0
n = int(input())
num = input()
for i in range(n):
	if int(num[i]) % 2 == 0:
		total += i + 1
print(total)


n = int(input())
s = input()
ans = 0
for t in range(n):
	if int(s[t]) % 2 == 0:
		ans += t + 1
print(ans)


def solve(s, n):
	res = 0
	for i in range(len(s)):
		if int(s[i]) % 2 == 0:
			res += i + 1
	return res
n = int(input())
string = input()
print(solve(string, n))


import itertools
import math
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce
sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7
n = int(input())
s = input()
ans = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		ans += i + 1
print(ans)


str_len = int(input())
str_input = input()
good_comb = 0
for i in range(len(str_input)):
	if int(str_input[i]) % 2 == 0:
		good_comb += i + 1
print(good_comb)


n = int(input())
s = input()
res = 0
for i in range(1, n + 1):
	if s[-i] in ['2', '4', '6', '8']:
		res += len(s[:-i]) + 1
print(res)


t = int(input())
s = str(input())
sum = 0
count = 0
for i in range(0, len(s), 1):
	if int(s[i]) % 2 == 0:
		sum += i
		count += 1
print(sum + count)


l = input()
n = input()
k = 0
for (i, v) in enumerate(n):
	k += (int(v) + 1) % 2 * (i + 1)
print(k)


n = int(input())
l = list(input())
c = 0
for i in range(n):
	if int(l[i]) % 2 == 0:
		c += i + 1
print(c)


import math
import bisect

def argsort(ls):
	return sorted(range(len(ls)), key=ls.__getitem__)

def f(p=0):
	if p == 0:
		return int(input())
	if p == 1:
		return map(int, input().split())
	elif p == 2:
		return list(map(int, input().split()))
	else:
		return sorted(list(map(int, input().split())))
n = f()
s = input()
sm = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		sm += i + 1
print(sm)


n = int(input())
s = input()
c = []
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		c.append(i)
print(sum(c) + len(c))


n = int(input())
s = [int(i) for i in input()]
e = [0, 2, 4, 6, 8]
ans = 0
for i in range(n):
	if s[i] in e:
		ans += i + 1
print(ans)


en = list('02468')
n = int(input())
s = input()
ans = 0
for i in range(n):
	if s[i] in en:
		ans += i + 1
print(ans)


s = int(input())
x = input()
f = 0
for i in range(s):
	if int(x[i]) % 2 == 0:
		f += i + 1
print(f)


from sys import stdin, stdout, exit as sys_ret
(f_input, f_print, f_flush) = (stdin.readline, stdout.write, stdout.flush)
(amount, string) = (int(f_input()), f_input())
count = 0
for i in range(amount):
	if int(string[i]) % 2 == 0:
		count += i + 1
f_print(str(count))


n = int(input())
a = list(input())
s = 0
for i in range(n):
	if int(a[i]) % 2 == 0:
		s = s + i + 1
print(s)


n = int(input())
l = list(input())
c = 0
for i in range(len(l)):
	if l[i] == '2' or l[i] == '4' or l[i] == '6' or (l[i] == '8'):
		c += i + 1
print(c)


l = int(input())
s = input()
count = 0
for i in range(l - 1, -1, -1):
	c = s[i]
	if int(c) % 2 == 0:
		count += i + 1
print(count)


input()
S = list(map(int, list(input())))
an = 0
for i in range(len(S)):
	if S[i] % 2 == 0:
		an += i + 1
print(an)


import math
import bisect
import itertools
import sys
I = lambda : sys.stdin.readline()
mod = 10 ** 9 + 7

def modu(a, m):
	if a % m:
		return a % m
	return m

def mindiff(a):
	b = a[:]
	b.sort()
	m = 10000000000
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] < m:
			m = b[i + 1] - b[i]
	return m

def lcm(a, b):
	return a * b // math.gcd(a, b)

def merge(a, b):
	i = 0
	j = 0
	c = 0
	ans = []
	while i < len(a) and j < len(b):
		if a[i] < b[j]:
			ans.append(a[i])
			i += 1
		else:
			ans.append(b[j])
			c += len(a) - i
			j += 1
	ans += a[i:]
	ans += b[j:]
	return (ans, c)

def mergesort(a):
	if len(a) == 1:
		return (a, 0)
	mid = len(a) // 2
	(left, left_inversion) = mergesort(a[:mid])
	(right, right_inversion) = mergesort(a[mid:])
	(m, c) = merge(left, right)
	c += left_inversion + right_inversion
	return (m, c)

def is_prime(num):
	if num == 1:
		return False
	if num == 2:
		return True
	if num == 3:
		return True
	if num % 2 == 0:
		return False
	if num % 3 == 0:
		return False
	t = 5
	a = 2
	while t <= int(math.sqrt(num)):
		if num % t == 0:
			return False
		t += a
		a = 6 - a
	return True

def ceil(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def ncr1(n, r):
	s = 1
	for i in range(min(n - r, r)):
		s *= n - i
		s %= mod
		s *= pow(i + 1, mod - 2, mod)
		s %= mod
	return s
n = int(input())
s = input()
ans = 0
for i in range(n):
	if s[i] in ['2', '4', '6', '8']:
		ans += i + 1
print(ans)


k = input()
k = int(k)
l = input()
ans = 0
for index in range(len(l)):
	if int(l[index]) % 2 == 0:
		ans = ans + (int(index) + 1)
print(ans)


from math import gcd, factorial
n = int(input())
z = input()
c = 0
j = 0
for i in z:
	if int(i) % 2 == 0:
		c += 1 + j
	j += 1
print(c)


(_, s, ans) = (input(), input(), 0)
for (i, j) in enumerate(s):
	if int(j) % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
p = list(input())
c = 0
for i in range(len(p)):
	if int(p[i]) % 2 == 0:
		c += i + 1
print(c)


import math
n = int(input())
s = input()
e = []
ans = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		ans = ans + i + 1
print(ans)


n = int(input())
s = input()
answer = 0
for (i, subs) in enumerate(s):
	if int(subs) % 2 == 0:
		answer += 1 + i
print(answer)


length = int(input())
num = input()
count = 0
ind = 0
for n in num:
	if int(n) % 2 == 0:
		count += ind + 1
	ind += 1
print(count)


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
DIRECTIONS = [[0, 1], [0, -1], [1, 0], [1, -1]]
NEIGHBOURS = [(i, j) for i in range(-1, 2) for j in range(-1, 2) if i != 0 or j != 0]
OrdUnicode_a = ord('a')
OrdUnicode_A = ord('A')
CAPS_ALPHABETS = {chr(i + OrdUnicode_A): i for i in range(26)}
SMOL_ALPHABETS = {chr(i + OrdUnicode_a): i for i in range(26)}
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0) + 1
INFINITY = float('inf')
n = int(input())
s = input()
ans = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		ans += i + 1
print(ans)


from sys import stdin, stdout

def main():
	stdin.readline()
	number = stdin.readline().rstrip()
	count = 0
	for (i, char) in enumerate(number):
		if int(char) % 2 == 0:
			count += i + 1
	print(count)
main()


def parser():
	while 1:
		data = list(input().split(' '))
		for number in data:
			if len(number) > 0:
				yield number
input_parser = parser()

def get_word():
	global input_parser
	return next(input_parser)

def get_number():
	data = get_word()
	try:
		return int(data)
	except ValueError:
		return float(data)

def calc(pa, pb, a, b):
	p = max(pa, pb)
	n = min(a, b)
	if pa == pb and n - p > 0:
		return n - p
	elif not pa == pb and n - p >= 0:
		return 1 + n - p
	else:
		return 0
n = get_number()
s = get_word()
res = 0
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		res += i + 1
print(res)


def sol(line):
	length = len(line)
	cnt = 0
	for i in range(0, length):
		if line[i] % 2 == 0:
			cnt += i + 1
	return cnt
n = int(input())
l = list(input())
l2 = [int(i) for i in l]
print(sol(l2))


import sys
input = sys.stdin.readline
from collections import *
n = int(input())
a = input().split()[0]
ans = 0
for i in range(n):
	if int(a[i]) & 1 != 1:
		ans += i + 1
print(ans)


n = int(input())
s = input()
c = 0
for (j, i) in enumerate(s):
	if int(i) & 1 == 0:
		c += j + 1
print(c)


n = int(input())
l = [int(x) % 2 for x in input()]
res = 0
for i in range(n):
	if not l[i]:
		res += i + 1
print(res)


(quant, palavra) = (int(input()), input())
contador = 0
for q in range(len(palavra)):
	if int(palavra[q]) % 2 == 0:
		contador += q + 1
print(contador)


a = int(input())
x = input()
s = 0
for i in range(a):
	if int(x[i]) != 0 and int(x[i]) % 2 == 0:
		s = s + i + 1
print(s)


n = int(input())
numbers = []
input_numbers = input()
for i in range(n):
	numbers.append(int(input_numbers[i]))
total_count = 0
for i in range(n):
	if numbers[i] % 2 == 0:
		total_count += i + 1
print(total_count)


(n, a) = (int(input()), input())
print(sum((i + 1 if not int(a[i]) & 1 else 0 for i in range(n))))


l = input()
n = input()
c = 0
for j in range(1, len(n) + 1):
	if int(n[j - 1]) % 2 == 0:
		c += 1 * int(j)
print(c)


n = int(input())
s = input()
result = 0
for (i, ch) in enumerate(s):
	if int(ch) % 2 == 0:
		result += i + 1
print(result)


n = input()
n = int(n)
s = input()
y = 0
for i in range(n):
	x = int(s[i])
	if x % 2 == 0:
		y += i + 1
print(y)


n = input()
a = input()
total = 0
sum = 0
for i in a:
	if int(i) % 2 is 0:
		sum = sum + total + 1
	total = total + 1
print(sum)


input()
S = input()
Sum = 0
for i in range(len(S)):
	Sum += i + 1 if int(S[i]) % 2 == 0 else 0
print(Sum)


n = int(input())
s = input()
i = 1
sum = 0
for k in s:
	if int(k) % 2 == 0:
		sum += i
	i = i + 1
print(sum)


n = int(input())
s = [int(a) for a in list(input())]
ch = [2, 4, 6, 8]
c = 0
for i in range(n):
	if s[i] in ch:
		c += i + 1
print(c)


n = int(input())
string = input()
count = 0
for num in range(n):
	if int(string[num]) % 2 == 0:
		count += num + 1
print(count)


n = int(input())
s = list(map(int, input()))
count = 0
for i in range(n):
	if s[i] % 2 == 0:
		count = count + i + 1
print(count)


t = int(input())
l = input()
l1 = []
count = 0
for i in range(t):
	if int(l[i]) % 2 == 0:
		count = count + i
		l1.append(l[i])
print(count + len(l1))


n = int(input())
s = input()
l = []
for i in range(n):
	if int(s[i]) % 2 == 0:
		l.append(i + 1)
print(sum(l))


import math
import string
import re
import math
import random
from decimal import Decimal, getcontext

def ria():
	return [int(i) for i in input().split()]
n = ria()[0]
st = input()
rs = 0
for i in range(n):
	if int(st[i]) % 2 == 0:
		rs += i + 1
print(rs)


def iseven(x):
	return x in '2468'
n = int(input())
s = input()
output = 0
for i in range(n):
	if iseven(s[i]):
		output += i + 1
print(output)


n = int(input())
str1 = input()
sum = 0
for i in range(n):
	if eval(str1[i]) % 2 == 0:
		sum = sum + int(i) + 1
print(sum)


n = input()
c = input()
counter = 0
for i in range(len(c)):
	if c[i] == '0' or c[i] == '2' or c[i] == '4' or (c[i] == '6') or (c[i] == '8'):
		counter += i + 1
print(counter)


import sys
lines = sys.stdin.readlines()
n = int(lines[0])
s = lines[1].strip()
ans = 0
for (idx, val) in enumerate(s):
	if int(val) % 2 == 0:
		ans += idx + 1
print(ans)


def solve(l):
	l = [int(x) for x in list(l)]
	total = 0
	for i in range(len(l)):
		if l[i] % 2 == 0:
			total += i + 1
	print(total)

def main():
	n = int(input())
	solve(input())
main()


i = int(input())
s = input()
sum = 0
for j in range(0, i):
	if int(s[j]) % 2 == 0:
		sum = sum + j + 1
print(sum)


n = int(input())
c = []
k = 0
for (i, v) in enumerate(list(input())):
	if int(v) % 2 == 0:
		k += i + 1
print(k)


def main():
	input()
	s = 'S' + input()
	evens = '02468'
	result = 0
	for i in range(1, len(s)):
		if s[i] in evens:
			result += i
	print(result)
main()


t = int(input())
m = input()
ans = 0
for i in range(t):
	if int(m[i]) % 2 == 0:
		ans += i + 1
print(ans)


from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush, heappop
import math
from collections import *
from functools import reduce, cmp_to_key, lru_cache
import io, os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
M = mod = 10 ** 9 + 7

def factors(n):
	return sorted(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def inv_mod(n):
	return pow(n, mod - 2, mod)

def li():
	return [int(i) for i in input().rstrip().split()]

def st():
	return str(input().rstrip())[2:-1]

def val():
	return int(input().rstrip())

def li2():
	return [str(i)[2:-1] for i in input().rstrip().split()]

def li3():
	return [int(i) for i in st()]
n = val()
l = li3()
ans = 0
for i in range(n):
	if l[i] & 1 == 0:
		ans += i + 1
print(ans)


n = int(input())
l = input()
count = 0
for i in range(n):
	temp = int(l[i])
	if temp % 2 == 0:
		count += i + 1
print(count)


N = int(input())
S = input()
n_even = 0
for (i, c) in enumerate(S):
	if int(c) % 2 == 0:
		n_even += i + 1
print(n_even)


input()
s = input()
r = 0
for i in range(len(s)):
	if not int(s[i]) & 1:
		r += i + 1
print(r)


import sys
inpt = sys.stdin.read().split('\n')
n = int(inpt[0])
if n == 0:
	print(0)
s = inpt[1]
ans = 0
for i in range(0, len(s)):
	if int(s[i]) % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
s = str(input())
l = list(s)
count = 0
for i in range(n - 1, -1, -1):
	if int(l[i]) % 2 == 0:
		count += i + 1
print(count)


n = int(input())
l = list(map(int, input()))
ans = 0
for i in range(n):
	if l[i] % 2 == 0:
		ans += i + 1
print(ans)


import math
n = int(input())
s = input()
arr = [int(x) for x in s]
count = 0
for i in range(n):
	if arr[i] % 2 == 0:
		count = count + i + 1
print(count)


u = 0
n = int(input())
a = input()
i = len(a)
for i in range(i):
	num = int(a[i])
	if num % 2 == 0:
		u += i + 1
	i -= 1
print(u)


n = int(input())
s = input()
sub = n * (n + 1) // 2
c = 0
for (i, l) in enumerate(s):
	if int(l) % 2 != 0:
		c += i + 1
print(sub - c)


import random

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
n = ii()
s = input()
ans = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
nums = list(map(int, input()))
ans = 0
for (idx, ele) in enumerate(nums):
	if ele % 2 == 0:
		ans += idx + 1
print(ans)


import sys
length = sys.stdin.readline()
number = sys.stdin.readline()
counter = 0
for (index, elem) in enumerate(number.strip()):
	if int(elem) % 2 == 0:
		counter += index + 1
print(counter)


n = int(input())
s = input()
ans = 0
now = 0
for i in s:
	if int(i) % 2 == 0:
		ans += now + 1
	now += 1
print(ans)


import math
import sys
import re
n = int(input())
s = input()
l = 0
for x in range(n):
	if int(s[x]) % 2 == 0:
		l = l + x + 1
print(l)


n = int(input())
s = input()
c = 0
i = 1
for d in s:
	if d == '0' or d == '2' or d == '4' or (d == '6') or (d == '8'):
		c += i
	i += 1
print(c)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	s = S()
	ans = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			ans += i + 1
	return ans
print(main())


n = int(input(''))
x = input('')
t = 0
for i in range(len(x)):
	if int(x[i]) % 2 == 0:
		t += i + 1
print(t)


n = int(input())
s = input()
ans = 0
for i in reversed(range(n)):
	if int(s[i]) & 1 == 0:
		ans += i + 1
print(ans)


number = int(input())
first = input()
count = 0
for i in range(number):
	if int(first[i]) % 2 == 0:
		count += i + 1
print(count)


import collections, atexit, math, sys, bisect
sys.setrecursionlimit(1000000)
isdebug = False
try:
	import pylint
	import numpy

	def dprint(*args, **kwargs):
		print(*args, file=sys.stderr)
	dprint('debug mode')
	isdebug = True
except Exception:

	def dprint(*args, **kwargs):
		pass

def red_inout():
	inId = 0
	outId = 0
	if not isdebug:
		inId = 0
		outId = 0
	if inId > 0:
		dprint('use input', inId)
		try:
			f = open('input' + str(inId) + '.txt', 'r')
			sys.stdin = f
		except Exception:
			dprint('invalid input file')
	if outId > 0:
		dprint('use output', outId)
		try:
			f = open('stdout' + str(outId) + '.txt', 'w')
			sys.stdout = f
		except Exception:
			dprint('invalid output file')
		atexit.register(lambda : sys.stdout.close())
if isdebug and len(sys.argv) == 1:
	red_inout()

def getIntList():
	return list(map(int, input().split()))

def solve():
	pass
T_ = 1
for iii_ in range(T_):
	(N,) = getIntList()
	s = input()
	r = 0
	for i in range(N):
		if ord(s[i]) % 2 == 0:
			r += i + 1
	print(r)


n = int(input())
s = map(int, list(input()))
ans = 0
for (i, it) in enumerate(s):
	if it % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
ans = 0
str = input()
for i in range(n):
	if not int(str[i]) % 2:
		ans += int(i) + 1
print(ans)


input()
l = list(input())
print(sum((i + 1 for i in range(len(l)) if int(l[i]) % 2 == 0)))


def ok(str1):
	ans = 0
	for i in range(len(str1)):
		if int(str1[i]) % 2 == 0:
			ans += i + 1
	return ans
n = int(input())
str1 = input()
print(ok(str1))


n = int(input())
a = [int(x) for x in input()]
suma = 0
for i in range(n):
	if a[i] % 2 != 0:
		suma = suma + (i + 1)
print(int(n * (n + 1) / 2 - suma))


input()
s = input()
evens = 0
for (i, n) in enumerate(s):
	if int(n) % 2 == 0:
		evens += i + 1
print(evens)


len_n = int(input())
n = input()
counter = 0
for i in range(len_n):
	if int(n[i]) % 2 == 0:
		counter += i + 1
print(counter)


n = int(input())
a = [int(x) for x in input()]
s = 0
for i in enumerate(a):
	if i[1] % 2 == 0:
		s += i[0] + 1
print(s)


size = int(input())
string = list(str(input()))
temp = 0
for iter in range(size):
	if int(string[iter]) % 2 == 0:
		temp = temp + iter + 1
print(temp)


a = int(input())
s = input()
rez = 0
for i in range(a):
	if int(s[i]) % 2 == 0:
		rez += i + 1
print(rez)


class Solution:

	def getAllSubstrings(self, string):
		n = len(string)
		results = []
		for currLength in range(1, n + 1):
			for i in range(0, n - currLength + 1):
				j = i + currLength
				number = 0
				for k in range(i, j):
					number = number * 10 + int(string[k])
				results.append(number)
		return results

	def solve(self, string):
		n = len(string)
		answer = 0
		for i in range(n):
			num = int(string[i])
			if num % 2 == 0:
				answer += i + 1
		return answer
sol = Solution()
t = int(input().strip())
string = input().strip()
print(sol.solve(string))


input()
s = input()
tot = 0
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		tot += 1 + i
print(tot)


import io, sys, atexit, os
import math as ma
from sys import exit
from decimal import Decimal as dec
from itertools import permutations

def li():
	return list(map(int, input().split()))

def num():
	return map(int, input().split())

def nu():
	return int(input())

def find_gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mm = 1000000007

def solve():
	t = 1
	for it in range(t):
		n = nu()
		a = input()
		cc = 0
		for i in range(n):
			if int(a[i]) % 2 == 0:
				cc += i + 1
		print(cc)
solve()


n = int(input())
st = input()
ans = 0
for i in range(len(st)):
	num = int(st[i])
	if not num & 1:
		ans += i + 1
print(ans)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI():
	return [tuple(map(int, l.split())) for l in sys.stdin]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	s = S()
	r = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			r += i + 1
	return r
print(main())


n = int(input())
b = input()
l = 0
for i in range(0, n):
	if int(b[i]) % 2 == 0:
		l += i + 1
print(l)


a = int(input())
p = 0
t = input()
for k in range(a):
	if int(t[k]) % 2 == 0:
		p += k + 1
print(p)


import os
import sys
import math
import collections
import cmath

def mp():
	return map(int, input().split())

def inp():
	return input()
n = int(inp())
s = inp()
count = 0
ar = list(s)
for i in range(n):
	if int(ar[i]) % 2 == 0:
		count += i + 1
print(count)


n = int(input())
s = input()
count = 0
for i in range(n):
	if int(s[i]) % 2 == 1:
		pass
	else:
		count += i + 1
print(count)


n = int(input())
s = [int(i) for i in input()]
count = 0
for i in range(n):
	if s[i] % 2 == 0:
		count += 1
co = 0
res = 0
for i in range(n):
	if s[i] % 2 == 0:
		co += 1
		res += 1 + (count - co)
	else:
		res += count - co
print(res)


n = input()
n = int(n)
s = input()
sum = 0
for i in range(n):
	p = int(s[i])
	if p % 2 == 0:
		sum += i + 1
print(sum)


def main():
	n = int(input())
	st = input()
	at = 0
	for i in range(n - 1, -1, -1):
		if int(st[i]) % 2 == 0:
			at = at + i + 1
	print(at)
main()


b = 0
n = int(input())
stin = input()
i = len(stin)
for i in range(i):
	nu = int(stin[i])
	if nu % 2 == 0:
		b += i + 1
	i -= 1
print(b)


l = int(input())
s = input()
total = 0
for i in range(1, l + 1):
	if not int(s[i - 1]) & 1:
		total += i
print(total)


def solve():
	n = int(input())
	stri = input()
	ans = 0
	for i in range(n):
		if int(stri[i]) % 2 == 0:
			ans += i + 1
	print(ans)
solve()


import sys
import math
import bisect

def main():
	n = int(input())
	A = list(map(int, list(input())))
	ans = 0
	for i in range(n):
		if A[i] % 2 == 0:
			ans += i + 1
	print(ans)
main()


a = int(input())
s = str(input())
count = 0
for i in range(0, a, 1):
	temp = ord(s[i]) - ord('0')
	if temp % 2 == 0:
		count += i + 1
print(count)


n = int(input())
nums = [int(x) for x in str(input())]
answer = 0
for i in range(n):
	if nums[i] % 2 == 0:
		answer += i + 1
print(answer)


n = int(input())
s = input()
index = 1
sum = 0
for si in s:
	if int(si) % 2 == 0:
		sum += index
	index = index + 1
print(sum)


t = int(input())
s = input()
time = 0
eve = {a for (a, b) in zip(range(1, t + 1), list(s)) if int(b) % 2 == 0}
for x in eve:
	time += x
print(time)


def e(s):
	c = 0
	for i in range(len(s)):
		t = ord(s[i]) - ord('0')
		if t % 2 == 0:
			c += i + 1
	return c
n = int(input())
s = input()
lis = []
for i in s:
	lis.append(i)
print(e(lis))


n = int(input())
ai = input()
c = 0
for i in range(len(ai)):
	if int(ai[i]) % 2 == 0:
		c += i + 1
print(c)


n = int(input())
s = input()
sub = 0
for i in range(n):
	if not int(s[i]) % 2:
		sub += i + 1
print(sub)


from sys import stdin
n = int(stdin.readline().strip())
s = stdin.readline().strip()
p = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		p += i + 1
print(p)


num = int(input())
arr = [int(i) for i in input()][:num]
sum = 0
for i in range(num):
	if arr[i] % 2 == 0:
		sum = sum + 1 * (i + 1)
print(sum)


(n, s) = (int(input()), input())
ans = 0
for (index, num) in enumerate(s, start=1):
	if int(num) % 2 == 0:
		ans += index
print(ans)


from sys import stdin, stdout
N = int(stdin.readline())
A = stdin.readline()
res = 0
for i in range(0, N):
	if int(A[i]) % 2 == 0:
		res += i + 1
stdout.write(str(res))
stdout.write('\n')


n = int(input())
s = list(input())
s2 = [list(map(int, x)) for x in s]
tmp = 0
for i in range(len(s2)):
	if s2[i][0] % 2 == 0:
		tmp += i + 1
print(tmp)


n = int(input())
y = input()
yL = len(y)
tot = int(yL * (yL + 1) / 2)
for (i, each) in enumerate(y[::-1]):
	if int(each) % 2 == 1:
		tot -= n - i
print(tot)


x = int(input())
y = input()
cmt = 0
for i in range(x):
	if int(y[i]) % 2 == 0:
		cmt += 1 + i
print(cmt)


n = int(input())
count = 0
number = [int(g) for g in input()]
for (counter, j) in enumerate(number):
	if j % 2 == 0:
		count += counter + 1
print(count)


a = int(input())
b = input()
hasil = 0
for i in range(a):
	if int(b[i]) % 2 == 0:
		hasil += i + 1
print(hasil)


n = int(input())
a = input()
cnt = 0
Ar = []
for i in range(n):
	if int(a[i]) % 2 == 0:
		Ar.append(i)
for i in Ar:
	cnt += i + 1
print(cnt)


input()
num = int()
time = int(1)
for x in list(map(int, input())):
	if x % 2 == 0:
		num = num + time
	time = time + 1
print(num)


a = int(input())
s = input()
ans = 0
cnt = 0
for i in range(a):
	if int(s[i]) % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
S = input()
tmp = 0
for i in range(n):
	if int(S[i]) % 2 == 0:
		tmp += i + 1
print(tmp)


from functools import reduce
from operator import add

def solve_it(n, numstr):
	count = 0
	numlen = len(numstr)
	for i in range(numlen):
		if int(numstr[i]) % 2 == 0:
			count += 1 * (i + 1)
	return count
n = int(input())
numstr = input()
print(solve_it(n, numstr))


def even(ls):
	ls = list(ls)
	c = 0
	for i in range(len(ls)):
		k = int(ls[i])
		if k % 2 == 0:
			c = c + i + 1
	return c
n = int(input())
ls = input()
print(even(ls))


N = int(input())
X = input().rstrip()
ans = 0
for i in range(0, len(X)):
	if int(X[i]) % 2 == 0:
		ans = ans + i + 1
print(ans)


n = int(input())
l = list(map(int, input()))
ans = 0
for t in range(n):
	if not l[t] % 2:
		ans += t + 1
print(ans)


import sys

def main():
	(_, s) = sys.stdin.read().strip().split()
	return sum((i + 1 for (i, j) in enumerate(map(int, s)) if not j % 2))
print(main())


n = int(input())
p = input()
s = list(p)
count1 = 0
for i in range(0, len(s)):
	if int(s[i]) % 2 == 0:
		count1 = count1 + i + 1
print(count1)


n = int(input())
arr = list(map(int, input().strip()))
ans = 0
for i in range(n):
	if arr[i] % 2 == 0:
		arr[i] = 1
		ans += i + 1
	else:
		arr[i] = 0
print(ans)


from math import *
m = int(input())
n = int(input())
a = list(str(n))
count = 0
for i in range(m):
	if int(a[i]) % 2 == 0:
		count += i + 1
print(count)


n = int(input())
s = input()
cnt = 0
ans = 0
for c in s:
	cnt += 1
	if int(c) % 2 == 0:
		ans += cnt
print(ans)


print((lambda n, string: sum((i + 1 for i in range(len(string)) if int(string[i]) % 2 == 0)))(int(input()), input()))


n = int(input())
ans = 0
s = input()
s = ''.join(reversed(s))
for i in range(n - 1, -1, -1):
	if ord(s[i]) % 2 == 0:
		ans += n - i
print(ans)


n = int(input())
l = list(input())
v = [int(i) for i in l]
ans = 0
for i in range(len(v)):
	if v[i] % 2 == 0:
		ans += i + 1
print(ans)


(n, s, res) = (int(input()), input(), 0)
for i in range(n):
	res += len(s[:i + 1]) if int(s[i]) % 2 == 0 else 0
print(res)


n = int(input())
s = list(input().strip())
s = [int(i) for i in s]
cnt = 0
for i in range(n):
	if s[i] % 2 == 0:
		cnt += i + 1
print(cnt)


n = int(input())
inp = input()
ans = 0
for (i, inpp) in enumerate(inp):
	if int(inpp) % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
s = input()
count = 0
for (i, ch) in enumerate(s):
	if ch in '2468':
		count += i + 1
print(count)


rub = input()
x = input()
ind = 0
res = 0
for char in x:
	ind += 1
	if int(char) % 2 == 0:
		res += ind
print(res)


p = 0
n = int(input())
a = input()
j = len(a)
for j in range(j):
	num = int(a[j])
	if num % 2 == 0:
		p += j + 1
	j -= 1
print(p)


n = input()
s = input()
i = 0
ans = 0
while i < int(n):
	k = ord(s[i]) - 48
	if k % 2 == 0:
		ans += i + 1
	i = i + 1
print(ans)


import math
n = input()
mst = input()
pos = 1
rpos = 1
res = 0
for i in mst:
	isP = (int(i) + 1) % 2
	if isP:
		res += pos
	pos += 1
print(res)


import time

def makingSubstr(strA, lenStr):
	evenCnt = 0
	for x in range(lenStr):
		if isEven(int(strA[x])):
			evenCnt += x + 1
	return evenCnt

def isEven(num):
	if num % 2 == 0:
		return True
	else:
		return False

def solve():
	len = int(input())
	strA = input()
	print(makingSubstr(strA, len))
solve()


ii = lambda : int(input())
mi = lambda : map(int, input().split())
li = lambda : list(mi())
si = lambda : input()
n = ii()
l = si()
p = 0
for i in range(n):
	if int(l[i]) % 2 == 0:
		p += i + 1
print(p)


n = int(input())
s = input()
i = 0
ans = 0
while i < n:
	if int(s[i]) % 2 == 0:
		ans += i + 1
	i += 1
print(ans)


l = []
s = 0
input()
x = input()
for i in x:
	l.append(int(i))
for i in range(len(l)):
	if l[i] % 2 == 0:
		s += i + 1
print(s)


def f(n, s):
	counts = [0] * n
	if int(s[n - 1]) % 2 == 0:
		counts[n - 1] = 1
	for i in reversed(range(n - 1)):
		counts[i] = counts[i + 1]
		if int(s[i]) % 2 == 0:
			counts[i] += 1
	return sum(counts)
n = int(input())
s = input()
print(f(n, s))


n = int(input())
num = str(input())
count = 0
for i in range(n):
	if int(num[i]) % 2 == 0:
		count += i + 1
print(count)


import sys

class Main:

	def __init__(self):
		self.buff = None
		self.index = 0

	def next(self):
		if self.buff is None or self.index == len(self.buff):
			self.buff = sys.stdin.readline().split()
			self.index = 0
		val = self.buff[self.index]
		self.index += 1
		return val

	def next_int(self):
		return int(self.next())

	def solve(self):
		n = self.next_int()
		s = self.next()
		r = 0
		for i in range(0, n):
			if int(s[i]) % 2 == 0:
				r += i + 1
		print(r)
Main().solve()


i = int(input())
st = input()
a = 0
for j in range(i):
	if int(st[j]) % 2 == 0:
		a += j + 1
print(a)


_ = input()
s = input()
result = 0
for (i, ch) in enumerate(s):
	if ch in {'2', '4', '6', '8'}:
		result += i + 1
print(result)


n = int(input())
s = input()
r = n - 1
res = 0
while r >= 0:
	if int(s[r]) % 2 == 0:
		res += 1
		res += r
	r -= 1
print(res)


import sys
input = lambda : sys.stdin.readline().strip()
n = int(input())
arr = str(input())
ret = 0
for i in range(n):
	if int(arr[i]) % 2 == 0:
		ret += i + 1
print(ret)


k = int(input())
n = list(input())
i = 1
counter = 0
for item in n:
	if int(item) % 2 == 0:
		counter += i
	i += 1
print(counter)


input()
i = 1
ans = 0
for x in input():
	if int(x) % 2 == 0:
		ans += i
	i += 1
print(ans)


def Substring():
	n = int(input())
	s = input()
	total = 0
	for end in range(len(s) - 1, -1, -1):
		if s[end] in ['2', '4', '6', '8', '0']:
			total += end + 1
	print(total)
Substring()


import sys
import math
import os
import itertools
import string
import heapq
import _collections
from collections import Counter
from collections import defaultdict
from functools import lru_cache
import bisect
import re
import queue
from decimal import *

class Scanner:

	@staticmethod
	def int():
		return int(sys.stdin.readline().rstrip())

	@staticmethod
	def string():
		return sys.stdin.readline().rstrip()

	@staticmethod
	def map_int():
		return [int(x) for x in Scanner.string().split()]

	@staticmethod
	def string_list(n):
		return [input() for i in range(n)]

	@staticmethod
	def int_list_list(n):
		return [Scanner.map_int() for i in range(n)]

	@staticmethod
	def int_cols_list(n):
		return [int(input()) for i in range(n)]

class Math:

	@staticmethod
	def gcd(a, b):
		if b == 0:
			return a
		return Math.gcd(b, a % b)

	@staticmethod
	def lcm(a, b):
		return a * b // Math.gcd(a, b)

	@staticmethod
	def divisor(n):
		res = []
		i = 1
		for i in range(1, int(n ** 0.5) + 1):
			if n % i == 0:
				res.append(i)
				if i != n // i:
					res.append(n // i)
		return res

	@staticmethod
	def round_up(a, b):
		return -(-a // b)

	@staticmethod
	def is_prime(n):
		if n < 2:
			return False
		if n == 2:
			return True
		if n % 2 == 0:
			return False
		d = int(n ** 0.5) + 1
		for i in range(3, d + 1, 2):
			if n % i == 0:
				return False
		return True

def pop_count(x):
	x = x - (x >> 1 & 6148914691236517205)
	x = (x & 3689348814741910323) + (x >> 2 & 3689348814741910323)
	x = x + (x >> 4) & 1085102592571150095
	x = x + (x >> 8)
	x = x + (x >> 16)
	x = x + (x >> 32)
	return x & 127
MOD = int(1000000000.0) + 7
INF = int(1000000000000000.0)

def solve():
	N = Scanner.int()
	S = Scanner.string()
	ans = 0
	cnt = sum([int(s) % 2 == 0 for s in S])
	for i in range(N):
		ans += cnt
		if int(S[i]) % 2 == 0:
			cnt -= 1
	print(ans)

def main():
	solve()
main()


length = int(input())
a = input()
num = 0
for i in range(length):
	if int(a[i]) % 2 == 0:
		num += i + 1
print(num)


n = int(input())
a = input()
ans = 0
f = '24680'
for i in range(n):
	if a[i] in f:
		ans += i + 1
print(ans)


s = int(input())
n = input()
n = list(n)
count = 0
k = []
for i in range(len(n)):
	if int(n[i]) % 2 == 0:
		count = count + (i + 1)
print(count)


def even_lines():
	n = int(input())
	number = input()
	count = 0
	for i in range(n):
		if int(number[i]) % 2 == 0:
			count += i + 1
	print(count)
even_lines()


ran = int(input())
a = input()
hap = 0
for i in range(0, ran):
	if int(a[i]) % 2 == 0:
		hap += i + 1
print(hap)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict
import math

def listIn():
	return list(map(int, stdin.readline().strip().split()))

def stringListIn():
	return [x for x in stdin.readline().split()]

def intIn():
	return int(stdin.readline())

def stringIn():
	return stdin.readline().strip()
n = intIn()
S = stringIn()
arr = [0] * n
ans = 0
for i in range(n):
	if int(S[i]) % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
s = input()
res = 0
for i in range(n):
	if not int(s[i]) & 1:
		res += i + 1
print(res)


N = int(input())
S = input()
sum = 0
for i in range(0, N):
	if int(S[i]) % 2 == 0:
		sum += i + 1
print(sum)


a = int(input())
b = input()
s = 0
for i in range(len(b)):
	if int(b[i]) % 2 == 0:
		s += i + 1
print(s)


n = int(input())
arr = list(input())
cnt = 0
for i in range(0, len(arr)):
	if int(arr[i]) % 2 == 0:
		cnt += i + 1
print(cnt)


from math import *
n = int(input())
s = input()
ans = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		lenn = i + 1
		ans += lenn
print(ans)


(n, s) = (int(input()), input())
ans = 0
for (i, v) in enumerate(s):
	if int(v) % 2 == 0:
		ans += i + 1
print(ans)


array_size = int(input())
array = list(map(int, input()))
sum = 0
for x in range(array_size):
	if array[x] % 2 == 0:
		sum += x + 1
print(sum)


l = int(input())
s = input()
ans = 0
for i in range(l):
	if int(s[i]) % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
p = list(map(int, input()))
l = []
for i in range(n):
	if p[i] % 2 == 0:
		l.append(i + 1)
print(sum(l))


n = int(input())
a = input()
ans = 0
for (i, j) in enumerate(a):
	if int(j) % 2 == 0:
		ans += i + 1
print(ans)


def is_even(letter):
	return letter in ['0', '2', '4', '6', '8']
n = input()
string = input()
even_substrings = 0
for i in range(len(string)):
	if is_even(string[len(string) - i - 1]):
		even_substrings += len(string) - i
print(even_substrings)


_x = input()
_1 = input()
___ = 0
for _ in range(int(_x)):
	if int(_1[_]) % 2 == 0:
		___ = ___ + _ + 1
print(___)


from math import ceil, log, floor, sqrt
import math
k = 1

def mod_expo(n, p, m):
	result = 1
	while p != 0:
		if p % 2 == 1:
			result = result * n % m
		p //= 2
		n = n * n % m
	return result

def is_prime(n):
	m = 2
	while m * m <= n:
		if n % m == 0:
			return False
		m += 1
	return True

def find_sum(n, a):
	a.insert(0, 0)
	for i in range(1, n + 1):
		prev = a[i] & a[i - 1]
		cur = a[i] | a[i - 1]
		a[i - 1] = prev
		a[i] = cur
	return sum((m * m for m in a))

def prin_abc(x, y, z):
	l = [x, y, z]
	l.sort()
	if l[1] < l[2]:
		print('NO')
		return
	a = b = l[0]
	c = l[2]
	print('YES')
	print(a, b, c)

def get_scores(n, vals):
	l = 0
	r = n - 1
	turn = 0
	sereja = 0
	dima = 0
	while l <= r:
		if vals[l] > vals[r]:
			cur = vals[l]
			l += 1
		else:
			cur = vals[r]
			r -= 1
		if turn == 0:
			sereja += cur
		else:
			dima += cur
		turn = not turn
	print(sereja, dima)

def count_lamps(n, m):
	return (n * m + 1) // 2

def find_holidays(n):
	cnt = 2 * (n // 7)
	rem = n % 7
	mx = mn = cnt
	if rem == 1:
		mx += 1
	elif rem > 1:
		mx += 2
	if rem == 6:
		mn += 1
	print(mn, mx)

def nc2(n):
	return n * (n - 1) // 2

def is_even(n):
	ev = ['2', '4', '6', '8']
	return n in ev

def cnt_evn_substr(n, s):
	cnt = 0
	for i in range(n):
		if is_even(s[i]):
			cnt += i + 1
	return cnt
t = 1
while t:
	t = t - 1
	(k, g) = (0, 0)
	points = []
	n = int(input())
	a = input()
	print(cnt_evn_substr(n, a))


input()
var = input()
res = 0
for i in range(len(var)):
	if int(var[i]) % 2 == 0:
		res += i + 1
print(res)


n = int(input())
st = input()
result = 0
for i in range(len(st)):
	if int(st[i]) % 2 == 0:
		result += i + 1
print(result)


a = int(input())
b = input()
k = 0
for i in range(a):
	c = int(b[i])
	if c % 2 == 0:
		k += i + 1
print(k)


length = int(input())
str1 = input().strip('\n')
ans = 0
for i in range(length):
	if int(str1[i]) % 2 == 0:
		ans += i + 1
	else:
		pass
print(ans)


n = int(input())
p = list(input())
x = 1
sam = 0
for it in p:
	if int(it) % 2 == 0:
		sam += x
	x += 1
print(sam)


n = int(input())
s = input()
i = 1
r = 0
for x in s:
	if int(x) % 2 == 0:
		r += i
	i += 1
print(r)


from __future__ import division, print_function
import bisect
import math
import itertools
import sys
from atexit import register
if sys.version_info[0] < 3:
	from io import BytesIO as stream
else:
	from io import StringIO as stream
if sys.version_info[0] < 3:

	class dict(dict):

		def items(self):
			return dict.iteritems(self)

		def keys(self):
			return dict.iterkeys(self)

		def values(self):
			return dict.itervalues(self)
	input = raw_input
	range = xrange
	filter = itertools.ifilter
	map = itertools.imap
	zip = itertools.izip

def sync_with_stdio(sync=True):
	global input, flush
	if sync:
		flush = sys.stdout.flush
	else:
		sys.stdin = stream(sys.stdin.read())
		input = lambda : sys.stdin.readline().rstrip('\r\n')
		sys.stdout = stream()
		register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))

def main():
	n = int(input())
	s = input()
	t = 0
	for i in range(0, n):
		if int(s[i]) % 2 == 0:
			t += i + 1
	print(t)
sync_with_stdio(False)
main()


n = int(input())
sum = 0
x = input()
for i in range(n):
	if int(x[i]) % 2 == 0:
		sum += i + 1
print(sum)


n = int(input())
g = input()
count = 0
for i in range(n):
	if int(g[i]) % 2 == 0:
		count += i + 1
print(count)


intin = lambda : map(int, input().split())
Ain = lambda : list(map(int, input().split()))
n = int(input())
s = input()
i = 0
ans = 0
while i < n:
	x = int(s[i])
	if x % 2 == 0:
		ans += i + 1
	i += 1
print(ans)


import sys

def input():
	return sys.stdin.readline().strip()

def print(*x, sep=' ', end='\n'):
	return sys.stdout.write(sep.join(map(str, x)) + end)

def read():
	return sys.stdin.read()

def get():
	return (int(input()), input())

def out(*arg):
	if type(arg[0]) == list:
		for i in arg[0]:
			print(i)
	else:
		print(arg)

def main():
	(n, s) = get()
	ans = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			ans += i + 1
	print(ans)
main()


input()
L = list(map(int, input()))
ans = 0
for (i, x) in enumerate(L):
	if x % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
s = input()
s.split()
s = list(map(int, s))
c = 0
for i in range(0, n):
	if s[i] % 2 == 0:
		c += i + 1
	else:
		continue
print(c)


import sys
N = int(sys.stdin.readline())
S = sys.stdin.readline().strip()
evens = 0
for (idx, digit) in enumerate(S):
	if int(digit) % 2 == 0:
		evens += idx + 1
print(evens)


N = int(input())
S = input()
res = 0
for (i, s) in enumerate(S):
	if int(s) % 2 == 0:
		res += i + 1
print(res)


import math
import random
import sys
from collections import defaultdict as dd
ans = 0
n = int(input())
l = [int(i) for i in input()]
for i in range(n):
	if l[i] % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
a = input()
res = 0
for i in range(len(a)):
	if int(a[i]) % 2 == 0:
		res += i + 1
print(res)


import sys
import math
Input = sys.stdin.readline
get_list = lambda : list(map(int, sys.stdin.readline().strip()))
get_int = lambda : int(sys.stdin.readline())
z = get_int()
a = get_list()
sum = 0
c = len(a)
for i in range(c):
	if a[i] % 2 == 0:
		sum += i + 1
print(sum)


import sys
n = int(sys.stdin.readline().strip())
s = list(map(int, list(sys.stdin.readline().strip())))
x = 0
for i in range(len(s)):
	if s[i] % 2 == 0:
		x += i + 1
print(x)


class CodeforcesTask1139ASolution:

	def __init__(self):
		self.result = ''
		self.str_len = 0
		self.str = ''

	def read_input(self):
		self.str_len = int(input())
		self.str = input()

	def process_task(self):
		result = 0
		evens = [str(x) for x in range(10) if not x % 2]
		for x in range(self.str_len):
			if self.str[x] in evens:
				result += x + 1
		self.result = str(result)

	def get_result(self):
		return self.result
Solution = CodeforcesTask1139ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


n = int(input())
x = input()
res = []
for i in range(len(x)):
	if int(x[i]) % 2 == 0:
		res.append(i + 1)
print(sum(res))


n = int(input())
s = input()
s = ' '.join(s)
temp = list(map(int, s.split()))
counter = 0
for i in range(n):
	if temp[i] % 2 == 0:
		counter += i + 1
print(counter)


input()
res = 0
for (i, c) in enumerate(input()):
	if c in set('02468'):
		res += i + 1
print(res)


n = int(input())
s = input()
cnt = 0
for i in range(n):
	if s[i] in ['2', '4', '6', '8']:
		cnt += i + 1
print(cnt)


n = int(input())
c = list(map(int, input()))
tot = 0
for i in range(len(c)):
	if c[i] % 2 == 0:
		tot += i + 1
print(tot)


n = int(input())
s = input()
out = 0
for (i, c) in enumerate(s):
	if c in '2468':
		out += i + 1
print(out)


def main():
	d = input()
	n = input()
	s = 0
	for (i, c) in enumerate(n):
		if int(c) % 2 == 0:
			s += i + 1
	print(s)
main()


def func(str, length):
	count = 0
	for i in range(0, length, 1):
		temp = ord(str[i]) - ord('0')
		if temp % 2 == 0:
			count += i + 1
	return count
n = int(input())
string = input()
print(func(string, n))


from sys import stdin, stdout
from collections import defaultdict, Counter, deque
from bisect import bisect, bisect_left
import math
from itertools import permutations
import queue
I = stdin.readline
n = int(I())
s = I()
count = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		count += i + 1
print(count)


def solve(n, s):
	ans = 0
	for (i, char) in enumerate(s):
		if int(char) % 2 == 0:
			ans += i + 1
	return ans
n = int(input())
s = input()
print(solve(n, s))


while True:
	n = int(input())
	s = input()
	evens = 0
	for i in range(0, n):
		if int(s[i]) % 2 == 0:
			evens += i + 1
	print(evens)
	break


import os, sys, string, math

def main(s):
	count = 0
	for r in range(len(s)):
		if int(s[r]) % 2 == 0:
			count += r + 1
	return count
l = input()
s = input()
print(main(s))


a = input()
re = input()
ans = 0
for i in range(0, len(re)):
	if int(re[i]) % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
s = input()
l = ['2', '4', '6', '8', '0']
c = 0
for i in range(n):
	if s[i] in l:
		c += i + 1
print(c)


cnt = lambda s, x: s.count(x)
ii = lambda : int(input())
si = lambda : input()
f = lambda : map(int, input().split())
dgl = lambda : list(map(int, input()))
il = lambda : list(map(int, input().split()))
n = ii()
s = si()
sm = 0
l = []
for i in range(n):
	if not int(s[i]) & 1:
		l.append(i)
for i in range(len(l)):
	sm += l[i] + 1
print(sm)


import sys

def main():
	res = 0
	sys.stdin.readline()
	s = list(map(int, sys.stdin.readline().strip()))
	for (i, c) in enumerate(s):
		if c % 2 == 0:
			res += i + 1
	print(res)
main()


gi = lambda : list(map(int, input().strip().split()))
(n,) = gi()
s = input()
ans = 0
c = 0
for e in s:
	c += 1
	if int(e) % 2 == 0:
		ans += c
print(ans)


import math
n = int(input())
s = str(input())
ans = 0
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		ans = ans + i + 1
print(ans)


(n, arr) = (int(input()), input())
print(sum([i + 1 for i in range(n) if (ord(arr[i]) - ord('0')) % 2 == 0]))


input()
print(sum((i if ord(c) % 2 == 0 else 0 for (i, c) in enumerate(input().strip(), 1))))


n = int(input())
s = input()
r = 0
for i in range(n):
	if s[i] in '02468':
		r += i + 1
print(r)


n = int(input())
s = list(map(int, input()))
total = 0
for (i, x) in enumerate(s):
	if x % 2 == 0:
		total += i + 1
print(total)


def readLine():
	a = input()
	return [int(i) for i in a.split(' ')]
n = readLine()[0]
s = input()
ans = 0
for (i, c) in enumerate(s):
	if int(c) % 2 == 0:
		ans += i + 1
print(ans)


_ = input()
s = input()
count = 0
for (i, c) in enumerate(s):
	if int(c) % 2 == 0:
		count += i + 1
print(count)


length = int(input())
s = list(map(int, input()))
evens = 0
for i in range(length):
	if s[i] % 2 == 0:
		evens += i + 1
print(evens)


import sys
input = sys.stdin.readline
n = int(input())
s = input()
ANS = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		ANS += i + 1
print(ANS)


n = int(input())
s = input()
ctr = 0
for x in range(len(s)):
	if int(s[x]) % 2 == 0:
		ctr += x + 1
print(ctr)


n = int(input())
s = input()
cnt = 0
for i in range(n):
	if s[i] in '2468':
		cnt += i + 1
print(cnt)


from math import ceil, sqrt, gcd, log, floor
from collections import deque

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().strip().split(' '))

def li():
	return list(mi())

def msi():
	return map(str, input().strip().split(' '))

def lsi():
	return list(msi())
n = ii()
s = si()
c = 0
for i in range(n - 1, -1, -1):
	if int(s[i]) % 2 == 0:
		c += i + 1
print(c)


n = int(str(input()).strip())
s = map(int, list(str(input()).strip()))
total = 0
for (i, _s) in enumerate(s, 1):
	if int(_s) % 2 == 0:
		total += i
print(total)


n = int(input())
s = input()
count = 0
for i in s:
	if int(i) & 1 == 0:
		count += 1
c = 0
for i in s:
	c += count
	if int(i) & 1 == 0:
		count -= 1
print(c)


input()
s = input()
pos = 0
result = 0
for i in s:
	pos += 1
	if int(i) % 2 == 0:
		result += pos
print(result)


n = eval(input())
s = input()
res = 0
for i in range(n):
	if (ord(s[i]) - ord('0')) % 2 == 0:
		res += i + 1
print(res)


n = int(input())
sayi = input()
sonuc = 0
j = 1
for i in sayi:
	i = int(i)
	if i % 2 == 0:
		sonuc += j
	j += 1
print(sonuc)


n = int(input())
s = input()
answer = 0
for (idx, si) in enumerate(s):
	if int(si) % 2 == 0:
		answer += idx + 1
print(answer)


n = int(input())
l = list(map(int, input()))
total = 0
for i in range(n):
	if l[i] % 2 == 0:
		total += i + 1
print(str(total))


def even_string(s):
	count = 0
	for i in range(len(s)):
		if (ord(s[i]) - ord('0')) % 2 == 0:
			count += i + 1
	return count
n = int(input())
t = input()
print(even_string(t))


def main():
	n = int(input())
	s = input()
	ret = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			ret += i + 1
	print(ret)
main()


n = int(input())
s = input()
num = int(s)
cnt = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		cnt = cnt + i + 1
print(cnt)


x = int(input())
y = list(map(int, input()))
count = 0
for i in range(x):
	if y[i] % 2 == 0:
		count += i + 1
print(count)


size = input()
s = input()

def get_sub():
	all_subs = sum(range(int(size) + 1))
	for (idx, val) in enumerate(s):
		if int(val) % 2 != 0:
			all_subs -= 1
			all_subs -= idx
	return all_subs
print(get_sub())


n = int(input(''))
s = [int(x) for x in list(input(''))]
sum1 = 0
for i in range(n):
	if s[i] % 2 == 0:
		sum1 += i + 1
print(sum1, end='')


n = int(input())
n = input()
ans = 0
for (i, k) in enumerate(n):
	if int(k) & 1:
		continue
	else:
		ans += i + 1
print(ans)


def evenNumSubstring(str):
	length = len(str)
	count = 0
	for i in range(0, length, 1):
		temp = ord(str[i]) - ord('0')
		if temp % 2 == 0:
			count += i + 1
	return count
n = int(input())
s = input()
print(evenNumSubstring(s))


n = int(input())
(s, q) = (list(map(int, input())), 0)
for i in range(n):
	if s[i] & 1 == 0:
		q += i + 1
print(q)


rr = lambda : input().strip()
rri = lambda : int(rr())
rrm = lambda : list(map(int, rr().split()))

def solve(N, S):
	ans = 0
	for (i, x) in enumerate(S):
		x = int(x)
		if x % 2 == 0:
			ans += i + 1
	return ans
for tc in range(1):
	N = rri()
	S = rr()
	print(solve(N, S))


n = int(input())
s = input()
count = 0
co_ev = 0
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		co_ev += 1
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		co_ev -= 1
		count += co_ev + 1
	else:
		count += co_ev
print(count)


try:
	n = int(input())
	s = input()
	ans = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			ans += i + 1
	print(ans)
except EOFError as e:
	pass


n = int(input())
x = int(input())
l = list(str(x))
cnt = 0
ans = []
for i in range(len(l)):
	t = int(l[i])
	if t % 2 == 0:
		cnt += i + 1
print(cnt)


a = int(input())
b = list(input())
(count, c) = (0, [])
for x in range(a):
	if int(b[x]) % 2 == 0:
		c.append(int(b[x]))
		count += 1 + x
	else:
		pass
print(count)


n = int(input())
s = input().strip()
ans = sum((i + 1 for i in range(n) if s[i] in '02468'))
print(ans)


import math
from collections import deque, defaultdict
from sys import stdin, stdout
listin = lambda : list(map(int, input().split()))
mapin = lambda : map(int, input().split())
n = int(input())
s = input()
count = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		count += i + 1
print(count)


n0 = input()
s = input()

def counter(s):
	c = 0
	for (i, n) in enumerate(s):
		if not int(n) % 2:
			c += i + 1
	return c
print(counter(s))


def f():
	n = int(input())
	s = input()
	rez = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			rez += i + 1
	print(rez)
f()


n = int(input())
inp = input()
string = [int(i) for i in inp]
result = 0
for i in range(len(string)):
	if string[i] % 2 == 0:
		result += i + 1
print(result)


x = input()
s = str(input())
r = 0
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		r += i + 1
print(r)


input()
ans = 0
for (i, c) in enumerate(input()):
	if ord(c) % 2 == 0:
		ans += i + 1
print(ans)


strLength = int(input())
str = input()
total = 0
for idx in range(int(strLength)):
	if int(str[idx]) % 2 == 0:
		total = total + idx + 1
print(total)


import sys
lines = []
for line in sys.stdin:
	lines.append(line.rstrip('\n'))
n = int(lines[0])
del lines[0]
sumi = 0
s = lines[0]
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		sumi += i + 1
print(sumi)


n = eval(input())
s = input()
count = 0
for i in range(n):
	num = int(s[i])
	if num % 2 == 0:
		count = count + i + 1
print(count)


n = int(input().strip())
s = map(int, input().strip())
answer = 0
for (i, r) in enumerate(s):
	if r % 2 == 0:
		answer += i + 1
print(answer)


from __future__ import division, print_function
from sys import stdin, stdout
import itertools, os, sys, threading
from collections import deque, Counter, OrderedDict, defaultdict
import heapq
from math import ceil, floor, log, sqrt, factorial, pow, pi, gcd

def ii():
	return int(input())

def si():
	return str(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())

def fii():
	return int(stdin.readline())

def fsi():
	return str(stdin.readline())

def fmi():
	return map(int, stdin.readline().split())

def fli():
	return list(fmi())
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
mod = 1000000007
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

def getKey(item):
	return item[0]

def sort2(l):
	return sorted(l, key=getKey)

def d2(n, m, num):
	return [[num for x in range(m)] for y in range(n)]

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def ntl(n):
	return [int(i) for i in str(n)]

def powerMod(x, y, p):
	res = 1
	x %= p
	while y > 0:
		if y & 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
graph = defaultdict(list)
visited = [0] * 1000000
col = [-1] * 1000000

def dfs(v, c):
	if visited[v]:
		if col[v] != c:
			print('-1')
			exit()
		return
	col[v] = c
	visited[v] = 1
	for i in graph[v]:
		dfs(i, c ^ 1)

def bfs(d, v):
	q = []
	q.append(v)
	visited[v] = 1
	while len(q) != 0:
		x = q[0]
		q.pop(0)
		for i in d[x]:
			if visited[i] != 1:
				visited[i] = 1
				q.append(i)
		print(x)
	print(l)

def make_graph(e):
	d = {}
	for i in range(e):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
		if y not in d.keys():
			d[y] = [x]
		else:
			d[y].append(x)
	return d

def gr2(n):
	d = {}
	for i in range(n):
		(x, y) = mi()
		if x not in d.keys():
			d[x] = [y]
		else:
			d[x].append(y)
	return d

def connected_components(graph):
	seen = set()

	def dfs(v):
		vs = set([v])
		component = []
		while vs:
			v = vs.pop()
			seen.add(v)
			vs |= set(graph[v]) - seen
			component.append(v)
		return component
	ans = []
	for v in graph:
		if v not in seen:
			d = dfs(v)
			ans.append(d)
	return ans

def primeFactors(n):
	s = set()
	while n % 2 == 0:
		s.add(2)
		n = n // 2
	for i in range(3, int(sqrt(n)) + 1, 2):
		while n % i == 0:
			s.add(i)
			n = n // i
	if n > 2:
		s.add(n)
	return s
n = ii()
s = list(si())
count = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		count += i + 1
print(count)


from sys import stdin
import math

def find_aux(string):
	aux = [0] * len(string)
	if int(string[-1]) % 2 == 0:
		aux[-1] = 1
	for i in range(len(string) - 2, -1, -1):
		if int(string[i]) % 2 == 0:
			aux[i] = aux[i + 1] + 1
		else:
			aux[i] = aux[i + 1]
	return aux
n = int(stdin.readline().strip())
string = list(stdin.readline().strip())
aux = find_aux(string)
total = 0
for i in range(n):
	total += aux[i]
print(total)


le = int(input())
s = input()
count = 0
for i in range(le):
	if int(s[i]) % 2 == 0:
		count = count + (i + 1)
print(count)


from collections import deque as de
import math
from collections import Counter as cnt
from functools import reduce
from typing import MutableMapping
from itertools import groupby as gb
from fractions import Fraction as fr

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

class My_stack:

	def __init__(self):
		self.data = []

	def my_push(self, x):
		return self.data.append(x)

	def my_pop(self):
		return self.data.pop()

	def my_peak(self):
		return self.data[-1]

	def my_contains(self, x):
		return self.data.count(x)

	def my_show_all(self):
		return self.data

	def isEmpty(self):
		return len(self.data) == 0
arrStack = My_stack()

def decimalToBinary(n):
	return bin(n).replace('0b', '')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def get_prime_factors(number):
	prime_factors = []
	while number % 2 == 0:
		prime_factors.append(2)
		number = number / 2
	for i in range(3, int(math.sqrt(number)) + 1, 2):
		while number % i == 0:
			prime_factors.append(int(i))
			number = number / i
	if number > 2:
		prime_factors.append(int(number))
	return prime_factors

def get_frequency(list):
	dic = {}
	for ele in list:
		if ele in dic:
			dic[ele] += 1
		else:
			dic[ele] = 1
	return dic

def Log2(x):
	return math.log10(x) / math.log10(2)

def isPowerOfTwo(n):
	return math.ceil(Log2(n)) == math.floor(Log2(n))

def ceildiv(x, y):
	return (x + y - 1) // y
n = int(input())
s = list(map(int, input()))
ans = 0
for i in range(n):
	if s[i] % 2 == 0:
		ans += 1
		ans += i
print(ans)


import sys
sys.setrecursionlimit(2000)
from collections import Counter
from functools import reduce
n = [int(val) for val in sys.stdin.readline().split()][0]
s = input()
count = 0
for (ind, val) in enumerate(s):
	if int(val) % 2 == 0:
		count += ind + 1
print(count)


n = int(input())
s = input()
(i, cnt) = (0, 0)
while i < n:
	if int(s[i]) % 2 == 0:
		cnt += i + 1
	i += 1
print(cnt)


num = int(input())
datos = input()
string = list(datos)
string = list(map(int, string))
suma = 0
for n in range(num):
	if string[n] % 2 == 0:
		suma += 1 + 1 * n
print(suma)


a = int(input())
string = list(input())
sub = 0
for i in range(a - 1, -1, -1):
	if int(string[i]) % 2 == 0:
		sub = sub + (i + 1)
print(sub)


(n, s, count) = (int(input()), str(input()), 0)
for j in range(n):
	if ord(s[j]) % 2 == 0:
		count += j + 1
print(count)


import sys
n = sys.stdin.readline()
n = n.rstrip()
n = int(n)
s = sys.stdin.readline()
s = s.rstrip()
ct = 0
for (i, c) in enumerate(s):
	c = int(c)
	if c % 2 == 0:
		ct += i + 1
print(ct)


n = int(input())
s = input()
sol = n * (n + 1) // 2
sum = 0
for i in range(0, len(s)):
	if int(s[i]) % 2 == 1:
		sum = sum + i + 1
print(sol - sum)


n = int(input())
ai = input()
a = [int(i) for i in ai]
sumi = 0
for i in range(n):
	if a[i] % 2 == 0:
		sumi += i + 1
print(sumi)


n = int(input().strip())
s = str(input().strip())
cnt = 0
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		cnt += i + 1
print(cnt)


import pdb
n = int(input())
a = input()
cnt = 0
for (i, e) in enumerate(a):
	if int(e) % 2 == 0:
		cnt += i + 1
print(cnt)


t = int(input())
s = input()
l = 1
ans = 0
for i in s:
	if i == '2' or i == '4' or i == '6' or (i == '8'):
		ans += l
	l += 1
print(ans)


n = eval(input())
s = input()
ans = 0
nList = []
for i in s:
	if eval(i) % 2 == 0:
		nList.append(1)
	else:
		nList.append(0)
for i in range(len(nList)):
	ans += (i + 1) * nList[i]
print(ans)


n = int(input())
arr = list(input())
count = 0
num = 0
for i in arr:
	num += 1
	if int(i) % 2 == 0:
		count += num
print(count)


a = int(input())
b = input()
k = 0
p = 1
for i in b:
	if int(i) % 2 == 0:
		k = k + p
	p = p + 1
print(k)


import sys
n = int(input())
s = input()
ans = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		ans += 1 + i
print(ans)


__author__ = 'NIORLYS'
n = int(input())
s = input()
even = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		even += i + 1
print(even)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
n = I()
c = 0
d = input().strip()
for i in range(n):
	if int(d[i]) % 2 == 0:
		c += i + 1
print(c)


n = int(input())
a = list(map(int, input()))
c = 0
for i in range(n):
	c += (1 - a[i] % 2) * (i + 1)
print(c)


input()
a = list(map(int, input()))
sum = 0
for i in range(len(a)):
	if a[i] % 2 == 0:
		sum += i + 1
print(sum)


n = int(input())
m = input()
s = 0
i = 0
while i != n:
	if int(m[i]) % 2 == 0:
		s += i + 1
	i += 1
print(s)


input()
s = input()
set_ = {'0', '2', '4', '6', '8'}
cnt = 1
res = 0
for c in s:
	if c in set_:
		res += cnt
	cnt += 1
print(res)


n = int(input())
ans = 0
lis = [int(i) for i in list(input())]
for i in range(len(lis)):
	if lis[i] % 2 == 0:
		ans += i + 1
print(ans)


from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
from bisect import bisect_right as br
import heapq
from math import gcd
n = int(input())
count = 0
s = input().strip()
for i in range(n):
	if int(s[i]) % 2 == 0:
		count += i + 1
print(count)


def answer():
	a = int(input())
	b = [int(x) % 2 for x in list(input())]
	i = 0
	ans = 0
	while i < len(b):
		x = b[i]
		if x % 2:
			pass
		else:
			ans += i + 1
		i += 1
	print(ans)
answer()


import sys
input = lambda : sys.stdin.readline().strip('\r\n')
n = int(input())
a = list((int(x) for x in input()))
ans = 0
for i in range(n):
	if a[i] % 2 == 0:
		ans += i + 1
print(ans)


n1 = input()
n = int(n1)
s = input()
l = 0
count = 0
for i in s:
	t = int(i)
	if t % 2 == 0:
		ind = s.index(i, l, n + 1)
		count += ind + 1
		l = ind + 1
print(count)


(_, n) = (input(), input())
k = 0
for (i, v) in enumerate(n):
	if int(v) % 2 is 0:
		k += i + 1
print(k)


n = int(input())
s = input()
dp = [[0, 0] for _ in range(n + 1)]
ans = 0
for i in range(n):
	if int(s[i]) % 2:
		dp[i + 1][1] = sum(dp[i]) + 1
	else:
		dp[i + 1][0] = sum(dp[i]) + 1
		ans += dp[i + 1][0]
print(ans)


from sys import *
from math import *
t = int(stdin.readline())
a = list(map(int, input()))
ans = 0
for i in range(t):
	if a[i] % 2 == 0:
		ans += i + 1
print(ans)


i = input()
n = input()
i = 0
times = 0
while i < len(n):
	if n[i] == '2' or n[i] == '4' or n[i] == '6' or (n[i] == '8'):
		times += i + 1
	i += 1
print(times)


input()
i = 1
res = 0
for c in input():
	if int(c) % 2 != 1:
		res += i
	i += 1
print(res)


input()
print(sum([i + 1 for (i, c) in enumerate(input()) if int(c) % 2 == 0]))


n = int(input())
s = list(input())
ar = [int(x) for x in s]
ans = 0
for i in range(0, n):
	if ar[i] % 2 == 0:
		ans += i + 1
print(ans)


def even_substrings(str):
	n = len(str)
	count = 0
	for i in range(n):
		if int(str[i]) % 2 == 0:
			count += i + 1
	return count
n = int(input())
str = input()
print(even_substrings(str))


import io
import math
import os
from collections import defaultdict
from sys import stdin, stdout

def main():
	n = int(input())
	s = input()
	res = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			res += i + 1
	print(res)
main()


def even(str):
	length = len(str)
	count = 0
	for i in range(0, length, 1):
		temp = ord(str[i]) - ord('0')
		if temp % 2 == 0:
			count += i + 1
	return count
n = int(input())
t = input()
print(even(t))


def main():
	tam = int(input())
	st = input()
	print(substrings(st))

def substrings(st):
	subst = 0
	for (i, num) in enumerate(st):
		if int(num) % 2 == 0:
			subst += i + 1
	return subst
main()


def solve(s, n):
	c = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			c += i + 1
	return c
n = int(input())
s = input()
print(solve(s, n))


t = int(input())
e = input()
q = 0
for w in range(0, t):
	if int(e[w]) % 2 == 0:
		q += w + 1
print(q)


n = int(input())
s = str(input())
res = 0
for x in range(n):
	if int(s[x]) % 2 == 0:
		res += x + 1
print(res)


x = int(input())
s = [int(n) for n in input()]
l = 0
for n in range(x):
	if s[n] % 2 == 0:
		l += n + 1
print(l)


d = 0
num1 = int(input())
a = input()
i = len(a)
for i in range(i):
	num = int(a[i])
	if num % 2 == 0:
		d += i + 1
	i -= 1
print(d)


def evenNumSubstring(str):
	length = len(str)
	count = 0
	for i in range(0, length, 1):
		temp = ord(str[i]) - ord('0')
		if temp % 2 == 0:
			count += i + 1
	return count
le = int(input())
st = input()
print(evenNumSubstring(st))


n = int(input())
s = input().strip()
res = 0
for (i, c) in enumerate(s):
	if ord(c) % 2 == 0:
		res += 1 + i
print(res)


def even_substrings(s, n):
	res = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			res += i + 1
	return res
n = int(input())
s = input()
print(even_substrings(s, n))


import sys
from collections import defaultdict as dd
from itertools import permutations as pp
from itertools import combinations as cc
from collections import Counter as ccd
from random import randint as rd
from bisect import bisect_left as bl
import heapq
mod = 10 ** 9 + 7

def ri(flag=0):
	if flag == 0:
		return [int(i) for i in sys.stdin.readline().split()]
	else:
		return int(sys.stdin.readline())
n = ri(1)
a = input()
c = 0
ans = 0
for i in range(n):
	k = int(a[i])
	if k % 2 == 0:
		ans += i + 1
	c += 1
print(ans)


tot = int(input())
inw = input()
asns = 0
for i in range(tot):
	if int(inw[i]) % 2 == 0:
		asns += i + 1
print(asns)


def mp():
	return map(int, input().split())
n = int(input())
s = input()
cnt = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		cnt += i + 1
print(cnt)


a = input()
s = input()
d = 0
for (i, v) in enumerate(s):
	d += (int(v) + 1) % 2 * (i + 1)
print(d)


TN = 1

def solution():
	n = int(input())
	s = list(map(int, list(input())))
	ans = 0
	for i in range(n):
		if s[i] % 2 == 0:
			ans += i + 1
	print(ans)
while TN != 0:
	solution()
	TN -= 1


n = int(input())
ar = [int(x) for x in input()]
ans = 0
for k in range(n):
	if ar[k] % 2 == 0:
		ans += k + 1
print(int(ans))


n = int(input())
string = str(input())
even = {'0', '2', '4', '6', '8'}
sum = 0
for (i, char) in enumerate(string):
	if char in even:
		sum += i + 1
print(sum)


n = int(input())
seq = input()
nbPaires = 0
for i in range(n):
	if int(seq[i]) % 2 == 0:
		nbPaires += i + 1
print(nbPaires)


n = input()
a = input()
k = 0
for i in range(len(a)):
	k += (int(a[i]) % 2 + 1) % 2 * (i + 1)
print(k)


s = 0
n = input()
sr = input()
for i in range(int(n)):
	if sr[i] == '2':
		s = s + i + 1
	elif sr[i] == '4':
		s = s + i + 1
	elif sr[i] == '6':
		s = s + i + 1
	elif sr[i] == '8':
		s = s + i + 1
print(s)


n = int(input())
num = list(input())
ans = 0
for i in range(n):
	if int(num[i]) % 2 == 0:
		ans += i + 1
print(ans)


def Solution(p, n):
	k = 0
	q = 0
	for i in range(n):
		q = p[i]
		if int(q) % 2 == 0:
			k += i + 1
	return k
n = int(input())
p = input()
print(Solution(p, n))


def main():
	n = int(input())
	s = input()
	result = 0
	for (i, c) in zip(range(len(s)), s):
		cc = ord(c) - ord('0')
		if cc % 2 == 0:
			result += i + 1
	print(result)
exit(main())


def solve(s, n):
	a = []
	for i in range(int(n)):
		if (ord(s[i]) - ord('0')) % 2 == 0:
			a.append(i + 1)
	ans = 0
	for x in a:
		ans += x
	return ans
n = input()
s = input()
print(int(solve(s, n)))


r = int(input())
num = input()
count = 0
for x in range(r):
	if int(num[x]) % 2 == 0:
		count += x + 1
print(count)


from math import *
from copy import *
from string import *
from random import *
from sys import stdin
from operator import *
from itertools import *
from collections import Counter
N = int(stdin.readline())
s = input()
ans = 0
for i in range(len(s)):
	if int(s[i]) & 1 == 0:
		ans += i + 1
print(ans)


n = int(input())
a = []
line = input()
for i in range(n):
	a.append(int(line[i]))
b = 0
for i in range(n):
	if a[i] & 1 == 0:
		b += i + 1
print(b)


number = int(input())
string = input()
data = []
(result, count) = (0, 1)
for m in string:
	data.append(m)
for m in data:
	m = int(m)
	if m % 2 == 0:
		result += count
	count += 1
print(result)


def f():
	a = input()
	b = str(input())
	n = 0
	for i in range(len(b)):
		if int(b[i]) % 2 == 0:
			n += i + 1
	print(n)
	return n
f()


import sys
from bisect import bisect_left, bisect_right
from collections import deque
inf = float('inf')
mod = 1000000007

def binary(number):
	result = 0
	while number:
		result = result + 1
		number = number & number - 1
	return result

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())
n = int(input())
string = input()
count = 0
for i in range(n):
	if int(string[i]) % 2 == 0:
		count = count + (i + 1)
print(count)


n = int(input())
m = str(input())
sum = 0
for i in range(n):
	if m[i] == '2' or m[i] == '4' or m[i] == '6' or (m[i] == '8'):
		sum += i + 1
print(sum)


import re, math, decimal, bisect

def read():
	return input().strip()

def iread():
	return int(input().strip())

def viread():
	return [int(_) for _ in input().strip().split()]

def round(n):
	return int(n + 0.5)
n = iread()
s = read()
ans = 0
for (i, c) in enumerate(s):
	j = i + 1
	if c in '02468':
		ans += j
print(ans)


def solve():
	N = int(input())
	S = input()
	ans = 0
	for i in range(1, N + 1):
		if int(S[i - 1]) % 2 == 0:
			ans += i
	print(ans)
solve()


import sys
n = int(sys.stdin.readline().strip())
s = sys.stdin.readline().strip()
l = len(s)
ans = 0
for i in range(0, l):
	if int(s[i]) % 2 == 0:
		ans = ans + i + 1
print(ans)


n = int(input())
s1 = input()
count = 0
for i in range(n):
	if s1[i] == '2' or s1[i] == '4' or s1[i] == '6' or (s1[i] == '8') or (s1[i] == '0'):
		count += i + 1
print(count)


sum = 0
a = int(input())
x = str(input())
for i in range(a):
	b = int(x[i])
	if b % 2 == 0:
		sum += i + 1
print(sum)


n = int(input())
cou = 0
s = input()[::-1]
ans = 0
for i in range(n):
	tm = int(s[i])
	tmt = not tm % 2
	if not cou:
		if tmt:
			cou += 1
			ans += 1
		continue
	if tmt:
		cou += 1
	ans += cou
print(ans)


a = int(input())
b = str(input())
k = int(0)
for x in range(a):
	if int(b[x]) % 2 == 0:
		k = k + x + 1
print(k)


n = int(input())
ip = input()
s = [0 for _ in range(n)]
for i in range(n - 1, -1, -1):
	if int(ip[i]) % 2 == 0:
		s[i] += 1
	if i != n - 1:
		s[i] += s[i + 1]
for i in range(n - 2, -1, -1):
	s[i] += s[i + 1]
print(s[0])


n = int(input())
string = input()
list = []
for i in range(n):
	if int(string[i]) % 2 == 0:
		list.append(1)
	else:
		list.append(0)
for i in range(n):
	if int(string[i]) % 2 == 0:
		list[i] += i
print(sum(list))


from sys import stdin
n = int(stdin.readline())
s = stdin.readline().strip()
count = 0
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		count += 1 + i
	else:
		pass
print(count)


import math
size = int(input())
cnt = 0
n = input()
for i in range(0, size):
	if int(n[i]) % 2 == 0:
		cnt += i + 1
print(cnt)


n = int(input())
a = int(input())
s = 0
b = list(map(int, str(a)))
for i in range(n):
	if b[i] % 2 == 0:
		s += i + 1
print(s)


import re, math, decimal, bisect

def read():
	return input().strip()

def iread():
	return int(input().strip())

def viread():
	return [int(_) for _ in input().strip().split()]
j = iread()
n = [int(_) for _ in read()]
count = 0
for i in range(len(n)):
	if n[i] % 2 == 0:
		count += i + 1
print(count)


(n, numstring) = (int(input()), input())
ans = 0
for (i, digit) in enumerate(numstring):
	digit = int(digit)
	if digit % 2 == 0:
		ans += i + 1
print(ans)


n = input()
l = list(map(int, list(input())))
result = 0
for i in range(len(l)):
	result += (1 - l[i] % 2) * (i + 1)
print(result)


n = int(input())
ls = list(str(int(input())))
c = 0
for i in range(len(ls)):
	if int(ls[i]) % 2 == 0:
		c += i + 1
print(c)


(n, s) = (int(input()), input())
print(sum([i + 1 for i in range(n) if s[i] in '2468']))


n = int(input())
s = input()
x = 0
i = 0
while i < n:
	y = s[i]
	if int(y) % 2 == 0:
		x += i + 1
	i += 1
print(x)


n = int(input())
s = input().rstrip()
x = list(s)
t = 0
for i in range(0, len(x)):
	if int(x[i]) % 2 == 0:
		t = t + (i + 1 - 0)
print(t)


fl = int(input())
str = input()
n = len(str)
lst = list()
for i in range(n):
	if int(str[i]) % 2 == 0:
		lst.append(i + 1)
print(sum(lst))


n = int(input())
a = input()
count = 0
cindex = 0
for i in a:
	i = int(i)
	if i % 2 == 0:
		count = count + (cindex + 1)
	cindex += 1
print(count)


n = int(input())
inp = input()

def ans(n, s):
	p = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			p += i + 1
	return p
print(ans(n, inp))


n = int(input())
s = input()
ans = 0
for (pos, char) in enumerate(s):
	if int(char) % 2 == 0:
		ans += pos + 1
print(ans)


n = int(input())
s = str(input())
id = 0
ans = 0
for ch in s:
	num = int(ch) - int('0')
	id = id + 1
	if num % 2 == 0:
		ans += id
print(ans)


t = int(input())
n = input()
count = 0
for i in range(len(n)):
	if n[i] in '2468':
		count += i + 1
print(count)


input()
s = input()
total = 0
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		total += i + 1
print(str(total))


n = int(input())
s = list(input())
cnt = 0
for (num, i) in enumerate(s):
	if int(i) % 2 == 0:
		cnt += num + 1
print(cnt)


size = int(input())
nstr = input()
nsubstrs = 0
for i in range(0, size):
	if int(nstr[i]) % 2 == 0:
		nsubstrs += i + 1
print(nsubstrs)


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : list(input())
ips = lambda : input().split()
t = ii()
s = ip()
ans = 0
for i in range(t):
	if int(s[i]) % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
s = input()
rj = 0
s = list(s)
k = 0
for i in s:
	k += 1
	i = int(i)
	if i % 2 == 0:
		rj += k
print(rj)


from fractions import Fraction
import sys
import bisect
import heapq
from math import *
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
mod = pow(10, 9) + 7

def inp():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def graph(vertex):
	return [[] for i in range(0, vertex + 1)]

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def solve():
	n = int(inp())
	s = inp()
	cnt = 0
	ans = 0
	for i in range(0, n):
		if int(s[i]) % 2 == 1:
			continue
		else:
			ans += i + 1
	print(ans)
testcase(1)


input()
a = list(map(int, str(input())))
c = 0
for i in range(len(a)):
	if a[i] % 2 == 0:
		c = c + i + 1
	if a[i] == 0:
		c = c - (len(a) - i)
print(max(c, 0))


n = int(input())
s = input()
summ = 0
for (ind, val) in enumerate(s):
	t = int(val)
	if t % 2 == 0:
		summ += ind + 1
print(summ)


n = int(input())
st = input()
a = [0] * n
rez = 0
for i in range(n):
	a[i] = int(st[i])
i = n - 1
while i != -1:
	if a[i] % 2 == 0:
		rez += len(a) - (len(a) - i) + 1
	i -= 1
print(rez)


x = input()
s = input()
cnt = 0
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		cnt += i + 1
print(cnt)


n = int(input())
str = input()
k = 0
for i in range(len(str)):
	if int(str[i]) % 2 == 0:
		k = k + (i + 1)
print(k)


n = int(input())
s = input()
count = 0
x = 1
for c in s:
	if int(c) % 2 == 0:
		count += x
	x += 1
print(count)


l = int(input())
a = str(input())
res = 0
for i in range(l):
	if int(a[i]) % 2 == 0:
		res = res + i + 1
print(res)


n = int(input())
s = str(input())
total = n * (n + 1) / 2
for i in range(len(s)):
	if int(s[i]) % 2:
		total -= i + 1
print('%d' % total, end='')


import sys

def main():
	n = int(input())
	inp_str = input()
	cnt = 0
	for i in range(len(inp_str)):
		sys.stderr.write(inp_str[i] + '\n')
		if not int(inp_str[i]) % 2:
			cnt += i + 1
	print(cnt)
main()


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
n = int(input())
s = input()
ans = 0
for i in range(1, n + 1):
	if int(s[i - 1]) % 2 == 0:
		ans += i
print(ans)


n = int(input())
a = ['2', '4', '6', '8', '0']
s = input()
count = 1
ans = 0
for i in s:
	if i in a:
		ans += count
	count += 1
print(ans)


input()
m = input()
ans = 0
for n in range(len(m)):
	if int(m[n]) % 2 is 0:
		ans += n + 1
print(ans)


n = int(input())
nn = input()
numm = 0
for i in range(len(nn)):
	if int(nn[i]) % 2 == 0:
		numm += i + 1
print(numm)


n = int(input())
s = input()
result = 0
for (i, c) in enumerate(s):
	if c in '02468':
		result += i + 1
print(result)


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def main():
	n = int(input())
	s = input().strip()
	ans = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			ans += 1
			ans += i
	print(ans)
main()


import time
n = int(input())
s = [int(i) for i in input()]
start = time.time()
ans = 0
for i in range(n):
	if s[i] % 2 == 0:
		ans += i + 1
print(ans)
finish = time.time()


n = int(input())
(ans, cnt) = (0, 1)
for i in input():
	if int(i) % 2 == 0:
		ans += cnt
	cnt += 1
print(ans)


n = int(input())
s = input()
print(sum((i + 1 for (i, l) in enumerate(s) if int(l) % 2 == 0)))


n = int(input())
str_ = input()
sum_ = 0
for i in range(n):
	if int(str_[i]) % 2 == 0:
		sum_ = sum_ + (i + 1)
print(sum_)


length = int(input())
string = input()
sums = 0
for i in range(length):
	if int(string[i]) % 2 == 0:
		sums += i + 1
print(sums)


n = int(input())
dig = []
a = input()
for item in a:
	dig.append(int(item))
l = []
even = [2, 4, 6, 8]
for i in range(0, len(dig)):
	if dig[i] in even:
		l.append(i + 1)
print(sum(l))


n = int(input())
s = list(map(int, input()))
res = 0
for (i, num) in enumerate(s):
	if num % 2 == 0:
		res += i + 1
print(res)


n = int(input())
s = input()

def even_substring(n, s):
	count = 0
	for i in range(n):
		if int(s[i]) % 2 == 0:
			count += i + 1
	return count
print(even_substring(n, s))


n = int(input())
s = list(map(int, list(input().strip())))
ct = 0
for i in range(n):
	if s[i] % 2 == 0:
		ct += i + 1
print(ct)


import sys
import math
strInp = lambda : raw_input().strip().split()
intInp = lambda : list(map(int, strInp()))
n = int(input())
s = list(input())
ans = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		ans += i + 1
print(ans)


size = input()
size = int(size)
integer = input()
num = 0
count = -1
for i in integer:
	count += 1
	if int(i) % 2 == 0:
		num += count
		num += 1
print(num)


num = int(input())
string = str(input())
num = 0
for x in range(len(string)):
	if int(string[x]) % 2 == 0:
		num = num + x + 1
print(num)


n = int(input())
r = list(input())
s = list(map(int, r))
result = 0
for i in range(n):
	if s[i] % 2 == 0:
		result += i + 1
print(result)


n = int(input())
st = input()
l = []
co = 0
for i in range(n):
	if int(st[i]) % 2 == 0:
		co += i + 1
print(co)


num_digits = int(input())
word = input()
count = 0
for (index, c) in enumerate(word):
	if int(c) % 2 == 0:
		count += index + 1
print(count)


n = input()
s = input()
s = s[::-1]
count = 0
for (idx, i) in enumerate(s):
	if int(i) % 2 == 0:
		count += len(s) - idx
print(str(count))


n = int(input())
s = list(input())
count = 0
for (i, c) in enumerate(s):
	if int(c) % 2 == 0:
		count += i + 1
print(count)


def even(string):
	n = len(string)
	total = n * (n + 1) // 2
	odd = 0
	for i in range(len(string)):
		if int(string[i]) % 2 == 1:
			odd = odd + (i + 1)
	return total - odd
n = int(input())
string = input()
print(even(string))


length = int(input())
string = input()
c = 0
for i in string[::-1]:
	if not int(i) % 2:
		c += length
	length -= 1
print(c)


n = int(input())
L = [int(i) for i in input()]
i = 0
res = 0
while i < n:
	if L[i] % 2 == 0:
		res += i + 1
	i += 1
print(res)


n = int(input())
s = input()
s = [int(elt) for elt in s]
i = 0
l = len(s)
for j in range(l):
	if s[j] % 2 == 0:
		i += j + 1
print(i)


input()
s = input()
ans = 0
for i in range(len(s)):
	if s[i] in '2468':
		ans += i + 1
print(ans)


import sys, math, queue
sys.setrecursionlimit(1000000)
n = int(input())
a = list(map(int, list(input())))
e = sum([i + 1 if a[i] % 2 == 0 else 0 for i in range(n)])
print(e)


n = int(input())
s = list(input())
i = 0
j = 0
counter = 0
while i < n:
	if int(s[i]) % 2 == 0:
		counter += i + 1
	i += 1
print(counter)


t = int(input())
s = list(map(int, input().strip()))
c = 0
for i in range(len(s)):
	if s[i] % 2 == 0:
		c += i + 1
print(c)


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def int1():
	return int(input())

def main():
	n = int1()
	s = input()
	z = n - 1
	s1 = 0
	while z >= 0:
		if int(s[z]) % 2 == 0:
			l = s[:z + 1]
			s1 = s1 + len(l)
		z = z - 1
	print(s1)
main()


n = int(input())
b = input()
u = []
for i in range(n):
	if int(b[i]) % 2 == 0:
		u.append(i + 1)
th = len(u)
t = 0
for i in range(th):
	t = t + int(u[i])
y = t
print(int(y))


n = int(input())
data = input()
count = 0
temp = 0
for i in range(n):
	if int(data[i]) % 2 == 0:
		temp += 1
count += temp
for j in range(n):
	if int(data[j]) % 2 == 0:
		temp -= 1
		count += temp
	else:
		count += temp
print(count)


n = int(input())
a = list(input())
ans = 0
d = {'0', '2', '4', '6', '8'}
for i in range(1, n + 1):
	if a[i - 1] in d:
		ans += i
print(ans)


input()
(i, result) = (1, 0)
for x in input():
	if int(x) % 2 == 0:
		result += i
	i += 1
print(result)


input()
s = list(input())
c = 0
a = [int(s[i]) for i in range(len(s))]
for i in range(len(s)):
	if a[i] % 2 == 0:
		c += 1
for i in range(len(s)):
	if a[i] % 2 == 0:
		c += i
print(c)


import sys
n = int(sys.stdin.readline())
s = sys.stdin.readline().rstrip()
cnt = 0
for (idx, now) in enumerate(s):
	if int(now) % 2 == 0:
		cnt += idx + 1
print(cnt)


import sys

def getAndParseInt(num=1):
	string = sys.stdin.readline().strip()
	if num == 1:
		return int(string)
	else:
		return [int(part) for part in string.split()]

def getAndParseString(num=1, delim=''):
	string = sys.stdin.readline().strip()
	if num == 1:
		return string
	elif delim != '':
		return [part for part in string.split(delim)]
	else:
		return [part for part in string.split()]
n = getAndParseInt()
nums = getAndParseString()
count = 0
evens = ['2', '4', '6', '8']
for (index, digit) in enumerate(nums):
	count += (index + 1) * int(digit in evens)
print(count)


n = int(input())
st = input()
c1 = 0
for i in range(n):
	if int(st[i]) % 2 == 0:
		c1 = c1 + i + 1
print(c1)


n = int(input())
print(sum([pos + 1 for (pos, i) in enumerate(input()) if int(i) % 2 == 0]))


input()
t = input()
s = sum(((1 - int(t[i]) % 2) * (i + 1) for i in range(len(t))))
print(s)


n = int(input())
a = input()
c = 0
for i in range(0, n):
	p = int(a[i])
	if p % 2 == 0:
		c = c + i + 1
print(c)


t = int(input())
a = input()
i = t - 1
c = 0
while i >= 0:
	if int(a[i]) % 2 == 0:
		c = c + i + 1
	i = i - 1
print(c)


n = int(input())
s = input()
(co, j) = (0, 0)
for i in range(len(s)):
	if int(s[i]) % 2 == 0:
		co += i + 1
print(co)


i = int(input())
a = input()
b = list(a)
s = 0
for x in range(i):
	if int(b[x]) % 2 == 0:
		s += x + 1
print(s)


A = []
c = 0
n = int(input())
a = str(input())
for i in range(n):
	A.append(int(a[i]))
for i in range(n):
	if A[i] % 2 == 0:
		c += i + 1
print(c)


n = int(input())
s = str(input())
c = 0
j = 0
for i in s:
	if int(i) % 2 == 0:
		c += 1
		c += j
	j += 1
print(c)


n = int(input())
s = str(input())
count = 0
for i in range(n):
	if s[i] in '02468':
		count += i + 1
print(count)


a = int(input())
b = list(map(int, input()))
c = 0
for j in range(a):
	if b[j] % 2 == 0:
		c += 1
		c += j
print(c)


def solve(x):
	count = 0
	for (i, c) in enumerate(x):
		if int(c) % 2 == 0:
			count += i + 1
	return count
n = int(input())
x = input()[:n]
print(solve(x))


from collections import Counter, defaultdict, deque
import itertools
n = int(input())
s = list(map(int, list(input())))
ans = 0
for i in range(n):
	if s[i] % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
s = input()
co = 0
eve = ['2', '4', '6', '8']
for i in range(n):
	if s[i] in eve:
		co += i + 1
print(co)


n = int(input())
s = input()
v = []
cnt = 0
for i in range(n):
	if int(s[i]) % 2 == 0:
		cnt += 1
for i in range(1, len(s)):
	if int(s[i]) % 2 == 0:
		v.append(i + 1)
sm = 0
for i in range(len(v)):
	sm += abs(1 - v[i])
print(sm + cnt)


n = int(input())
a = list(input())
z = 0
for i in range(len(a)):
	if int(a[i]) % 2 == 0:
		z = z + i + 1
print(z)


n = int(input())
l1 = input()
l = ['2', '4', '6', '8']
j = 0
c = 0
for i in l1:
	j += 1
	if i in l:
		c += j
print(c)


length = int(input())
string = str(input())
counter = 0
for i in range(length):
	if string[i] in '24680':
		counter += i + 1
print(counter)


def rahul(word):
	return [char for char in word]
a = int(input())
b = rahul(input())
(c, r) = (0, 0)
while r < a:
	if int(b[r]) % 2 == 0:
		c = c + 1
	r = r + 1
d = c
(r, n) = (0, 0)
while r < a:
	if int(b[r]) % 2 == 0:
		n = n + 1
		d = d + (c - n)
	else:
		d = d + c - n
	r = r + 1
print(d)


n = input()
s = input()
ans = 0
for (i, c) in enumerate(s):
	x = int(c)
	if x % 2 == 0:
		ans += i + 1
print(ans)


digits_nr = int(input())
digits = (int(x) for x in input())
print(sum((idx + 1 for (idx, val) in enumerate(digits) if val % 2 == 0)))


_ = input()
i = 1
res = 0
for x in input():
	if int(x) % 2 == 0:
		res += i
	i += 1
print(res)


c = '2468'
n = int(input())
s = str(input())
rez = 0
for i in range(0, n):
	if s[i] in c:
		rez += i + 1
print(rez)


n = int(input())
s = str(input())
ans = 0
for i in range(0, n):
	if (ord(s[i]) - ord('0')) % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
s = input()
res = 0
for (i, c) in enumerate(s, 1):
	d = int(c)
	if d % 2 == 0:
		res += i
print(res)


lenOfStr = int(input())
string = input()
total = 0
for i in range(lenOfStr):
	if string[i] in '2468':
		total += i + 1
print(total)


amount = int(input())
string = input()
counter = 0
for i in range(len(string)):
	if not int(string[i]) % 2:
		counter += i + 1
print(counter)


def subs(s):
	ans = 0
	for (i, n) in enumerate(s):
		if int(n) % 2 == 0:
			ans += 1
			ans += i
	return ans
n = int(input())
s = input()
print(subs(s))


def main():
	n = int(input())
	s = input()
	a = []
	for ch in s:
		k = int(ch)
		a.append(k)
	i = 0
	ans = 0
	while i < len(a):
		if a[i] % 2 == 0:
			ans += i + 1
			i += 1
		else:
			i += 1
	print(ans)
main()


from sys import setcheckinterval, stdin
setcheckinterval(1000)
from collections import defaultdict
iin = lambda : int(stdin.readline())
lin = lambda : list(map(int, stdin.readline().split()))
n = iin()
s = input()
ans = 0
for i in range(n):
	x = int(s[i])
	if x % 2 == 0:
		ans += i + 1
print(ans)


n = int(input())
a = input()
res = 0
for (i, v) in enumerate(a):
	if v in '2468':
		res += i + 1
print(res)


a = input()
s = input()
ans = 0
k = 1
for i in s:
	if int(i) % 2 == 0:
		ans += k
	k += 1
print(ans)


n = int(input())
s = str(input())
count = 0
x = 1
for i in s:
	if int(i) % 2 == 0:
		count = count + s.index(i) + x
		x = x + len(s[:s.index(i)]) + 1
		s = s[s.index(i) + 1:]
print(count)


n = int(input())
a = input()
b = 1
total = 0
for i in a:
	if int(i) % 2 == 0:
		total = total + b
	b += 1
print(total)