We need to determine parity of n given base b and digits a1..ak.
We need to check if n mod 2 is 0 (even) or 1 (odd). So we need to compute n mod 2.
Observation: Since modulo 2, we can reduce each term modulo 2. For each digit a_i multiplied by b^{k-i}. Parity depends on parity of each term. Specifically, n mod 2 = (sum over i of a_i * (b^{k-i} mod 2)) mod 2.
Now b^{k-i} mod 2 depends on whether b is even or odd.
If b is even, then b mod 2 = 0, so b^{positive exponent} is even, so b^{k-i} mod 2 = 0 for all exponents >=1. However, careful: For the last digit a_k, exponent is 0? Actually term: a_i * b^{k-i}, where exponent = k-i. For i = k, exponent = 0, b^0 = 1. So only the last term (a_k) contributes to parity when b is even (since all higher exponents yield even multiples). But if k=1, then only a1 term with exponent 0 (since k-i = 0). So for even b, n mod 2 = a_k mod 2 (since only term with exponent 0 matters). But wait: what about a_i times b^{k-i} when exponent > 0: since b even, b^{positive} is even, so product even regardless of a_i parity. So yes, only a_k contributes.
If b is odd, then b mod 2 = 1, so any power of b is odd (since odd*odd=odd). So b^{k-i} mod 2 = 1 for all exponents. Then n mod 2 = (sum over i of a_i) mod 2. Because each term a_i * 1 mod 2 = a_i mod 2.
Thus solution: If b % 2 == 0: n parity = a_k % 2. Else: n parity = (sum of all digits) % 2.
But is there any nuance with leading zeros? The representation has no unnecessary leading zero, but a1 can be 0 if k=1. That's fine.
Check sample: 13 b=13 odd, so sum digits = 3+2+7=12 even => n even => matches.
Second: b=10 even => last digit a_k=9 odd => odd => matches.
Third: b=99 odd? 99 is odd? Actually 99 is odd. So sum digits = 32+92+85+74+4 = 287? Let's compute: 32+92=124, +85=209, +74=283, +4=287. 287 mod2=1 => odd. matches.
Fourth: b=2 even => last digit a_k = 0 => even => matches.
Edge cases: k can be 1, then only digit a1, b even or odd both reduce to a1 mod2? Let's see: For even b, last digit = a1, parity = a1 mod2. For odd b, sum = a1 mod2. So consistent.
Therefore simple O(k) solution.
Implementation: read b,k, read array of length k, compute as above.
Potential large k up to 1e5, reading digits with space separated.
Write output "even" or "odd".
Thus solution straightforward.
But hold on: What about b being 0? b>=2, fine.
Thus answer.
Double-check: b even => b^{k-i} for i<k is divisible by 2, but if exponent 0 (i=k) it's 1. So only a_k matters.
But is there any case where b is even but exponent 0 occurs for multiple terms? No only i=k yields exponent 0.
Thus solution correct.
Therefore final answer: print "even" if parity is 0 else "odd".
I'll produce code. ```python
import sys
def main():
data = sys.stdin.read().strip().split()
if not data:
return
b = int(data[0])
k = int(data[1])
# read the digits: there are k of them, they start at index 2
# ensure we have exactly k digits
digits = list(map(int, data[2:2+k]))
if b % 2 == 0:
# only the last digit matters
parity = digits[-1] % 2
else:
# sum of all digits mod 2
parity = sum(digits) % 2
print("even" if parity == 0 else "odd")
if name == "main":
main()