P12875 [HackerEarth] utkarsh and faulty rain gauge february easy 1
普及
题目描述

Utkarsh is going to Cherrapunji to visit his brother Saharsh. Cherrapunji faces one of largest rainfall in the country. So, Saharsh and Utkarsh decided to measure this rainfall by T Rain Gauges. They were going to measure it by taking the product of the readings of all the gauges. But, they found out that the gauges were not working properly and were producing random values. The brothers want to know what will be the expected result of the experiment.

The i^th Rain Gauge has a least count of 1/Ri units. It has Ni divisions on its surface. Formally, it can give any reading from the set {0, 1/Ri , 2/Ri , ... ,Ni/Ri}. It gives a reading x with a probability proportional to x^2.
Input Format:
The first line contains the integer T.
T lines follow each containing 2 integers - Ni and Ri.
Output format:
Print the answer to the problem as real number exactly 4 decimal places. It is guaranteed that the answer is always less than 10^9.
Constraints:
1 ≤ T ≤ 10^3
1 ≤ Ni ≤ 10^3
1 ≤ Ri ≤ 10^3

NOTE:
A function p(x) is said to be proportional to x^2 means p(x) = ax^2 for some non negative a.
All the rain gauges produce values independently from each other.

SAMPLE INPUT
2
2 4
2 5

SAMPLE OUTPUT
0.1620

Explanation

First gauge produces output
1/4 with probability = 0.2
2/4 with probability = 0.8

Second gauge produces output
1/5 with probability = 0.2
2/5 with probability = 0.8

The product is 1/4 * 1/5 ( = 0.05) with a probability of 0.2 * 0.2 ( = 0.04)
The product is 1/4 * 2/5 ( = 0.1) with a probability of 0.2 * 0.8 ( = 0.16)
The product is 2/4 * 1/5 ( = 0.1) with a probability of 0.8 * 0.2 ( = 0.16)
The product is 2/4 * 2/5 ( = 0.2) with a probability of 0.8 * 0.8 ( = 0.64)

Therefore the result is
0.05 with probability = 0.04
0.1 with probability = .016+0.16 = 0.32
0.2 with probability = 0.64

The Expected Result is therefore = 0.05 * 0.04 + 0.1 * 0.32 + 0.2 * 0.64 = 0.1620

输入格式

见题面

输出格式

见题面

样例输入
2 2 4 2 5 SAMPLE
样例输出
0.1620