A. Golden Alleyway
time limit per test
1 second
memory limit per test
1024 megabytes
input
standard input
output
standard output

Please refer to the statements in the attachment files

Input

Please refer to the statements in the attachment files

Output

Please refer to the statements in the attachment files

Examples
Input
3 2 1 2
Output
7000
Input
1 0 0 4
Output
6000
Note

Please refer to the statements in the attachment files