Codeforces Round 456 (Div. 2)


A. Tricky Alchemy
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
2 1 1
Output
2
Input
3 9
1 1 3
Output
1
Input
12345678 87654321
43043751 1000000000 53798715
Output
2147483648
----------------------------------------------------------------------------------------------------
B. New Year's Eve
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
4 3
Output
7
Input
6 6
Output
7
----------------------------------------------------------------------------------------------------
C. Perun, Ult!
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 2
1000 10 50
70 5 5
90 70 1
110 20 2
20 2 10
30 3 10
Output
3000
Input
1 1
500 50 1000
750 750 20
10 1 300
Output
-1
----------------------------------------------------------------------------------------------------
D. Fishes
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 3 2 3
Output
2.0000000000
Input
12 17 9 40
Output
32.8333333333
----------------------------------------------------------------------------------------------------
E. Prime Gift
time limit per test: 3.5 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3
2 3 5
7
Output
8
Input
5
3 7 11 13 31
17
Output
93
----------------------------------------------------------------------------------------------------
