Ants

5

1 votes
Hard
Problem

Ants are known to be hard working creatures. There are N sugar cubes lying on x axis. No two cubes lie on same point. Ant is initially at point 0. Ant wants to pick all the cubes. When it picks the last cube, it doesn’t go back to point 0.

Ant now thinks that there are lots of ways to pick all the cubes. In each way, she has to travel some distance.

Ant wants to know the average distance of travel, if she collects the cubes in all possible ways.

 

INPUT

First line contains the integer N, denoting number of sugar cubes.

Next line contains N integers, coordinates of sugar cubes.

 

OUTPUT

Out numerator and denominator of the required average. GCD of numerator and denominator should be 1.

 

CONSTRAINTS

2<=N<=105

1<=coordinates of cubes<=107

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

There are 6 possible routes:

1- [2,3,5], total distance : 5

2- [2,5,3], total distance : 7

3- [3,2,5], total distance : 7

4- [3,5,2], total distance : 8

5- [5,2,3], total distance : 9

6- [5,3,2], total distance : 8

So, average distance is 44/6 = 22/3

Editor Image

?