Harryxun/stf_run huggingface dataset:
n=int(input())
a=[]
for i in range(n):
	x=int(input())
	a.append(x)
ans=0
for i in range(n-1):
	if a[i]>0:
		ans+=(a[i]//2)
		a[i]-=(a[i]//2)*2
	if a[i]>0:
		a[i+1]-=min(a[i],a[i+1])
		ans+=min(a[i],a[i+1])
if a[-1]>0:
	ans+=a[-1]//2
print(ans

### FIXED CODE ###

s=input()
S=s.count("S")
E=s.count("E")
N=s.count("N")
W=s.count("W")
a=0
b=0
if S>0 and N>0:
	a+=1
elif S==N==0:
	a+=1
if E>0 and W>0:
	b+=1
elif E==W==0:
	b+=1
if a==b==1:
	print("Yes")
else:
	print("No")
n = int(input())
otsuri = 1000 - (n % 1000)
if otsuri == 1000:
  print(0)
else:
  print(osturi)

### FIXED CODE ###

n = int(input())
otsuri = 1000 - (n % 1000)
if otsuri == 1000:
  print(0)
else:
  print(otsuri)
import math

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

def factorization(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)

    if temp!=1:
        arr.append(temp)


    return arr
  
d = math.gcd(a,b)  
print(len(factorization(d)) + 1)


### FIXED CODE ###

from fractions import gcd

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

def factorization(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)

    if temp!=1:
        arr.append(temp)

    return arr
  
d = gcd(a,b)
print(len(factorization(d)) + 1)
N = int(raw_input())
As = [(int(i), 2) for i in raw_input().split(" ")]
Bs = [(int(i), 1) for i in raw_input().split(" ")]
Cs = [(int(i), 0) for i in raw_input().split(" ")]
l = sorted(As + Bs + Cs, key=lambda x: (x[0],x[1]))
count = (0, 0, 0)
for i in l:
    count[i[1]] += 1 if(i[1] == 2)else count[2] if(i[1] == 1) else count[1]
print count[0]


### FIXED CODE ###



N = int(raw_input())
As = raw_input().split(" ")
Bs = raw_input().split(" ")
Cs = raw_input().split(" ")

As = [(int(i), 2) for i in As]
Bs = [(int(i), 1) for i in Bs]
Cs = [(int(i), 0) for i in Cs]

l = sorted(As + Bs + Cs, key=lambda x: x[0] + x[1] * 0.1)

ac = 0
bc = 0
cc = 0

for i in l:
    if i[1] == 2:
        ac += 1
    elif i[1] == 1:
        bc += ac
    elif i[1] == 0:
        cc += bc
print cc
n=int(input())
w=[input() for _ in range(n)]
if len(set(w))!=n:print('No')
else:
    for i in range(n-1):
        if w[i][-1]==w[i+1][0]:k+=1
    if k==n-1:print('Yes')
    else:print('No')

### FIXED CODE ###

n=int(input())
k=0
w=[input() for _ in range(n)]
if len(set(w))!=n:print('No')
else:
    for i in range(n-1):
        if w[i][-1]==w[i+1][0]:k+=1
    if k==n-1:print('Yes')
    else:print('No')
ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

from math import sqrt

a,b,c=map(float, input().split())
if (a+b+2*sqrt(a*b)-c)**100<1>>40:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

from math import sqrt

a,b,c=map(int, input().split())
if 4*a*b<(c-a-b)**2 and (c-a-b)>=0:
  print('Yes')
else:
  print('No')
a,b = int(input())
Z = a * b:
  print(Z)


### FIXED CODE ###

a,b =map(int,input().split())
if 1 <= a <=100 and 1 <= b <= 100:
     print(a*b)
a, b = map(int input().split())
if a // 10 == 0 and b // 10:
  print(a*b)
else:
  print(-1)

### FIXED CODE ###

a, b = map(int, input().split())
if a // 10 == 0 and b // 10 == 0:
  print(a*b)
else:
  print(-1)
import math
A, B, H, M = map(int, input().split())
Mkaku = 6 * M
Hkaku = (H * 60 + M) / 2
r1 = Hkaku * math.pi / 180
r2 = Mkaku * math.pi / 180
v1x = A * math.cos(r1)
v1y = A * math.sin(r1)
v2x = B * math.cos(r2)
v2y = B * math.sin(r2)
ans = ((v1x - v2x) ** 2 + (v1y - v2y) ** 2) ** 1/2
print(ans)

### FIXED CODE ###

N = int(input())
NS = str(N)
if NS[len(NS) - 1] == "3":
  ans = "bon"
elif NS[len(NS) - 1] == "0":
  ans = "pon"
elif NS[len(NS) - 1] == "1":
  ans = "pon"
elif NS[len(NS) - 1] == "6":
  ans = "pon"
elif NS[len(NS) - 1] == "8":
  ans = "pon"
else:
  ans = "hon"
print(ans)
import numpy as np
import math

def solve():
    n,w = map(int,input().split())
    w_list,v_list = [0]*n,[0]*n
    for i in range(n):
        w_list[i],v_list[i] = map(int,input().split())
    dp = [[0]*(w+5) for i in range(n+5)]
    for i in range(n):
        for j in range(w+1):
            if j >= w_list[i]:
                dp[i][j] = max(
                    dp[i-1][j],
                    dp[i-1][j-w_list[i]]+v_list[i]
                    )
            else:
                dp[i][j] = dp[i-1][j]
    print(dp[n-1][w])
    return 0

if __name__ == "__main__":
    solve()


### FIXED CODE ###


def solve():
    n,w = map(int,input().split())
    w_list,v_list = [0]*n,[0]*n
    for i in range(n):
        w_list[i],v_list[i] = map(int,input().split())
    dp = [[0]*(w+5) for i in range(n+5)]
    for i in range(n):
        for j in range(w+1):
            if j-w_list[i]>=0:
                dp[i][j] = max(dp[i-1][j],
                               dp[i-1][j-w_list[i]]+v_list[i])
            else:
                dp[i][j] = dp[i-1][j]
    print(dp[n-1][w])
    return 0
 
if __name__ == "__main__":
    solve()
import math

# input
N = int(input())

N_f = math.factorial(N)

ans = 0

for i in range(1, math.ceil(math.sqrt(N_f))):
    if N_f % i == 0:
        ans += 1
        if N_f != i ** 2:
            ans += 1

ans = ans % (10 ** 9 + 7)

print(ans)


### FIXED CODE ###

import math

# input
N = int(input())

# エラトステネスの篩で素数を列挙（table[q] = 0: qは素数, table[i] = j: iはjを素因数に持つ）
def prime_factor_table(n):
    table = [0] * (n + 1)
    
    for i in range(2, n + 1):
        if table[i] == 0:
            for j in range(i + i, n + 1, i):
                table[j] = i
    
    return table

def prime_factor(n, prime_factor_table):
    prime_count = dict()

    while prime_factor_table[n] != 0:
        if prime_factor_table[n] in prime_count.keys():
            prime_count[prime_factor_table[n]] += 1
        else:
            prime_count[prime_factor_table[n]] = 1
        n = int(n/prime_factor_table[n])
    if n in prime_count.keys():
        prime_count[n] += 1
    else:
        prime_count[n] = 1
    return prime_count

Ps = dict()
P_1000 = prime_factor_table(1000)
ans = 1

for i in range(2, N + 1):
    P_i = prime_factor(i, P_1000)
    for k in P_i.keys():
        if k in Ps.keys():
            Ps[k] += P_i[k]
        else:
            Ps[k] = P_i[k]

for k in Ps.keys():
    ans = (ans * (Ps[k] + 1)) % (10 ** 9 + 7)

print(ans)
a,b=map(int,input().split())
def one_14(num):
  if num==1:
    return 14
a=one_14(a)
b=one_14(b)
if a > b:
  print("Alice")
elif b < a:
  print("Bob")
else:
  print("Draw")

### FIXED CODE ###

a,b=map(int,input().split())
def one_14(num):
  if num==1:
    return 14
  else:
    return num
a=one_14(a)
b=one_14(b)
if a > b:
  print("Alice")
elif a < b:
  print("Bob")
else:
  print("Draw")
s=input()
t=input()

sum = 0

for i in range (len(t)):
  if s(i) != t(i):
    sum = sum + 1 
print(sum)

### FIXED CODE ###

s=input()
t=input()

sum = 0

for i in range (len(t)):
  if s[i] != t[i] :
    sum = sum + 1 
print(sum)
import numpy as np



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

max=a[-1]
ans=0
if(len(a)!=len(set(a))):ans-=1
primeNum = []
while a:
    primeNum.append(a[0])
    tmp=a[0]
    a=[i for i in a if i % tmp != 0]
primeNum.extend(a)
ans+=len(primeNum)


print(ans)

### FIXED CODE ###

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

M=1000005
l=[0 for i in range(M)]
for i in a:
    if(l[i]!=0):
        l[i]=2
        continue
    for j in range(i,M,i):
        l[j]+=1
ans=0
for i in a:
    if(l[i]==1):ans+=1
print(ans)
#!/usr/bin/env python3
import sys, math, fractions, itertools, collections, copy, heapq


def solve(h: int, w: int, a: "List[str]"):
    a = [[j == "#" for j in a[i]] for i in range(h)]
    que = collections.deque([(i, j) for i in range(h) for j in range(w) if a[i][j]])
 
    count = 0
    while True:
        count += 1
        nque = collections.deque()
        while que:
            y, x = que.popleft()
            if x > 0 and not a[y][x-1]:
                a[y][x-1] = True
                nque.append((y,x-1))
            if x < w-1 and not a[y][x+1]:
                a[y][x+1] = True
                nque.append((y,x+1))
            if y > 0 and not a[y-1][x]:
                a[y-1][x] = True
                nque.append((y-1,x))
            if y < h-1 and not a[y+1][x]:
                a[y+1][x] = True
                nque.append((y+1,x))
 
        if nque:
            que = copy.copy(nque)
        else:
            break
 
    print(count - 1)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    A = [ next(tokens) for _ in range(W) ]  # type: "List[str]"
    solve(H, W, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
from collections import deque
import copy

def main():
    h, w = map(int, input().split())
    a = [[j == "#" for j in input()] for _ in range(h)]


    # スタート地点をqueueに追加
    que = deque([(i, j) for i in range(h) for j in range(w) if a[i][j]])

    count = 0
    while True:
        count += 1
        nque = deque()
        while que:
            y, x = que.popleft()
            if x > 0 and not a[y][x-1]:
                a[y][x-1] = True
                nque.append((y,x-1))
            if x < w-1 and not a[y][x+1]:
                a[y][x+1] = True
                nque.append((y,x+1))
            if y > 0 and not a[y-1][x]:
                a[y-1][x] = True
                nque.append((y-1,x))
            if y < h-1 and not a[y+1][x]:
                a[y+1][x] = True
                nque.append((y+1,x))

        if nque:
            que = copy.copy(nque)
        else:
            break

    print(count - 1)

if __name__ == '__main__':
    main()
N = int(input())
A = list(map(int,input().split()))

if 0 in A:
  print(0)
  return

count = 1
for i in A:
  count *= i
  if count > 10000000000000000000:
    print(-1)
    return

print(count)


### FIXED CODE ###

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

def main():
  if 0 in A:
    print(0)
    return
 
  count = 1
  for i in A:
    count *= i
    if count > 1000000000000000000:
      print(-1)
      return
 
  print(count)

main()
ans=0.0
for i in range(int(input()):
  a, s = input().split()
  a = double(a)
  if s=="BTC" :
    a *= 380000.0
  ans += a
print(ans)

### FIXED CODE ###

ans=0.0
n=int(input())
for i in range(n):
  a, s = input().split()
  a = float(a)
  if s=="BTC" :
    a *= 380000.0
  ans += a
print(ans)
n=int(input())
a=a=list(map(int,input().split()))
a.sort(reverse=True)
ans=0
if n%2==0:
  for i in range(1,n//2):
    ans +=2*a[i]
  ans+=ans[0]
else:
  for i in range(1,n//2):
    ans +=2*a[i]
  ans +=a[n//2]
  ans+=a[0]
print(ans)


### FIXED CODE ###

n=int(input())
a=a=list(map(int,input().split()))
a.sort(reverse=True)
ans=0
if n%2==0:
  for i in range(1,n//2):
    ans +=2*a[i]
  ans+=a[0]
else:
  for i in range(1,n//2):
    ans +=2*a[i]
  ans +=a[n//2]
  ans+=a[0]
print(ans)
import math
r = int(input())
area = math.pi * r ** 2
circumference = 2 * math.pi * r
print('{0} {1}'.format(area, circumference))

### FIXED CODE ###

import math
r = float(input())
area = math.pi * r ** 2
circumference = 2 * math.pi * r
print('{0} {1}'.format(area, circumference))
X = input()
a = X // 500
b = X % 500
c = b // 5
print(a * 1000 + c * 5)

### FIXED CODE ###

X = int(input())
a = X // 500
b = X % 500
c = b // 5
print(a * 1000 + c * 5)
import sympy

a,b,c=map(int,input().split())

r_ab=sympy.sqrt(a*b)

print("Yes" if a+b+2*r_ab -c <0 else "No")

### FIXED CODE ###

a,b,c=map(int,input().split())
print("Yes" if 4*a*b-(c-a-b)**2<0 and c-a-b>0 else "No")
s=input()
print(s[0]+str(len(s-2))+s[-1])

### FIXED CODE ###

s=input()
print(s[0]+str(len(s)-2)+s[-1])
input_data = input()
if input_data <= 999:
    print('ABC')
else:
    print('ABD')

### FIXED CODE ###

input_data = int(input())
if input_data <= 999:
    print('ABC')
else:
    print('ABD')
N = int(input())
zyunin_list = [int(i) for i in input().split()]

cost_list = []

for p in range(min(zyunin_list), max(zyunin_list)):
    cost = 0
    for zahyo in zyunin_list:
        cost += (zahyo - p) ** 2
    cost_list.append(cost)

print(min(cost_list))

### FIXED CODE ###

N = input()
zyunin_list = [int(i) for i in input().split()]

cost_list = []

for p in range(min(zyunin_list), max(zyunin_list) + 1):
    cost = 0
    for zahyo in zyunin_list:
        cost += (zahyo - p) ** 2
    cost_list.append(cost)

print(min(cost_list))
n=int(input())
p=list(map(int,input().split()))
count=0
for i in range(n-1):
  if p[i]!=i+1
      count=count+1
if count<2:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))
count=0
for i in range(n-1):
  if p[i]!=i+1:
      count=count+1
if count<3:
  print('YES')
else:
  print('NO')
import math;print(int((lambda l:math.floor(1e-9+math.log2(l[1]/l[0]))+1))(list(map(int,input().split()))))

### FIXED CODE ###

X,Y = map(int,input().split())
ans = 0
while X <= Y:
	ans += 1
	X *= 2
print(ans)
N = input()
p = [int(input()) for i in range(N)]
print(sum(p) - max(p) // 2)


### FIXED CODE ###

N = int(input())
p = [int(input()) for i in range(N)]
print(sum(p) - max(p) // 2)
h,n=map(int,input().split())
A = list(map(int,input().split()))
if h >sum(A):
    print('No')
else:
    print('Yes')




### FIXED CODE ###

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

if(h%a == 0):
    print(h//a)
else: 
    print(h//a + 1)
def main():
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    ary = [0]
    tmp = [0] * n
    tmp[0] = 1
    now = 0
    for cnt in range(1,k+1):
        now = a[now] - 1
        ary.append(now)
        if cnt == k:
            print(now)
            return
        if tmp[now] != 0:
            break
        else:
            tmp[now] = cnt + 1
    m = (k - tmp[now]-1) % (cnt - tmp[now])
    print(ary[m+cnt-tmp[now] -1] + 1 )



if __name__=='__main__':
    main()


### FIXED CODE ###

def main():
    n,k = map(int,input().split())
    a = list(map(int,input().split()))
    cnt = [-1] * n
    cnt[0] = 0
    ary = []
    now = 0
    for i in range(n):
        a[i] -= 1

    ary.append(now)
    if k <= n:
        for i in range(1,k+1):
            now = a[now]
            if i == k:
                print(now+1)
                return
    else:
        for i in range(1,k+1):
            now = a[now]
            if cnt[now] != -1:
                break
            else:
                cnt[now] = i
                ary.append(now)
        loop_s = cnt[now]

        print(ary[cnt[now] +((k-cnt[now]) % (i - cnt[now]))] + 1)
        # print(cnt)
        # print(now)
        # print(ary)

if __name__=='__main__':
    main()
N = int(input())
list = list(map(int, input().split()))
no = 0 
ans = 1
lens = 0
if list.count("0") >0:
  print("0")
  exit()
else:
  for i in range(N):
    ans = ans * list[no]
    lens = lens + len(list[no])
    no += 1
    if lens >= 19:
      exit()
    else:
      continue
print(ans if ans <= 10**18 else "-1")

### FIXED CODE ###

def resolve():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if 0 in A:
        print(0)
        exit()
    for i in A:
        ans *= i
        if ans > 10**18:
            print(-1)
            exit()
    print(ans)
resolve()
from math import ceil
n=int(input())
print((int(ceil(10*(1.05)**n))*10000)

### FIXED CODE ###

from math import ceil
n = int(input())

a = 100
for i in range(n):
    a=ceil(1.05 * a)
print (a*1000)
s = input()
a = [0] * (len(s) + 1)
cur = 0
for i in range(len(s)):
  a[i] = cur
  cur = 0 if s[i] == '>' else cur + 1 
a[-1] = cur
cur = 0
for i in range(len(s)).reversed():
  a[i + 1] = max(a[i + 1], cur)
  cur = 0 if s[i] == '<' else cur + 1
a[0] = max(a[0], cur)
print(sum(a))

### FIXED CODE ###

s = input()
a = [0] * (len(s) + 1)
cur = 0
for i in range(len(s)):
  a[i] = cur
  cur = 0 if s[i] == '>' else cur + 1 
a[-1] = cur
cur = 0
for i in reversed(range(len(s))):
  a[i + 1] = max(a[i + 1], cur)
  cur = 0 if s[i] == '<' else cur + 1
a[0] = max(a[0], cur)
print(sum(a))
N,K=map(int,input().split())
A=list(map(int,input().split()))
l=[1]
X=[True]*N
X[0]=False
num=1
for i in range(K):
    num=A[num-1]
    if X[num-1]:
        l.append(num)
        X[num-1]=False
    else:
        q=l.index(num)
        l=l[q:]
        break
print(l[(K-q)%len(l)])


    

        




    















    



    





    






        






    
















        


























            
    


    


    
    














    


    














### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
l=[1]
X=[True]*N
X[0]=False
num=1
for i in range(K):
    num=A[num-1]
    if X[num-1]:
        l.append(num)
        X[num-1]=False
    else:
        q=l.index(num)
        l=l[q:]
        print(l[(K-q)%len(l)])
        exit()
print(l[-1])
(n,m,x)=map(int,input().split())
c=list()
a=list()
for i in range(n):
  line=map(int,input().split())
  c.apppend(line.pop(c[0]))
  a.append(line)

for i in range(2**n):
  total=[0]*m
  cost=0
  for k in range(n):
    if int(bin(i)[k])==1:
      total+=a[k]
      cost+=c[k]
  if total>=[x]*m:
    result.append(cost)

if result!=None:
  print(min(cost))
else:
  print(-1)

### FIXED CODE ###

import numpy as np
(n,m,x)=map(int,input().split())

a=list()
for i in range(n):
    line=list(map(int,input().split()))
    a.append(line)

a=np.array(a)
result=np.array([[0]*(m+1)])
for i in range(n):
    l=list()
    for j in range(len(result)):
        l.append(a[i]+result[j])
        l.append(result[j])
    result=np.array(l)

c=list()
h=[x]*m
for line in result:
    if np.all(line[1:]>=h):
        c.append(line[0])
if len(c)==0:
    print(-1)
else:
    print(min(c))
import sys
def input(): return sys.stdin.readline().rstrip()
from functools import reduce
def mod_comb4(n,r,mod=10**9+7):
    num=reduce(lambda x,y:x*y%mod,range(n,n-r,-1))
    den=reduce(lambda x,y:x*y%mod,range(1,r+1))
    return num*pow(den,mod-2,mod)%mod
def main():
    x,y=map(int,input().split())
    mod=10**9+7
    if (2*x-y)%3>0 or (2*y-x)%3>0:
        print(0)
    else:
        n=(2*x-y)//3
        m=(2*y-x)//3
        print(mod_comb4(n+m,n,mod)%mod)


if __name__=='__main__':
    main()

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().rstrip()
from functools import reduce
def mod_comb4(n,r,mod=10**9+7):
    if r==1:return n
    elif r==0:return 1
    else:
        num=reduce(lambda x,y:x*y%mod,range(n,n-r,-1))
        den=reduce(lambda x,y:x*y%mod,range(1,r+1))
        return num*pow(den,mod-2,mod)%mod
def main():
    x,y=map(int,input().split())
    mod=10**9+7
    n=2*x-y
    m=2*y-x
    if n%3==0 and m%3==0 and n>=0 and m>=0:
        print(mod_comb4(n//3+m//3,n//3,mod))
    else:
        print(0)


if __name__=='__main__':
    main()
k = {"A":1,"B":2,"C":3,"D":4,"E":5,"F":6}
x, y = input().split()
xx = '"'+x+'"'
yy = '"'+y+'"'

if k[xx] > k[yy]:
    print(">")
elif k[xx] < k[yy]:
    print("<")
else:
    print("=")

### FIXED CODE ###

x, y = input().split()
if x > y:
    print(">")
elif x < y:
    print("<")
else:
    print("=")
n, q = list(map(int, input().split()))
s = input()
for i in range(q):
  l,r = list(map(int, input().split()))
  print(s[(l - 1):r].count('AC'))

### FIXED CODE ###

a = input()

if a == 'A':
  print('T')
elif a == 'T':
  print('A')
elif a == 'G':
  print('C')
elif a == 'C':
  print('G')
n,k = map(int,input().split())
l = map(int, input().split())
def counter(l):
    count = {}
    for i in l:
        count[i] = l.count(i)
    return sorted(count.values())

freq = counter(l)
print(len(freq) - k if len(freq)> k else 0)

### FIXED CODE ###

n,k = map(int,input().split())
l = list(map(int, input().split()))
freq = [0]*(n+1)
for i in l:
    freq[i]+=1
freq.sort()
vf = len(freq) - k if len(freq)> k else 0
print(sum(freq[:vf]))
N = int(input())
d = list(map(int, input().split()))
d.sort
print(d[int(N/2+1)]-d[N//2])

### FIXED CODE ###

N = int(input())
d = list(map(int, input().split()))
d.sort()
print(d[int(N/2)]-d[int(N/2)-1])
from fractions import gcd
N, M = map(int, input().split())
a = [int(c) for c in input().split()]
G = a[0]*a[1]//gcd(a[0], a[1])
g = (a[0]//2)*(a[1]//2)//gcd(a[0]//2, a[1]//2)
for i in range(2,N):
  G = G*a[i]//gcd(G, a[i])
  g = g*(a[i]//2)//gcd(g, a[i]//2)
if M<g:
  print(0)
elif g%2==0:
  print(0)
else:
  n = (M-g)//G
  print(n+1)


### FIXED CODE ###

from fractions import gcd
from functools import reduce
def lcm_base(x, y):
    return (x * y) // gcd(x, y)

N, M = map(int, input().split())
a = [int(c) for c in input().split()]
b = [c//2 for c in a]
g = reduce(lcm_base, b, 1)
G = reduce(lcm_base, a, 1)
if M<g:
  print(0)
  import sys
  sys.exit()
m = a[0]&-a[0]
for i in range(N):
  if m != a[i]&(-a[i]):
    print(0)
    break
else:
  n = (M-g)//G
  print(n+1)
n = int(input())
s = str(input())
s += s[0]
candidate = [[1,-1],[1,1],[-1,-1],[-1,1]]
result = []
checker = 0
while checker < 4:
    result = candidate[checker]
    for i in range(1, n):
        if s[i] == 'o' and result[i] == 1:
            result.append(result[-2])
        elif s[i] == 'x' and result[i] == 1:
            result.append(-result[-2])
        elif s[i] == 'o' and result[i] == -1:
            result.append(-result[-2])
        else:
            result.append(result[-2])
    if result[0] == result[-1]:
        checker += 10
    else:
        checker += 1
if checker == 4:
    print(-1)
else:
    result = ['S' if x == 1 else 'W' for x in result[:n]]
    print(''.join(result)

### FIXED CODE ###

n = int(input())
s = str(input())
s += s
candidate = [[1,-1],[1,1],[-1,-1],[-1,1]]
result = []
checker = 0
while checker < 4:
    result = candidate[checker]
    for i in range(1, len(s)-1):
        if s[i] == 'o' and result[i] == 1:
            result.append(result[-2])
        elif s[i] == 'x' and result[i] == 1:
            result.append(-result[-2])
        elif s[i] == 'o' and result[i] == -1:
            result.append(-result[-2])
        else:
            result.append(result[-2])
    if result[:n] == result[n:]:
        checker += 10
    else:
        checker += 1
if checker == 4:
    print(-1)
else:
    result = ['S' if x == 1 else 'W' for x in result[:n]]
    print(''.join(result))
S = input()

dict = {
  'SUN': 0
  'MON': 1,
  'TUE': 2,
  'WED': 3,
  'THU': 4,
  'FRI': 5,
  'SAT': 6,
}

print(7 - dict[S])

### FIXED CODE ###

S = input()
 
dict = {
  'SUN': 0,
  'MON': 1,
  'TUE': 2,
  'WED': 3,
  'THU': 4,
  'FRI': 5,
  'SAT': 6
}
 
print(7 - dict[S])