Naruto has started training from Jiraiya to develop the most powerful Rasengan attack. Jiraiya as always uses weird training exercises.
Jiraiya has brought a permutation P of integers. He tells Naruto to sort the permutation using minimum number of Rasengan attacks. In one Rasengan attack Naruto can choose any pair of consecutive elements of the permutation and swap it.
To make the task a little difficult, he chooses a subsegment of the permutation uniformly at random (L ≤ R) and reverses it to make . Now he asks Naruto to tell the expected number of Rasengan attacks he need to sort the permutation.
INPUT
The first line contains the integer N.
The next line contains N integers denoting the permutation P.
OUTPUT
Print where is the Expected value of number of Rasengan attacks he need to sort P (expressed as an irreducible fraction)
CONSTRAINTS
The 6 ways of reversing a subarray is
Probability of getting Rasengan attacks = 0 is
Probability of getting Rasengan attacks = 1 is
Probability of getting Rasengan attacks = 3 is
Expected value of Rasengan attacks =