问题1082--Maximum

1082: Maximum

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 64 MB

题目描述

Let x1, x2, …, xm be real numbers satisfying the following conditions:

输入

Each input line contains four integers: m, p, a, b (m <= 2000, p <= 12, p is even).Input is correct, i.e. for each input numbers there exists x1, x2, …, xm satisfying the given conditions.

输出

For each input line print one number – the maximum value of expression, given above. The answer must be rounded to the nearest integer.

样例输入 Copy

1997 12 3 -318
10 2 4 -1

样例输出 Copy

189548
6