Codeforces Round 334 (Div. 2)


A. Uncowed Forces
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
20 40 60 80 100
0 1 2 3 4
1 0
Output
4900
Input
119 119 119 119 119
0 0 0 0 0
10 0
Output
4930
----------------------------------------------------------------------------------------------------
B. More Cowbell
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1
2 5
Output
7
Input
4 3
2 3 5 9
Output
9
Input
3 2
3 5 7
Output
8
----------------------------------------------------------------------------------------------------
C. Alternative Thinking
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
8
10000011
Output
5
Input
2
01
Output
2
----------------------------------------------------------------------------------------------------
D. Moodular Arithmetic
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
Output
3
Input
5 4
Output
25
----------------------------------------------------------------------------------------------------
E. Lieges of Legendre
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2 1
3 4
Output
Kevin
Input
1 2
3
Output
Nicky
----------------------------------------------------------------------------------------------------
