Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

import numpy as np

N = int(input())
a = []
b = []
c = np.array([[0]*26]*N)
count = 0
for i in range(N):
    a.append(input())

for i in range(N):
    b = a[i]
    for j in range(10):
        if b[j] == 'a':
            c[i][0] +=1
        elif b[j] == 'b':
            c[i][1] +=1
        elif b[j] == 'c':
            c[i][2] +=1
        elif b[j] == 'd':
            c[i][3] +=1
        elif b[j] == 'e':
            c[i][4] +=1
        elif b[j] == 'f':
            c[i][5] +=1
        elif b[j] == 'g':
            c[i][6] +=1
        elif b[j] == 'h':
            c[i][7] +=1
        elif b[j] == 'i':
            c[i][8] +=1
        elif b[j] == 'j':
            c[i][9] +=1
        elif b[j] == 'k':
            c[i][10] +=1
        elif b[j] == 'l':
            c[i][11] +=1
        elif b[j] == 'm':
            c[i][12] +=1
        elif b[j] == 'n':
            c[i][13] +=1
        elif b[j] == 'o':
            c[i][14] +=1
        elif b[j] == 'p':
            c[i][15] +=1
        elif b[j] == 'q':
            c[i][16] +=1
        elif b[j] == 'r':
            c[i][17] +=1
        elif b[j] == 's':
            c[i][18] +=1
        elif b[j] == 't':
            c[i][19] +=1
        elif b[j] == 'u':
            c[i][20] +=1
        elif b[j] == 'v':
            c[i][21] +=1
        elif b[j] == 'w':
            c[i][22] +=1
        elif b[j] == 'x':
            c[i][23] +=1
        elif b[j] == 'w':
            c[i][24] +=1
        elif b[j] == 'z':
            c[i][25] +=1
for i in range(N):
    for j in range(1,N):
        if i < j:
            if c[i].all!=0:
                if c[j].all!=0:
                    if (c[i] == c[j]).all():
                        count += 1
    
print(count)

### FIXED CODE ###

N = int(input())
s = list(list(input())for i in range(N))
count = 1
ans = 0
for i in range(N):
    s[i].sort()
s.sort()
for i in range(0,N-1):
    if s[i] == s[i+1]:
        ans += count
        count += 1
    else:
        count = 1
print(ans)
### BUGGY CODE ###

n = int(input())
s = input()
ans = n
for i in range(n):
    ans = min(ans, s[:i].count('W')+s[i+1:].count('E'))
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
all_w = s.count('W')
all_e = s.count('E')
left_w = 0
right_e = all_e
ans = left_w + right_e
for i in range(n):
    if s[i] == 'E':
        right_e -= 1
    ans = min(ans, left_w + right_e)
    if s[i] == 'W':
        left_w += 1
print(ans)
### BUGGY CODE ###

def get_char_ngram(n, s):
    char_gram = [''.join(s[i:i+n]) for i in range(len(s)-n+1)]
    return char_gram

s = input()
K = int(input())
res = set()
for i in range(1, len(s)+1):
    tmp = set(get_char_ngram(i, s))
    res = res.union(tmp)
res = sorted(list(res))
print(res[K-1])

### FIXED CODE ###

def get_char_ngram(n, s):
    char_gram = [''.join(s[i:i+n]) for i in range(len(s)-n+1)]
    return char_gram

s = input()
K = int(input())
res = set()
for i in range(1, K+1):
    tmp = set(get_char_ngram(i, s))
    res = res.union(tmp)
res = sorted(list(res))
print(res[K-1])
### BUGGY CODE ###

from collections import deque
h, w = map(int, input().split())
ch,cw = map(int, input().split())
dh,dw = map(int, input().split())

#mp[h][w]
mp = [[0]*w for _ in range(h)]
for i in range(h):
    tmp = input()
    for j in range(w):
        mp[i][j] = tmp[j]

#for i in range(h):
#    print(mp[i])


#can reach with 0
q = deque()
dx1 = (-1, 0, 1, 0)
dy1 = (0,-1,0,1)
dx2 = (-2,-2,-2,-2,-2,-1,-1,-1,-1,0,0,1,1,1,1,2,2,2,2,2)
dy2 = (-2,-1,0,1,2,-2,-1,1,2,-2,2,-2,-1,1,2,-2,-1,0,1,2)
q.append((ch-1,cw-1))

q2 = deque()

mpc = [[0]*w for _ in range(h)]

mpc[ch-1][cw-1] = 1
while q:
    x, y = q.popleft()
    for i in range(4): 
        nx = x+dx1[i]
        ny = y+dy1[i]
        if nx < 0 or nx >= h:
            continue
        if ny < 0 or ny >= w:
            continue
        if mp[nx][ny] == '.' and mpc[nx][ny] != mpc[x][y]:           
            mpc[nx][ny] = mpc[x][y]
            q.appendleft((nx,ny))

    for i in range(len(dx2)):
        nx = x+dx2[i]
        ny = y+dy2[i]
        if nx < 0 or nx >= h:
            continue
        if ny < 0 or ny >= w:
            continue
        if mp[nx][ny] == '.' and mpc[nx][ny] == 0:       
            mpc[nx][ny] = mpc[x][y] + 1
            q.append((nx,ny))
    
#for i in range(h):
#    print(mpc[i])

print(mpc[dh-1][dw-1]-1)



### FIXED CODE ###

from collections import deque
h, w = map(int, input().split())
ch,cw = map(int, input().split())
dh,dw = map(int, input().split())

#mp[h][w]
mp = [[0]*w for _ in range(h)]
for i in range(h):
    tmp = input()
    for j in range(w):
        mp[i][j] = tmp[j]

#for i in range(h):
#    print(mp[i])


#can reach with 0
q = deque()
dx1 = (-1, 0, 1, 0)
dy1 = (0,-1,0,1)
dx2 = (-2,-2,-2,-2,-2,-1,-1,-1,-1,0,0,1,1,1,1,2,2,2,2,2)
dy2 = (-2,-1,0,1,2,-2,-1,1,2,-2,2,-2,-1,1,2,-2,-1,0,1,2)
q.append((ch-1,cw-1))

q2 = deque()

mpc = [[0]*w for _ in range(h)]

mpc[ch-1][cw-1] = 1
while q:
    x, y = q.popleft()
    for i in range(4): 
        nx = x+dx1[i]
        ny = y+dy1[i]
        if nx < 0 or nx >= h:
            continue
        if ny < 0 or ny >= w:
            continue
        if mp[nx][ny] == '.' and mpc[nx][ny] != mpc[x][y]:           
            mpc[nx][ny] = mpc[x][y]
            q.appendleft((nx,ny))

    for i in range(len(dx2)):
        nx = x+dx2[i]
        ny = y+dy2[i]
        if nx < 0 or nx >= h:
            continue
        if ny < 0 or ny >= w:
            continue
        if mp[nx][ny] == '.' and mpc[nx][ny] == 0:       
            mpc[nx][ny] = mpc[x][y] + 1
            q.append((nx,ny))
    
#for i in range(h):
#    print(mpc[i])

print(mpc[dh-1][dw-1]-1)
### BUGGY CODE ###

s=input()
t=input()
n=len(s)
sl=list(s)
tl=list(t)
l=[sl,tl]
l2=[list(x) for x in zip(*l)]
l2=sorted(l2,key=lambda x:x[0])
l2=[list(x) for x in zip(*l2)]
s=''.join(l2[0])
t=''.join(l2[1])
a=''
for i in range(n):
    if(s[i]==a):continue
    a=s[i]
    b=t[i]
    s=s.translate(str.maketrans({a:b,b:a}))
    
    
if(s==t):print("Yes")
else:print("No")


### FIXED CODE ###

s=input()
t=input()
n=len(s)



sl=list(s)

sl.sort()
sl=''.join(sl)

a=''
for i in range(n):
    if(sl[i]==a):continue
    a=sl[i]
    b=t[s.index(a)]
    s=s.translate(str.maketrans({a:b,b:a}))
    sl=sl.translate(str.maketrans({a:b,b:a}))
    

if(s==t):print("Yes")
else:print("No")
### BUGGY CODE ###

n = int(input())

a = list(map(int, input().split()))


total = 0
for i in range(n-1):
    for j in a[i+1:]:
        total += (a[i]*j)
        total = total%(10**9+7)

print(total)


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
mod = 10**9 + 7
 
ans = 0
total = sum(A)
for i in range(N - 1):
    total -= A[i]
    ans += (A[i] * total) 
 
print(ans % mod)
### BUGGY CODE ###

N = int(input())
S = input()

ans = 0
for j in range(N):
    original = list("RGB")
    if S[j] in original:
        for i in range(j):
            obj = [a for a in original if a != S[j]]
            if S[i] in obj:
                for k in range(j+1, N):
                    if (j-i) != (k-j):
                        obj_2 = [b for b in obj if b != S[i]]
                        if S[k] == obj_2[0]:
                        	ans += 1
print(ans)


### FIXED CODE ###

N = int(input())
S = input()

r = S.count("R")
g = S.count("G")
b = S.count("B")

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        k = j + j - i
        if 0 <= k < N:
            if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
                cnt += 1

print(r*g*b - cnt)
### BUGGY CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, a, b = MAP()

def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, int(y/2)) ** 2 % mod
    else:
        return power(x, int((y-1)/2)) ** 2 * x % mod
    
a_max = 2 * 10 ** 5
# a, bの最大値+2
fact = [1] * (a_max + 2)
# 逆元
for i in range(1, a_max + 1):
    fact[i] = (fact[i-1] * i) % mod
ans = pow(2, n) - 1
# combination
def C(n, a):
    tmp = 1
    for i in range(n, n-a, -1):
        tmp = (tmp * i) % mod
    return tmp * power(fact[a], mod - 2)

print((ans - C(n, a) - C(n, b)) % mod)


### FIXED CODE ###

import sys, re, os
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product, accumulate
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from fractions import gcd
 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def S_MAP(): return map(str, input().split())
def LIST(): return list(map(int, input().split()))
def S_LIST(): return list(map(str, input().split()))
 
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

n, a, b = MAP()

def power(x, y):
    if y == 0:
        return 1
    elif y == 1:
        return x % mod
    elif y % 2 == 0:
        return power(x, int(y/2)) ** 2 % mod
    else:
        return power(x, int((y-1)/2)) ** 2 * x % mod
ans = power(2, n) - 1
    
a_max = 2 * 10 ** 5
# a, bの最大値+2
fact = [1] * (a_max + 2)
# 逆元
for i in range(1, a_max + 1):
    fact[i] = (fact[i-1] * i) % mod
# combination
def C(n, a):
    tmp = 1
    for i in range(n, n-a, -1):
        tmp = (tmp * i) % mod
    return tmp * power(fact[a], mod - 2)

print((ans - C(n, a) - C(n, b)) % mod)
### BUGGY CODE ###

H, W, K = map(int, input().split())
S = []
for _ in range(H):
  S.append(input())
ans = 0
hsummation = [[int(S[0][k])]for k in range(W)]
for k in range(W):
  for j in range(1, H):
    hsummation[k].append(hsummation[k][j-1] + int(S[j][k]))
#print(hsummation)
anskouho = [0 for _ in range(2**(H-1))]
h = -1
for j in range(2**(H-1)):
  h += 1
  binh = "0"*(H-len(str(bin(h)))+1)+str(bin(h))[2:]
  hlist=[]
  for k in range(H-1):
    if binh[-k-1] == '1':
      hlist.append(k)
  hlist.append(-1)
  #print(hlist)
  anskouho[j] = len(hlist)-1
  now = 0
  s = 0
  while now < W:
    counter = [0 for _ in range(len(hlist))]
    while now < W:
      for l in range(len(hlist)):
        if l == 0:
          counter[l] += hsummation[now][int(hlist[l])]
          continue
        else:
          counter[l] += - hsummation[now][hlist[l-1]] + hsummation[now][hlist[l]]
      if max(counter) > K:
        s += 1
        break
      else:
        now += 1
      #print(counter)
  anskouho[j] = anskouho[j] + s
#print(anskouho)
print(min(anskouho))


### FIXED CODE ###

H, W, K = map(int, input().split())
S = []
for _ in range(H):
  S.append(input())
hsummation = [[int(S[0][k])]for k in range(W)]
for k in range(W):
  for j in range(1, H):
    hsummation[k].append(hsummation[k][j-1] + int(S[j][k]))
#print(hsummation)
ans = float('inf')
anskouho = 0
h = 2**(H-1)
for j in range(2**(H-1)):
  h -= 1
  binh = "0"*(H-len(str(bin(h)))+1)+str(bin(h))[2:]
  hlist=[]
  for k in range(H-1):
    if binh[-k-1] == '1':
      hlist.append(k)
  hlist.append(-1)
  #print(hlist)
  anskouho = len(hlist)-1
  now = 0
  while now < W:
    counter = [0 for _ in range(len(hlist))]
    while now < W:
      for l in range(len(hlist)):
        if l == 0:
          counter[l] += hsummation[now][int(hlist[l])]
          continue
        else:
          counter[l] += - hsummation[now][hlist[l-1]] + hsummation[now][hlist[l]]
      if max(counter) > K:
        anskouho += 1
        break
      else:
        now += 1
    if anskouho > ans:
      break
  else:
    ans = min(ans, anskouho)
 
      #print(counter)
#print(anskouho)
print(ans)
### BUGGY CODE ###

# ABC122C - GeT AC
import sys
input = sys.stdin.readline

n, q = list(map(int, input().rstrip().split()))
s = input().rstrip()
arr = [list(map(int, input().rstrip().split())) for _ in range(q)]
cnt = [0] * (n - 1)
for i in range(n - 1):
    if s[i : i + 2] == "AC":
        cnt[i] += 1
for i, j in arr:
    print(cnt[i - 1 : j - 1].count(1))

### FIXED CODE ###

# ABC122C - GeT AC
import sys
input = sys.stdin.readline

n, q = list(map(int, input().rstrip().split()))
s = input().rstrip()
arr = [list(map(int, input().rstrip().split())) for _ in range(q)]
cnt = [0] * (n + 1)
for i in range(n):
    if s[i : i + 2] == "AC":
        cnt[i + 1] = cnt[i] + 1
    else:
        cnt[i + 1] = cnt[i]
for i, j in arr:
    print(cnt[j - 1] - cnt[i - 1])
### BUGGY CODE ###

# -*- coding: utf-8 -*-

import time

# start = time.time()

# N = 10
N = int(input())

def yakusu_list(n):
    output = []
    for i in range(1, n//2 + 1):
        if n % i == 0:
            output.append(i)

    output.append(n)

    return output


def comb(x, rest_list, output_list):
    if len(rest_list) > 0:
        hs = rest_list[0]
        for h in hs:
            comb(h * x, rest_list[1:len(rest_list)], output_list)
    else:
        output_list.append(x)

    return output_list


def clean_list(l):
    l = sorted(l)

    output = [1]
    for num in l:
        if output[-1] != num:
            output.append(num)

    return output


# a = comb(1, [[1,2], [1,3], [1,2,4]], [])

N_list = []
for i in range(1, N + 1):
    N_list.append(yakusu_list(i))

yakusu = clean_list(comb(1, N_list, []))
# print(N_list)
# print(clean_list(comb(1, N_list, [])))

cnt = 0
for i in yakusu:
    if len(yakusu_list(i)) == 75:
        # print(i)
        cnt += 1

print(cnt)
# print(time.time() - start)

### FIXED CODE ###

# coding: utf-8

# https://atcoder.jp/contests/abc114
# 14:44-15:24 done


def soinsubunkai(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr


def main():
    N = int(input())

    soinsu = {}
    for i in range(2, N+1):
        i_soinsu = soinsubunkai(i)
        for p, idx in i_soinsu:
            if p not in soinsu:
                soinsu[p] = idx
            else:
                soinsu[p] += idx

    n_75, n_25, n_15, n_5, n_3 = 0, 0, 0, 0, 0
    for v in soinsu.values():
        if v >= 74:
            n_75 += 1
        if v >= 24:
            n_25 += 1
        if v >= 14:
            n_15 += 1
        if v >= 4:
            n_5 += 1
        if v >= 2:
            n_3 += 1

    n_3_5_5 = n_5 * (n_5-1) * (n_3-2) // 2
    n_5_15 = n_15 * (n_5-1)
    n_3_25 = n_25 * (n_3-1)

    return n_3_5_5 + n_5_15 + n_3_25 + n_75


print(main())
### BUGGY CODE ###

# -*- coding: utf-8 -*-
from collections import deque
H, W = list(map(int, input().split()))
Sn = [input() for _ in range(H)]

def func(h,w): # 黒のみ
    map = [[0 for _ in range(W)] for _ in range(H)]
    que = deque()
    que.append((h,w))
    while len(que) > 0:
        xh,xw = que.popleft()
        map[xh][xw] = Sn[xh][xw]
        # 左
        if xw - 1 >= 0:
            if Sn[xh][xw] != Sn[xh][xw-1] and map[xh][xw-1] == 0:
                que.append((xh, xw-1))
        # 上
        if xh - 1 >= 0:
            if Sn[xh][xw] != Sn[xh-1][xw] and map[xh-1][xw] == 0:
                que.append((xh-1, xw))
        # 右
        if xw + 1 < W:
            if Sn[xh][xw] != Sn[xh][xw+1] and map[xh][xw+1] == 0:
                que.append((xh, xw+1))
        # 下
        if xh + 1 < H:
            if Sn[xh][xw] != Sn[xh+1][xw] and map[xh+1][xw] == 0:
                que.append((xh+1, xw))

    return map
    # cnt = 0
    # for i in range(H):
    #     for j in range(W):
    #         if map[i][j] == ".":
    #             cnt += 1
    # return cnt

cnt = 0
visited = [[0 for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        if Sn[i][j] == "#" and visited[i][j]==0:
            ret = func(i,j)
            b_cnt = 0
            w_cnt = 0
            for i2 in range(H):
                for j2 in range(W):
                    if ret[i2][j2] == "#":
                        b_cnt += 1
                        visited[i2][j2] = 1
                    elif ret[i2][j2] == ".":
                        w_cnt += 1
                        visited[i2][j2] = 1

            cnt += b_cnt*w_cnt
            
print(cnt)


### FIXED CODE ###

# -*- coding: utf-8 -*-
from collections import deque
H, W = list(map(int, input().split()))
Sn = [input() for _ in range(H)]

def func(h,w): # 黒のみ
    move = [(0,-1),(-1,0),(0,1),(1,0)]
    w_cnt = 0
    b_cnt = 0
    que = deque()
    que.append((h,w))
    while len(que) > 0:
        xh,xw = que.popleft()
        if visited[xh][xw] == 0:
            visited[xh][xw] = 1
            if Sn[xh][xw] == "#":
                b_cnt += 1
            else:
                w_cnt += 1
        else:
            continue
            
        for mh, mw in move:
            if 0 <= xh + mh < H and 0 <= xw + mw < W:
                if Sn[xh][xw] != Sn[xh + mh][xw + mw] and visited[xh + mh][xw + mw] == 0:
                    que.append((xh + mh, xw + mw))

    return b_cnt, w_cnt

cnt = 0
visited = [[0 for _ in range(W)] for _ in range(H)]

for i in range(H):
    for j in range(W):
        if Sn[i][j] == "#" and visited[i][j]==0:
            b_cnt, w_cnt = func(i, j)
            cnt += b_cnt*w_cnt
            
print(cnt)
### BUGGY CODE ###

N = int(input())
val2ind = {}
for one in list(map(int, input().split())):
    if one not in val2ind:
        val2ind[one] = 0
    val2ind[one]+=1

Q = int(input())

for _ in range(Q):
    B, C = list(map(int, input().split()))
    if B in val2ind:
        cand = val2ind[B]
        val2ind[B] = 0
        if C not in val2ind:
            val2ind[C] = cand
        else:
            val2ind[C] += cand
    print(sum([key*val2ind[key] for key in val2ind]))

### FIXED CODE ###

from collections import Counter
N = int(input())
val2ind = Counter(list(map(int, input().split())))
ans = sum([key*val2ind[key] for key in val2ind])
Q = int(input())

for _ in range(Q):
    B, C = list(map(int, input().split()))
    if B in val2ind:
        cand = val2ind[B]
        del val2ind[B]
        if C not in val2ind:
            val2ind[C] = cand
        else:
            val2ind[C] += cand
        ans = ans+(C-B)*cand
    print(ans)
### BUGGY CODE ###

n=int(input())
a=input()
a=[int(n) for n in a.split()]
c=0
for i in range(n):
    c+=a[i]*sum(a[i+1:])
    c=c%(10**9+7)
print(c)

### FIXED CODE ###

n=int(input())
a=input()
a=[int(n) for n in a.split()]
c=0
aa=sum(a)
for i in range(n):
    aa-=a[i]
    c+=a[i]*aa
    c=c%(10**9+7)
print(c)
### BUGGY CODE ###

from decimal import *
getcontext().prec = 20
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

M = mod = 998244353
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]
def li4():return [Decimal(i) for i in input().rstrip('\n').split(' ')]

n = val()
l = li4()
mihe = n//2 + 1


dp = [[Decimal(0) for i in range(n)] for j in range(n + 1)]
sumarray = [Decimal(1) for i in range(n + 1)]



for i in range(n-1,-1,-1):
    for j in range(n-1,i - 1,-1):
        dp[i][j] = ( l[i] / (1 - l[i]) ) * sumarray[j + 1]

    for j in range(n):
        if sumarray[j] != 1:
            sumarray[j] += dp[i][j]
        else:
            sumarray[j] = dp[i][j]



# for i in dp:print(*i)
# print(*sumarray)

curr = 1
for i in l:curr *= (1 - i)

print(sum(j * curr for j in sumarray[:- mihe]))


### FIXED CODE ###

from decimal import *
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

M = mod = 998244353
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]
def li4():return [float(i) for i in input().rstrip('\n').split(' ')]

n = val()
l = li4()
mihe = n//2 + 1


curr = 1
for i in l:curr *= (1 - i)
dp = [0 for i in range(n + 1)]
dp[0] = 1

for i in range(n):

    for j in range(i + 1,-1,-1):
        if not j:dp[j] *= 1 - l[i]
        else:dp[j] = dp[j-1] * l[i] + dp[j] *(1 - l[i])

ans = 0
for i in dp[-mihe:]:
    ans += i

print(round(ans,10))
### BUGGY CODE ###

#!/usr/bin/env python3

import sys

sys.setrecursionlimit(1000000)

N, M = [int(x) for x in input().split()]

# D[i][j]: Card i has a rel. with card j
D = [[] for i in range(N)]
for i in range(M):
    x, y, z = [int(x) for x in input().split()]
    x -= 1
    y -= 1
    D[x].append(y)
    D[y].append(x)

visited = [False for i in range(N)]
def dfs(n):
    for idx in D[n]:
        if not visited[idx]:
            visited[idx] = True
            dfs(idx)

cnt = 0
for n in range(N):
    if not visited[n]:
        visited[n] = True
        dfs(n)
        cnt += 1
print(cnt)


### FIXED CODE ###

#!/usr/bin/env python3

import sys

sys.setrecursionlimit(1000000)

N, M = [int(x) for x in input().split()]

# D[i][j]: Card i has a rel. with card j
D = [[] for i in range(N)]
for i in range(M):
    x, y, z = [int(x) for x in input().split()]
    x -= 1
    y -= 1
    D[x].append(y)
    D[y].append(x)

visited = [False for i in range(N)]
def dfs(n):
    for idx in D[n]:
        if not visited[idx]:
            visited[idx] = True
            dfs(idx)

cnt = 0
for n in range(N):
    if not visited[n]:
        visited[n] = True
        dfs(n)
        cnt += 1
print(cnt)
### BUGGY CODE ###

s = input()
q = int(input())
length = len(s)
que = [[''] * 3 for i in range(q)]
for i in range(q):
    c = input()
    if c[0] == '1':
        que[i][0] = 1
    else:
        n, f, c = map(str, c.split())
        que[i][0], que[i][1], que[i][2] = int(n), int(f), c
for com in que:
    if com[0] == 1:
        s = s[::-1]
    else:
        if com[1] == 1:
            li = [com[2], s]
            s = ''.join(li)
        else:
            tmp = s
            li = [s, com[2]]
            s = ''.join(li)
print(s)

### FIXED CODE ###

s = input()
q = int(input())
length = len(s)
que = [[''] * 3 for i in range(q)]
for i in range(q):
    c = input()
    if c[0] == '1':
        que[i][0] = 1
    else:
        n, f, c = map(str, c.split())
        que[i][0], que[i][1], que[i][2] = int(n), int(f), c

rev_cnt = 0
left = [''] * 200000
right = [''] * 200000
left_cnt = 0
right_cnt = 0
for com in que:
    if com[0] == 1:
        rev_cnt += 1
        left, right = right, left
        left_cnt, right_cnt = right_cnt, left_cnt
    else:
        if com[1] == 1:
            left[left_cnt] = com[2]
            left_cnt += 1
        else:
            right[right_cnt] = com[2]
            right_cnt += 1

l = list(reversed(left[0:left_cnt]))
if rev_cnt % 2 == 0:
    center = list(s)
else:
    center = list(reversed(list(s)))
ans = l + center + right[0:right_cnt]
for c in ans:
    print(c, end='')
print()