414 - Algebraic Expression (I)
Algebraic Expression (I)
Time Limit: 1 sec
The Problem
If a + b + c = X and ab + bc + ac = Y, what is the value of (a+b)2 + (b+c)2 + (c+a)2 ?
Example
if a + b + c = 10 and ab + bc + ac = 20 then
(a+b)2 + (b+c)2 + (c+a)2 = 160
The Input
Input file contain a series of line, each line contains two integer numbers X and Y (0<X,Y<1000).
The Output
For each line of input, output will show one integer numbesr which the value of (a+b)2 + (b+c)2 + (c+a)2 in a separate line.
Sample Input
2 1
3 2
3 9
Sample Output
6
14
0
Problem Setter: Shahin ShamS