Codeforces Round 308 (Div. 2)


A. Vanya and Table
time limit per test: 2 seconds
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
2
1 1 2 3
2 2 3 3
Output
10
Input
2
1 1 3 3
1 1 3 3
Output
18
----------------------------------------------------------------------------------------------------
B. Vanya and Books
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
13
Output
17
Input
4
Output
4
----------------------------------------------------------------------------------------------------
C. Vanya and Scales
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3 7
Output
YES
Input
100 99
Output
YES
Input
100 50
Output
NO
----------------------------------------------------------------------------------------------------
D. Vanya and Triangles
time limit per test: 4 seconds
memory limit per test: 512 megabytes
input: standard input
output: standard output

Examples
Input
4
0 0
1 1
2 0
2 2
Output
3
Input
3
0 0
1 1
2 0
Output
1
Input
1
1 1
Output
0
----------------------------------------------------------------------------------------------------
E. Vanya and Brackets
time limit per test: 1 second
memory limit per test: 256 megabytes
input: standard input
output: standard output

Examples
Input
3+5*7+8*4
Output
303
Input
2+3*5
Output
25
Input
3*4*5
Output
60
----------------------------------------------------------------------------------------------------
