Natasha is going to fly on a rocket to Mars and return to Earth. Also, on the way to Mars, she will land on $n - 2$ intermediate planets. Formally: we number all the planets from $1$ to $n$. $1$ is Earth, $n$ is Mars. Natasha will make exactly $n$ flights: $1 \to 2 \to \ldots n \to 1$.

Flight from $x$ to $y$ consists of two phases: take-off from planet $x$ and landing to planet $y$. This way, the overall itinerary of the trip will be: the $1$-st planet $\to$ take-off from the $1$-st planet $\to$ landing to the $2$-nd planet $\to$ $2$-nd planet $\to$ take-off from the $2$-nd planet $\to$ $\ldots$ $\to$ landing to the $n$-th planet $\to$ the $n$-th planet $\to$ take-off from the $n$-th planet $\to$ landing to the $1$-st planet $\to$ the $1$-st planet.

The mass of the rocket together with all the useful cargo (but without fuel) is $m$ tons. However, Natasha does not know how much fuel to load into the rocket. Unfortunately, fuel can only be loaded on Earth, so if the rocket runs out of fuel on some other planet, Natasha will not be able to return home. Fuel is needed to take-off from each planet and to land to each planet. It is known that $1$ ton of fuel can lift off $a_i$ tons of rocket from the $i$-th planet or to land $b_i$ tons of rocket onto the $i$-th planet. 

For example, if the weight of rocket is $9$ tons, weight of fuel is $3$ tons and take-off coefficient is $8$ ($a_i = 8$), then $1.5$ tons of fuel will be burnt (since $1.5 \cdot 8 = 9 + 3$). The new weight of fuel after take-off will be $1.5$ tons. 

Please note, that it is allowed to burn non-integral amount of fuel during take-off or landing, and the amount of initial fuel can be non-integral as well.

Help Natasha to calculate the minimum mass of fuel to load into the rocket. Note, that the rocket must spend fuel to carry both useful cargo and the fuel itself. However, it doesn't need to carry the fuel which has already been burnt. Assume, that the rocket takes off and lands instantly.


-----Input-----

The first line contains a single integer $n$ ($2 \le n \le 1000$) — number of planets.

The second line contains the only integer $m$ ($1 \le m \le 1000$) — weight of the payload.

The third line contains $n$ integers $a_1, a_2, \ldots, a_n$ ($1 \le a_i \le 1000$), where $a_i$ is the number of tons, which can be lifted off by one ton of fuel.

The fourth line contains $n$ integers $b_1, b_2, \ldots, b_n$ ($1 \le b_i \le 1000$), where $b_i$ is the number of tons, which can be landed by one ton of fuel. 

It is guaranteed, that if Natasha can make a flight, then it takes no more than $10^9$ tons of fuel.


-----Output-----

If Natasha can fly to Mars through $(n - 2)$ planets and return to Earth, print the minimum mass of fuel (in tons) that Natasha should take. Otherwise, print a single number $-1$.

It is guaranteed, that if Natasha can make a flight, then it takes no more than $10^9$ tons of fuel.

The answer will be considered correct if its absolute or relative error doesn't exceed $10^{-6}$. Formally, let your answer be $p$, and the jury's answer be $q$. Your answer is considered correct if $\frac{|p - q|}{\max{(1, |q|)}} \le 10^{-6}$.


-----Examples-----
Input
2
12
11 8
7 5

Output
10.0000000000

Input
3
1
1 4 1
2 5 3

Output
-1

Input
6
2
4 6 3 3 5 6
2 6 3 6 5 3

Output
85.4800000000



-----Note-----

Let's consider the first example.

Initially, the mass of a rocket with fuel is $22$ tons. At take-off from Earth one ton of fuel can lift off $11$ tons of cargo, so to lift off $22$ tons you need to burn $2$ tons of fuel. Remaining weight of the rocket with fuel is $20$ tons. During landing on Mars, one ton of fuel can land $5$ tons of cargo, so for landing $20$ tons you will need to burn $4$ tons of fuel. There will be $16$ tons of the rocket with fuel remaining. While taking off from Mars, one ton of fuel can raise $8$ tons of cargo, so to lift off $16$ tons you will need to burn $2$ tons of fuel. There will be $14$ tons of rocket with fuel after that. During landing on Earth, one ton of fuel can land $7$ tons of cargo, so for landing $14$ tons you will need to burn $2$ tons of fuel. Remaining weight is $12$ tons, that is, a rocket without any fuel.

In the second case, the rocket will not be able even to take off from Earth.

Difficulty: competition

Starter code:

Solutions:
#      
import collections, atexit, math, sys
from functools import cmp_to_key
#key=cmp_to_key(lambda x,y: 1 if x not in y else -1 )

sys.setrecursionlimit(1000000)
def getIntList():
    return list(map(int, input().split()))    

import bisect 
try :
    #raise ModuleNotFoundError
    import numpy
    def dprint(*args, **kwargs):
        print(*args, **kwargs, file=sys.stderr)
    dprint('debug mode')
except ModuleNotFoundError:
    def dprint(*args, **kwargs):
        pass


def memo(func):  
    cache={}  
    def wrap(*args):  
        if args not in cache:  
            cache[args]=func(*args)  
        return cache[args]  
    return wrap

@memo
def comb (n,k):
    if k==0: return 1
    if n==k: return 1
    return comb(n-1,k-1) + comb(n-1,k)

inId = 0
outId = 0
if inId>0:
    dprint('use input', inId)
    sys.stdin = open('input'+ str(inId) + '.txt', 'r') #标准输出重定向至文件
if outId>0:
    dprint('use output', outId)
    sys.stdout = open('stdout'+ str(outId) + '.txt', 'w') #标准输出重定向至文件
    atexit.register(lambda :sys.stdout.close())     #idle 中不会执行 atexit
    
N, = getIntList()
M, = getIntList()
za = getIntList()
zb = getIntList()

if 1 in za or 1 in zb:
    print(-1)
    return
    

def trywork(fuel):
    for i in range(N):
        now = fuel + M
        cost = now / za[i]
        fuel-=cost
        if fuel <0: return False
        now = fuel +M
        cost = now / zb[ (i+1)%N]
        fuel-=cost
        if fuel<0: return False
    return True

r0 = 0
r1 = 10**9+1


while r1-r0 > 1e-7 and (r1-r0) *10000000 >r1:
    m = (r1+r0)/2
    f = trywork(m)
    if f:
        r1 = m
    else:
        r0 = m

print(r1)
    











from functools import reduce
n=int(input())
m=int(input())
a=input().split()
a=[int(x) for x in a]
b=input().split()
b=[int(x) for x in b]
k=m
y=1
for i in range(len(a)):
    k=k*a[i]*b[i]
a=[int(x)-1 for x in a]
b=[int(x)-1 for x in b]
for i in range(len(a)):
    y=y*a[i]*b[i]
if(y==0):
    print(-1)
else:
    print((k/y)-m)
    


input()
m=int(input())
v=m
try:
 for a in map(int, input().split() + input().split()):
   v*=a
   v/=a-1
 print(v-m)
except ZeroDivisionError:
 print(-1)

input()
m=int(input())
v=m
try:
 for a in map(int, input().split() + input().split()):
   v*=a/(a-1)
 print(v-m)
except ZeroDivisionError:
 print(-1)

i=input
i()
m=int(i())
v=m
try:
 for a in map(int, (i()+' '+i()).split()):v*=a/(a-1)
 print(v-m)
except:
 print(-1)

i=input
i()
m=int(i())
v=m
try:
 for a in map(int, (i()+' '+i()).split()):v*=a/(a-1)
except:v=m-1
print(v-m)

t=int(input())
mass=int(input())
arr=list(map(int,input().split()))
brr=list(map(int,input().split()))
flag=1
for i in range(t):
	if arr[i]==1 or brr[i]==1:
		flag=0
		break
if flag:
	ans=mass*brr[0]/(brr[0]-1)
	for i in range(t-1,0,-1):
		ans=ans*arr[i]/(arr[i]-1)
		ans=ans*brr[i]/(brr[i]-1)
	ans=ans*arr[0]/(arr[0]-1)
	print(ans-mass)
else:
	print("-1")

# -*- coding: utf-8 -*-
"""
Created on Thu Jul 26 20:46:22 2018

@author: chirayu jain
"""
#PROBLEM A FLY
#DIVISION 1 499 CODEFORCES
planet = int(input())
mass = int(input())
case = 0
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
for i in range(0,planet):
    if A[i] == 1 or B[i] == 1:
        case = 1
        break
if case==0:
   temp = mass*1.0
   temp = temp / (1.0 - 1.0/(1.0*B[0]))
   for i in range(planet-1,0,-1):
       temp = temp / (1.0 - 1.0/(A[i]*1.0))
       temp = temp / (1.0 - 1.0/(B[i]*1.0))
    
   temp = temp / (1.0 - 1.0/(A[0]*1.0))
   temp = temp - mass*1.0
if case==1:
    print("-1")
else:
    print(temp)

from decimal import *
getcontext().prec = 28
n,m=int(input()),int(input())
lift=list(map(int,input().split()))
drop=list(map(int,input().split()))
fuel=0
if drop[0]==1:
    print(-1);return()
else:
    r=Decimal(m)/Decimal(drop[0]-1)
    m+=r;fuel+=r
lift=lift[::-1];drop=drop[::-1]
for i in range(n-1):
    if lift[i]==1:
        print(-1);return()
    else:
        r=Decimal(m)/Decimal(lift[i]-1)
        m+=r;fuel+=r
    if drop[i]==1:
        print(-1);return()
    else:
        r=Decimal(m)/Decimal(drop[i]-1)
        m+=r;fuel+=r
if lift[n-1]==1:
    print(-1);return()
else:
    r=Decimal(m)/Decimal(lift[n-1]-1)
    m+=r;fuel+=r
print(fuel)

from decimal import *
getcontext().prec = 28
n,m=int(input()),int(input())
lift=list(map(int,input().split()))
drop=list(map(int,input().split()))
fuel=0
if drop[0]==1:
    print(-1);return()
else:
    r=Decimal(m)/Decimal(drop[0]-1)
    m+=r;fuel+=r
lift=lift[::-1];drop=drop[::-1]
for i in range(n-1):
    if lift[i]==1:
        print(-1);return()
    else:
        r=Decimal(m)/Decimal(lift[i]-1)
        m+=r;fuel+=r
    if drop[i]==1:
        print(-1);return()
    else:
        r=Decimal(m)/Decimal(drop[i]-1)
        m+=r;fuel+=r
if lift[n-1]==1:
    print(-1);return()
else:
    r=Decimal(m)/Decimal(lift[n-1]-1)
    m+=r;fuel+=r
print(fuel)



i=input
i()
m=int(i())
v=m
try:
 for a in map(int, (i()+' '+i()).split()):v*=a/(a-1)
except:v=m-1
print(v-m)

n = int(input())
m = int(input())
a = list(map(int, input().rstrip().split()))
b = list(map(int, input().rstrip().split()))
fuel_used = 0
for i in range(n-1):
	fuel_used += (1-fuel_used)/a[i]
	fuel_used += (1-fuel_used)/b[i+1]
fuel_used += (1-fuel_used)/a[n-1]
fuel_used += (1-fuel_used)/b[0]
try:
	fuel_required = m*(fuel_used)/(1-fuel_used)
	print(fuel_required)
except ZeroDivisionError:
	print(-1)

R = lambda: map(int, input().split())
n = int(input())
m = int(input())
a, b = list(R()), list(R())
b = b[1:] + b[:1]
l, r = 0, 2 * 10**9
while (r - l) / max(1, r) >= 1e-7 and l < 10**9 + 1:
    rem = mid = (l + r) / 2
    for i in range(n):
        rem -= (m + max(0, rem)) / a[i]
        rem -= (m + max(0, rem)) / b[i]
    if rem < 0:
        l = mid
    else:
        r = mid
print(l if l < 10**9 + 1 else -1)

def main():
    input()
    x = m = float(input())
    try:
        for s in input(), input():
            for a in map(float, s.split()):
                x *= a / (a - 1.)
        print(x - m)
    except ZeroDivisionError:
        print(-1)


def __starting_point():
    main()

__starting_point()

N = int(input())
M = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

imp = fuel = 0
for i in range(N, 0, -1):
    if i == N: i = 0
    if B[i] == 1:
        imp = 1
        break
    fuel += (M + fuel) / (B[i] - 1)
    if A[i - 1] == 1:
        imp = 1
        break
    fuel += (M + fuel) / (A[i - 1] - 1)
print(-1 if imp else '{:.7f}'.format(fuel))

import sys;
import math;


def solution( n, m, a, b):
    a += [a[0]];
    b += [b[0]];
    mass = [0] * len(a);
    mass[len(a)-1] = m;
    for i in range(len(a)-1, 0, -1):
        tmp = mass[i];
        if b[i]-1<=0:
            return -1;
        extra_fuel = tmp/(b[i]-1);
        tmp+=extra_fuel;
        if a[i-1]-1<=0:
            return -1;
        extra_fuel = tmp/(a[i-1]-1);
        tmp+=extra_fuel;
        mass[i-1] = tmp;

    return mass[0] - m;

n = int(sys.stdin.readline().rstrip() );
m = int(sys.stdin.readline().rstrip() );

a = [ int(x) for x in sys.stdin.readline().rstrip().split() ];
b = [ int(x) for x in sys.stdin.readline().rstrip().split() ];

res = solution( n, m, a, b );

sys.stdout.write(str(res));



i=input
i()
m=int(i())
v=m
try:
 for a in map(int, (i()+' '+i()).split()):v*=a/(a-1)
except:v=m-1
print(v-m)

import sys

def __starting_point():
	n = int(sys.stdin.readline().strip())
	m = int(sys.stdin.readline().strip())
	eps = 2e-7
	off, land = [], []
	off = list(map(int,sys.stdin.readline().strip().split(' ')))
	land = list(map(int,sys.stdin.readline().strip().split(' ')))
	if 1 in off or 1 in land:
		print(-1)
	else:
		l, r = 0, 10**9
		#print (10/3)
		def is_ok(target):
			total = m + target
			remain = total
			for i in range(n):
				remain -= remain/off[i]
				#print (remain)
				if remain < m and abs(remain - m) > eps:
					return False
				remain -= remain / land[(i+1)%n]
				#print (remain)
				if remain < m and abs(remain - m) > eps:
					return False
			return True
		#is_ok(6)
		while True:
			mid = (l + r) / 2
			if abs(r-l) <= eps:
				print (mid)
				break
			if is_ok(mid):
				r = mid
			else:
				l = mid


__starting_point()

n = int(input())
m = int(input())
a = list(map(float, input().split()))
b = list(map(float, input().split()))
if 1 in a or 1 in b:
    print(-1)
    return
payload = m
payload += payload / (a[0] - 1)
for i in range(n - 1, 0 , -1):
    payload += payload / (a[i] - 1)
    payload += payload / (b[i] - 1)
payload += payload / (b[0] - 1)
print(payload - m)


n=int(input())
m=int(input())
a=list(map(float,input().split()))
b=list(map(float,input().split()))
i=n
f=0
while i>=1 :
    if (a[i-1] != 1) and (b[i-1] != 1) :
        f=(1/(1- 1/a[i-1]))*(f+(m/a[i-1]))
        f=(1/(1- 1/b[i-1]))*(f+(m/b[i-1]))
        i-=1
    else :
        break
if f<=(10**9) and i==0 :
    print(f)
else :
    print(-1)



rd = lambda: list(map(int, input().split()))
n, m = rd(), rd()[0]
r = m
for x in rd() + rd():
    if x > 1:
        r *= x
        r /= x - 1
    else:
        print(-1)
        return
print(r - m)


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

def check(t):
    for i in range(n):
        t -= (t + m) / a[i]
        if t < 0:
            return 0
        t -= (t + m) / b[(i + 1) % n]
        if t < 0:
            return 0
    return 1

l, r = 0, 10 ** 10
if not check(r):
    print(-1)
else:
    for i in range(300):
        mid = (l + r) / 2
        if check(mid):
            r = mid
        else:
            l = mid
    print(l)


n = int(input())
m = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
b = b[1:]+b[0:1]
c = m
d = 0
for i in range(n):
    k = n-1-i
    if b[k] <= 1 or a[k] <= 1:
        d = -1
    else:
        c = c*(1+1/(b[k]-1))*(1+1/(a[k]-1))
if d == -1:
    print(d)
else:
    print(c-m)

import sys

n = int(input())
m = float(input())
a = list(map(float,input().split()))
b = list(map(float,input().split()))

for i in a:
	if i <= 1.0:
		print(str(-1))
		return
for i in b:
	if i <= 1.0:
		print(str(-1))
		return

s = m
s += s/(b[0] - 1.0)

for i in range(n-1,0,-1):
	s += s/(a[i] - 1.0)
	s += s/(b[i] - 1.0)

s += s/(a[0] - 1.0)
print("{0:.10f}".format(s - m))

i=input

i()

m=int(i())

v=m

try:

 for a in map(int, (i()+' '+i()).split()):v*=a/(a-1)

except:v=m-1

print(v-m)



# Made By Mostafa_Khaled