Division problem - MarisaOJ: Marisa Online Judge

Division problem

Time limit: 2000 ms
Memory limit: 256 MB
Given a set A consisting of n distinct integers. There are n×(n−1)×(n−2) ways to choose three integers a,b,c from the set. Calculate the sum of ⌊ab⌋⌊ac⌋⌊bc⌋ for all ways to choose three integers a,b,c. ### Input - The first line contains an integer n. - The second line contains n distinct integers in the set a. ### Output - Print the sum of ⌊ab⌋⌊ac⌋⌊bc⌋ modulo 232 for all choices. ### Constraints - 1≤n≤5000. - The elements are positive integers not exceeding 5000. ### Example Input: 41234 Output: 36