As usual Gary and Flo are sitting at their favourite burger restaurant called Jim's Burgers. They want to treat themselves with delicious burger after an interesting day with lots of competitive programming. So they have ordered their burgers and are waiting for them. But with nothing to do, they get bored and decide to play a game.

The game is played on a sheet of paper with $n$ rows and $m$ columns and goes as follows: 

Flo places his white lotus tile somewhere at the top row and Gary places a caterpillar tile somewhere on the bottom row. Flo begins the game and their turns alternate. Flo can move his tile to any of the 8 adjacent cells, while Gary's caterpillar tile can only move  left or right, or stay at the same cell. Of course, they cannot step outside of the grid. Flo's goal is to catch Gary as fast as possible, that is, with the minimum number of moves, while Gary (with the caterpillar tile) has to survive for as long as possible.  

Now they are wondering: If they place their tiles in the corresponding rows and some random columns, what is the expected number of moves Flo has to make to win the game (assuming they will play optimally)? 

Can you help them answer this question?

Constraints

$2\leq n,m\leq5000$

Input Format

You will be given two space separated integers $n$ and $m$, denoting the number of rows and the number of columns on the board respectively. 

Output Format

Output the answer in one line. 

Note: The answer will be considered valid if it differs from the correct answer by at most $\mathbf{10^{-6}}$.

Sample input

2 3

Sample output

1.2222222

Consider the pair $(x,y)$ as the starting column of the lotus and the starting column of the caterpillar respectively. 

For $n=2$ and $m=3$ we get the following scenario. 

$(1,1),(1,2),(2,1),(2,2),(2,3),(3,2),(3,3)$ will lead to 1 move. 
The remaining pairs $(1,3)$ and $(3,1)$ will lead to 2 moves. So the expected value  is $\frac{1+1+1+1+1+1+1+2+2}{9}=1.222..$

Difficulty: MEDIUM
Tags: Probability

Starter code:

Solutions:
(n, m) = [int(i) for i in input().split(' ')]

def expected_value(n, m):
	if m <= n:
		return n - 1
	if n < m:
		out = 2 * m * (m ** 2 - 3 * m + 2) + (n - 3) * (n - 2) * (n - 1)
		out /= 3
		out += m * (n - 1) + 2 * (m - 1) * (n - 1)
	return out / m ** 2
print(expected_value(n, m))


(n, m) = map(int, input().split())
if m == 1:
	print(n - 1)
else:
	res = (n - 1) * 2 * 2 + (n - 1) * 3 * (m - 2)
	for i in range(2, m):
		res += max(n - 1, i) * (i - 1) * 2
	print(res / m ** 2)


def s(k):
	return k * (k + 1) // 2
(n, m) = (int(a) for a in input().split())
s = (n - 1) * m ** 2
m0 = m - 1
for x in range(m):
	s += max(x - 1, 0) * max(x - (n - 1), 0)
	s += max(m0 - (x + 1), 0) * max(m0 - (x + (n - 1)), 0)
print(s / m ** 2)


(n, m) = map(int, input().split())
if n >= m:
	print(n - 1)
else:
	r = 0
	si = 0
	for s in range(1, m - 1):
		si += 3 * (n - 1) + (s - 1) * max(s, n - 1) + (m - s - 2) * max(n - 1, m - 1 - s)
	easy = 2 * (2 * (n - 1) + (m - 2) * (m - 1))
	print((easy + si) / m ** 2)


(n, m) = map(int, input().split())
if n >= m:
	print(n - 1.0)
else:
	print((((2 * m - 6) * m + 9 * n - 5) * m + ((n - 6) * n + 5) * n) / (3 * m * m))


(n, m) = map(int, input().split())
if n >= m:
	print(n - 1)
else:
	print(n - 1 + (m - n) * (m - n + 1) * (2 * m + n - 5) / 3 / m ** 2)


(n, m) = [int(i) for i in input().split(' ')]

def expected_value(n, m):
	if m <= n:
		return n - 1
	if n < m:
		out = 2 * m * (m ** 2 - 3 * m + 2) + (n - 3) * (n - 2) * (n - 1)
		out /= 3
		out += m * (n - 1) + 2 * (m - 1) * (n - 1)
	return out / m ** 2
print(expected_value(n, m))


(n, m) = [int(i) for i in input().split(' ')]

def expected_value(n, m):
	if m <= n:
		return n - 1
	if n < m:
		out = 2 * m * (m ** 2 - 3 * m + 2) + (n - 3) * (n - 2) * (n - 1)
		out /= 3
		out += m * (n - 1) + 2 * (m - 1) * (n - 1)
	return out / m ** 2
print(expected_value(n, m))


(n, m) = [int(i) for i in input().split(' ')]

def expected_value(n, m):
	if m <= n:
		return n - 1
	if n < m:
		out = 2 * m * (m ** 2 - 3 * m + 2) + (n - 3) * (n - 2) * (n - 1)
		out /= 3
		out += m * (n - 1) + 2 * (m - 1) * (n - 1)
	return out / m ** 2
print(expected_value(n, m))


(n, m) = [int(i) for i in input().split(' ')]

def expected_value(n, m):
	if m <= n:
		return n - 1
	if n < m:
		out = 2 * m * (m ** 2 - 3 * m + 2) + (n - 3) * (n - 2) * (n - 1)
		out /= 3
		out += m * (n - 1) + 2 * (m - 1) * (n - 1)
	return out / m ** 2
print(expected_value(n, m))


(n, m) = [int(i) for i in input().split(' ')]

def expected_value(n, m):
	if m <= n:
		return n - 1
	if n < m:
		out = 2 * m * (m ** 2 - 3 * m + 2) + (n - 3) * (n - 2) * (n - 1)
		out /= 3
		out += m * (n - 1) + 2 * (m - 1) * (n - 1)
	return out / m ** 2
print(expected_value(n, m))