Largest Point

Time Limit: 1000ms
Memory Limit: 32768KB
This problem will be judged on HDU. Original ID: 5461
64-bit integer IO format: %I64d      Java class name: Main

Description

Given the sequence $A$ with $n$ integers $t_1,t_2,\cdots,t_n$. Given the integral coefficients $a$ and $b$. The fact that select two elements $t_i$ and $t_j$ of $A$ and $i\neq j$ to maximize the value of $a t_i^2 + b t_j$, becomes the largest point.

Input

An positive integer $T$, indicating there are $T$ test cases.
For each test case, the first line contains three integers corresponding to $n~(2\le n\le 5\times 10^6),~a~(0\le |a|\le 10^6)$ and $b~(0\le |b|\le 10^6)$. The second line contains $n$ integers $t_1,t_2,\cdots,t_n$ where $0\le |t_i|\le 10^6$ for $1\le i\le n$.

The sum of $n$ for all cases would not be larger than $5 \times 10^6$.

Output

The output contains exactly $T$ lines.
For each test case, you should output the maximum value of $a t_i^2 + b t_j$.

Sample Input

2

3 2 1
1 2 3

5 -1 0
-3 -3 0 3 3

Sample Output

Case #1: 20
Case #2: 0

Source

Language: 
Theme: 
Share Code? 

Powered by NB231 | Current Style: .