Destiny
InterviewTime limit1sMemory limit1024 MB
Count the left-right sock pairs whose colors differ, given X left socks, X right socks, and K possible colors.
Problem
Dongwon has socks. Socks through are for the left foot, and socks through are for the right foot.
There are sock colors, called color , color , , color . The color of the -th sock is color .
Dongwon wants to wear one left sock and one right sock. The two socks must have different colors. How many ways can Dongwon put on socks this way?
Input
The first line contains and , separated by a space.
The second line contains integers , separated by spaces.
Output
Print the number of ways Dongwon can put on a left sock and a right sock so that their colors differ. The answer can exceed the range of a 32-bit integer.
Constraints
- ()