There are N electrons present in the coordinate plane. For each electron, you have been given three values Xi,Yi and Ki, where Xi and Yi denotes X coordinate and Y coordinates of electron in the plane and Ki denotes the self - potential energy of ith electron if other electron weren't present in the plane. You have to calculate potential energy of this system of electrons which is given by following formula: ∑i=Ni=1∑j=Nj=1Ki∗Kj∗DIST(i,j)
DIST(i,j) denotes floor of euclidean distance between ith and jth electron. That is, DIST(i,j)=⌊√(Xi−Xj)2+(Yi−Yj)2⌋ where ⌊⌋ denotes floor function.
Since electrons are very small in size, there can be more than one electron present at a point.
INPUT:
First line will consists of integer N denoting total number of electrons. Next N lines will consists of three integers Xi,Yi,Ki.
OUTPUT:
Output potential energy of this system of electrons. Since output can be large print it modulo 109+7.
CONSTRAINTS:
1≤N≤106
1≤Xi,Yi,Ki≤500
The potential energy of this system of electrons =
(K1∗K1∗0)+(K1∗K2∗1)+ (K1∗K3∗2)+(K2∗K1∗1)+ (K2∗K2∗0)+(K2∗K3∗1)+ (K3∗K1∗2)+(K3∗K2∗1)+ (K3∗K3∗0)=32.