p01560 Enumeration_28493
Given n integers a1, a2,…, an and n integers p1, p2,…, pn, integer m. The operation of selecting the kth integer ak with a probability of pk [%] is performed for each k (1 ≤ k ≤ n), and 0 or more and n or less integers are selected. Find the expected number of integers between 1 and m that are divisible by at least one of the selected integers.

Constraints

* 1 ≤ n ≤ 20

* 1 ≤ m ≤ 1018

* 1 ≤ ak ≤ 1018 (1 ≤ k ≤ n)

* 1 ≤ pk ≤ 99 (1 ≤ k ≤ n)

Input

The input is given in the following format.

> n m
> a1 a2… an
> p1 p2… pn
>

Output

Print the solution to the problem on one line. The output must not have an absolute or relative error of more than 0.0000001 (= 10-7).

Examples

Input

2 15
3 5
50 50


Output

3.75


Input

4 100
2 3 5 7
80 60 40 20


Output

57.352


Input

4 210
2 3 5 7
80 60 40 20


Output

119.9136
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time,copy,functools

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)


def main():
    n,m = LI()
    a = LI()
    p = [c / 100.0 for c in LI()]
    d = collections.defaultdict(lambda: 1.0)
    e = collections.defaultdict(lambda: 1)

    r = 0
    for k in range(1,1<<n):
        t = [i for i in range(n) if k & (1 << i)]
        l = k & (k-1)
        d[k] = d[l] * p[t[0]]
        e[k] = e[l] * a[t[0]] // fractions.gcd(a[t[0]], e[l])
        o = m // e[k]
        if len(t) % 2 == 1:
            r += o * d[k]
        else:
            r -= o * d[k]


    return '{:0.8f}'.format(r)


print(main())


2 15
3 5
50 50 4 100
2 3 5 7
80 60 40 20 4 210
2 3 5 7
80 60 40 20 2 15
3 5
50 72 4 100
1 3 5 7
80 60 40 20 4 210
2 2 5 7
80 60 40 20 2 15
3 5
32 72 4 100
1 3 8 7
80 60 40 20 2 210
2 2 5 7
80 60 40 20 2 15
3 5
32 64 4 100
1 3 14 7
80 60 40 20 2 115
2 2 5 7
80 60 40 20 2 7
3 5
32 64 0 100
1 3 14 7
80 60 40 20 2 115
3 2 5 7
80 60 40 20 2 115
3 2 5 12
80 60 40 20 2 115
2 2 5 12
80 60 40 20 2 115
2 2 0 12
80 60 40 20 2 115
2 2 -1 12
91 60 40 20 2 2
2 2 -1 12
91 60 40 20 2 2
2 2 -2 12
91 60 40 20 1 2
2 2 -2 12
45 60 40 41 2 15
1 5
50 50 4 100
1 3 5 7
80 60 40 40 4 210
2 2 5 7
80 14 40 20 2 15
3 5
52 72 4 100
1 3 1 7
80 60 40 20 2 210
3 2 5 7
80 60 40 20 2 15
3 5
32 51 4 100
1 3 14 1
80 60 40 20 2 7
3 5
32 78 2 115
5 2 5 7
80 60 40 20 3 115
3 2 5 12
80 60 40 20 1 100
1 3 14 7
80 60 40 79 2 16
2 2 0 12
80 60 40 20 2 115
2 2 0 13
91 60 40 20 2 2
1 2 -2 12
23 60 40 20 2 2
2 2 -2 7
45 60 40 20 2 15
1 7
50 50 2 15
3 5
52 57 4 100
1 3 1 7
80 39 40 20 4 101
1 3 14 1
80 60 40 20 2 196
2 2 5 7
80 25 40 20 2 115
5 2 10 7
80 60 40 20 2 187
2 2 5 12
80 46 40 20 2 26
2 2 0 12
80 60 40 20 2 115
2 2 -1 24
91 60 40 23 2 15
1 7
59 50 4 100
1 3 5 13
80 60 40 19 2 15
3 1
52 57 4 100
1 3 2 7
80 39 40 20 4 111
1 3 14 1
80 60 40 20 1 196
2 2 5 7
80 25 40 20 2 7
3 5
3 78 2 115
5 2 10 4
80 60 40 20 2 187
1 2 5 12
80 46 40 20 2 15
1 7
59 64 4 100
1 5 5 13
80 60 40 19 2 15
3 1
52 78 2 7
2 5
3 78 2 204
1 2 5 12
80 46 40 20 2 115
2 4 0 13
91 118 40 32 2 115
2 2 -1 17
91 43 40 23 2 15
2 7
59 64 4 100
1 5 5 13
80 16 40 19 1 15
3 1
52 78 2 12
2 5
3 78 3 115
3 2 5 12
80 55 55 2 2 204
1 2 3 12
80 46 40 20 2 26
3 2 0 24
29 60 40 20 2 115
3 2 -1 17
91 43 40 23 2 2
1 2 -2 3
23 60 84 20 1 2
2 4 -3 12
45 126 40 34 4 100
2 5 5 13
80 16 40 19 2 12
2 5
3 130 2 115
5 2 10 1
80 98 40 12 3 207
3 2 5 12
80 55 55 2 4 100
2 5 10 13
80 16 40 19 2 12
2 5
3 241 2 115
6 2 10 1
80 98 40 12 2 115
1 6 0 13
162 118 40 32 2 115
3 2 -2 17
91 66 40 23 4 100
2 5 10 13
80 28 40 19 1 11
3 1
13 29 2 12
4 5
3 241 3 38
3 2 5 12
80 55 55 3 4 100
3 5 10 13
80 28 40 19 2 21
4 5
3 241 2 115
3 2 10 1
80 98 79 12 3 38
3 4 5 12
80 55 55 3 2 104
3 2 -2 17
25 66 40 23 2 2
1 2 -2 6
23 17 84 49 4 100
3 6 10 13
80 28 40 19 2 21
4 5
6 241 3 12
3 4 5 12
80 55 55 3 2 2
1 2 -4 6
23 17 84 49 4 100
3 6 10 13
160 28 40 19 2 115
2 7 0 13
162 76 40 7 4 100
3 6 3 13
160 28 40 19 2 115
2 7 0 16
162 76 40 7 4 100
3 6 3 26
160 28 40 19 1 010
2 3 18 7
70 60 40 10 3 115
3 2 10 1
121 33 79 11
3.75 57.352 119.9136 4.300000000
 85.704000000
 108.652800000
 3.529600000
 85.176000000
 12.232500000
 3.315200000
 84.795200000
 6.640500000
 1.280000000
 0.000000000
 5.823500000
 8.626000000
 9.348000000
 6.840000000
 6.338400000
 0.111200000
 0.102400000
 0.020000000
 8.250000000
 86.136000000
 100.019520000
 4.385600000
 90.654400000
 10.727500000
 2.966800000
 87.539200000
 1.420000000
 5.101500000
 56.524800000
 3.000000000
 0.960000000
 7.410000000
 0.082400000
 0.051400000
 8.000000000
 4.013600000
 89.842960000
 88.379200000
 11.417000000
 6.213000000
 15.252000000
 1.560000000
 13.246800000
 9.260000000
 85.477200000
 9.668000000
 86.472880000
 97.163200000
 1.960000000
 0.840000000
 4.536000000
 19.952000000
 9.374800000
 83.277120000
 12.272000000
 0.870000000
 21.828000000
 3.640000000
 9.216900000
 5.032400000
 82.231152000
 0.050000000
 1.716600000
 55.842400000
 17.992800000
 3.120000000
 9.342300000
 -0.009400000
 0.040000000
 46.731760000
 2.741000000
 2.859000000
 100.624800000
 43.435600000
 4.927700000
 2.451000000
 2.470000000
 8.994600000
 44.756800000
 0.030000000
 4.910000000
 18.514800000
 33.817600000
 9.717700000
 4.351000000
 11.630000000
 8.217800000
 0.021200000
 31.284160000
 9.795400000
 3.884000000
 -0.017600000
 53.147520000
 2.080000000
 44.099552000
 2.560000000
 43.597952000
 0.150000000
 68.359879000
