Harryxun/stf_run huggingface dataset:
n= int(input())
a= list(map(int,input().split()))
 
ans = 1
 
if 0 in a:
    print(0)
    exit(0)

for i in a:
  ans = i * ans
  if ans > 10**18:
	print(-1)
    exit(0)

print(ans)

### FIXED CODE ###

n= int(input())
a= list(map(int,input().split()))
 
ans = 1
over = -1
 
if 0 in a:
    print(0)
    exit(0)

for i in a:
  ans = i * ans
  if ans > 10**18:
      print(-1)
      exit(0)

print(ans)
### 20.07.2017
x = []
a, b = map(int, input().split())
print(int(a/b), a%b, float(a/b))

### FIXED CODE ###

a, b = map(int, input().split())
print(int(a/b), a%b, '%03.6f' % (a/b))
N,M = map(int,input().split())
l = x = [int(i) for i in input().split()]
l_sum = sum(l)
cnt = 0
 
for i in range(N):
    if l[i] > (1//(4*M))*l_sum:
        cnt += 1
 
if cnt >= M:
    print("Yes")
else:
    print("No") 

### FIXED CODE ###

x,y,z = map(int,input().split())
print(z,x,y)
s = input()
ans = []

def latterCount(idx, s):
    if len(s) == 0:
        return 0
    if s[idx] != 'L':
        return 0

    count = 1
    for i in range(idx+1, len(s)):
        if s[i] == 'L' and s[i] == s[i-1]:
            count += 1
        else:
            break
    return count

def formerCount(idx, s):
    if len(s) == 0:
        return 0
    if s[idx] != 'R':
        return 0

    count = 1
    for i in reversed(range(idx)):
        if s[i] == 'R' and s[i] == s[i+1]:
            count += 1
        else:
            break
    return count

s = s.replace('RL', 'W')

#print(s)

for i in range(len(s)):
    if s[i] == 'R' or s[i] == 'L':
        ans.append(0)
    else:
        if i > 0:
            rCount = formerCount(i-1, s)
        else:
            rCount = 0
            #        print('rCount: ' + str(rCount))
        if i < len(s) - 1:
            lCount = latterCount(i+1, s)
        else:
            lCount = 0
#        print('lCount: ' + str(lCount))
	first = rCount // 2 + 1 + (lCount // 2 + lCount % 2)
        second = (rCount // 2 + rCount % 2) + 1 + lCount // 2
        ans.append(first)
        ans.append(second)

print(' '.join([str(i) for i in ans]))


### FIXED CODE ###

s = input()
ans = []

def latterCount(idx, s):
    if len(s) == 0:
        return 0
    if s[idx] != 'L':
        return 0

    count = 1
    for i in range(idx+1, len(s)):
        if s[i] == 'L' and s[i] == s[i-1]:
            count += 1
        else:
            break
    return count

def formerCount(idx, s):
    if len(s) == 0:
        return 0
    if s[idx] != 'R':
        return 0

    count = 1
    for i in reversed(range(idx)):
        if s[i] == 'R' and s[i] == s[i+1]:
            count += 1
        else:
            break
    return count

s = s.replace('RL', 'W')

#print(s)

for i in range(len(s)):
    if s[i] == 'R' or s[i] == 'L':
        ans.append(0)
    else:
        if i > 0:
            rCount = formerCount(i-1, s)
        else:
            rCount = 0
            #        print('rCount: ' + str(rCount))
        if i < len(s) - 1:
            lCount = latterCount(i+1, s)
        else:
            lCount = 0
#        print('lCount: ' + str(lCount))
        first = rCount // 2 + 1 + (lCount // 2 + lCount % 2)
        second = (rCount // 2 + rCount % 2) + 1 + lCount // 2
        ans.append(first)
        ans.append(second)

print(' '.join([str(i) for i in ans]))
print(int(eval(input()))


### FIXED CODE ###

print(eval(input()))
# coding: utf-8


def solve(*args: str) -> str:
    x = int(args[0])

    ret = None
    for a in range(120):
        for b in range(a, 120):
            a5, b5 = pow(a, 5), pow(b, 5)
            if a5-b5 == x:
                ret = (a, b)
            elif a5+b5 == x:
                ret = (a, -b)

    return ' '.join(map(str, ret))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))


### FIXED CODE ###

# coding: utf-8
from bisect import bisect_left


def solve(*args: str) -> str:
    x = int(args[0])

    P = [pow(i, 5) for i in range(128)]
    ret = None
    for b, b5 in enumerate(P):
        a5 = x+b5
        like_a = bisect_left(P, a5)
        if like_a < len(P):
            if P[like_a] == a5:
                ret = (like_a, b)
                break

        a5 = abs(x-b5)
        like_a = bisect_left(P, a5)
        if like_a < len(P):
            if P[like_a] == a5:
                ret = (like_a if b5 < x else -like_a, -b)
                break

    return ' '.join(map(str, ret))


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

grids = np.array(grids)
t_grids = grids.T
hr_scores = np.array([[-1] * W for _ in range(H)])
vr_scores = np.array([[-1] * H for _ in range(W)])

for h in range(H):
    cnt_hr = 0
    cnt_vr = 0
    start_hr = 0
    start_vr = 0
    for w in range(W):
        if grids[h][w] == '.':
            cnt_hr += 1
        else:
            hr_scores[h, w] = 0
            hr_scores[h, start_hr: w] = cnt_hr
            start_hr = w + 1
            cnt_hr = 0
        if t_grids[w][h] == '.':
            cnt_vr += 1
        else:
            vr_scores[h, w] = 0
            vr_scores[h, start_vr: w] = cnt_vr
            start_vr = w + 1
            cnt_vr = 0
    if cnt_hr:
        hr_scores[h, start_hr: w + 1] = cnt_hr
    if cnt_vr:
        vr_scores[h, start_vr: w + 1] = cnt_vr
        
print(max((hr_scores + vr_scores.T).max() - 1, 0))

### FIXED CODE ###

H, W = map(int, input().split())

grids = []
for _ in range(H):
    grids.append(input())

hr_scores = []
vr_scores = []


max_value = 0
for w in range(W):
    cnt = 0
    start_h = 0
    lis = []
    for h in range(H):    
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (h - start_h) + [0]
            start_h = h + 1
            cnt = 0
    if cnt:
        lis += [cnt] * (h - start_h + 1)
    vr_scores.append(lis)
vr_scores = [[vr_scores[w][h] for w in range(W)] for h in range(H)]
for h in range(H):
    cnt = 0
    start_w = 0
    lis = []
    for w in range(W):
        if grids[h][w] == '.':
            cnt += 1
        else:
            lis += [cnt] * (w - start_w) + [0]
            if cnt:
                max_value = max(
                    max_value,
                    max(vr_scores[h][start_w: w]) + cnt
                )
            start_w = w + 1
            cnt = 0
    if cnt:
        max_value = max(
            max_value,
            max(vr_scores[h][start_w: w + 1]) + cnt
         )

print(max(max_value - 1, 0))
# coding: utf-8
# Your code here!
import sys
sys.setrecursionlimit(10**7)

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

to = [[] for i in [0]*n]
for _ in range(n-1):
    x,y = [int(i)-1 for i in input().split()]
    to[x].append(y)
    to[y].append(x)


dp = [[0]*len(to_i) for to_i in to]
parent_index = [-1]*n 
ans = [0]*n

def dfs(v, p):
    res = 1
    for i, vc in enumerate(to[v]):
        if vc == p:
            parent_index[vc] = i
            continue
        """子供から情報をもらって処理する"""
        dp[v][i] = dfs(vc, v)
        res *= 1+dp[v][i]
        res %= MOD
        """処理ここまで"""
    return res

def bfs(v, res_p, p):
    deg = len(to[v])
    if p >= 0:
        dp[v][parent_index[v]] = res_p

    accl = [1]*(deg+1)
    for i in range(deg):
        accl[i+1] = accl[i]*(dp[v][i]+1)%MOD

    accr = [1]*(deg+1)
    for i in range(deg-1,-1,-1):
        accr[i] = accr[i+1]*(dp[v][i]+1)%MOD

    ans[v] = accr[0]
    for i,vc in enumerate(to[v]):
        if vc == p: continue
        bfs(vc, accl[i]*accr[i+1]%MOD, v)

dfs(0,-1)
#print(dp)
bfs(0,None,-1)
#print(dp)
for i in ans:
    print(i)

### FIXED CODE ###

# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

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

to = [[] for _ in [0]*n]
for _ in range(n-1):
    x,y = [int(i)-1 for i in input().split()]
    to[x].append(y)
    to[y].append(x)


dp = [[0]*len(to_i) for to_i in to]
parent_index = [-9999]*n 
ans = [0]*n

def dfs(v, p):
    res = 1
    for i, vc in enumerate(to[v]):
        if vc == p:
            parent_index[v] = i
            continue
        dp[v][i] = dfs(vc, v)
        res *= dp[v][i]+1
        res %= MOD
    return res

def dfs2(v, res_p, p):
    deg = len(to[v])
    if p >= 0:
        dp[v][parent_index[v]] = res_p

    accl = [1]*(deg+1)
    accr = [1]*(deg+1)

    for i in range(1, deg+1):
        accl[i] = accl[i-1] * (dp[v][i-1] + 1) % MOD
        accr[-i-1] = accr[-i] * (dp[v][-i] + 1) % MOD

    ans[v] = accr[0]
    for i,vc in enumerate(to[v]):
        if vc == p: continue
        dfs2(vc, accl[i]*accr[i+1]%MOD, v)

dfs(0,-1)
#print(dp)
dfs2(0,0,-1)
#print(dp)
for i in ans:
    print(i)
s = input()
s = int(s)

x = s / 1.08

tashikame = round(x) * 1.08
tashikame = math.floor(tashikame)
if s != tashikame:
    print(':(')
else:
    print(x)

### FIXED CODE ###

import math

s = int(input())

te = s % 1.08
if te < 0.1:
  print(':(')
else:
  x = s / 1.08
  print(math.ceil(x))
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)

from sys import stdin
from string import ascii_lowercase
from itertools import count

def gcd(m, n):
    m, n = sorted([m, n])
    while n:
        m, n = n, m % n
    return m

def encode(char, A, B):
    return chr(((A * (ord(char) - 97) + B) % 26) + 97)

def solve(words):
    for a in (i for i in count(0) if gcd(i, 26) == 1):
        for b in range(26):
            for word in words:
                that = ''.join(encode(c, a, b) for c in 'that')
                if word == that:
                    return (a, b)
                this = ''.join(encode(c, a, b) for c in 'this')
                if word == this:
                    return (a, b)

def main():
    for _ in range(int(stdin.readline())):
        line = stdin.readline()
        a, b = solve([s for s in line.split() if len(s) == 4])
        d = {encode(c, a, b): c for c in ascii_lowercase}
        d[b' '] = b' '
        print(''.join(d[c] for c in line))

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import (division, absolute_import, print_function,
                        unicode_literals)

from sys import stdin
from string import ascii_lowercase
from itertools import count

def gcd(m, n):
    m, n = sorted([m, n])
    while n:
        m, n = n, m % n
    return m

def encode(char, A, B):
    return chr(((A * (ord(char) - 97) + B) % 26) + 97)

def solve(words):
    for a in (i for i in count(0) if gcd(i, 26) == 1):
        for b in range(26):
            for word in words:
                that = ''.join(encode(c, a, b) for c in 'that')
                if word == that:
                    return (a, b)
                this = ''.join(encode(c, a, b) for c in 'this')
                if word == this:
                    return (a, b)

def main():
    for _ in range(int(stdin.readline())):
        line = stdin.readline()
        a, b = solve([s for s in line.split() if len(s) == 4])
        d = {encode(c, a, b): c for c in ascii_lowercase}
        d[b' '] = b' '
        d[b'\n'] = ''
        print(''.join(d[c] for c in line))

if __name__ == '__main__':
    main()
q, h, s, d = map(int, input().split())
n = int(input())
n4 = n * 4
# jリットルになるようにしたi番目までの総和最小値
# dp[i][j] = 
w = [1, 2, 4, 8]
v = [q, h, s, d]
dp = [[10**9]*(n4+1) for i in range(4)]
for i in range(4):
  dp[i][0] = 0
for i in range(4):
  for j in range(n4+1):
    if j >= w[i]:
      dp[i][j] = min(dp[i-1][j], dp[i][j-w[i]] + v[i])
    else:
      dp[i][j] = dp[i-1][j]
print(dp[3][n4])

### FIXED CODE ###

q, h, s, d = map(int, input().split())
n = int(input())
h = min(q*2, h)
s = min(h*2, s)
d = min(s*2, d)
if n % 2 == 0:
  print(min(s*n, d*(n//2)))
else:
  print(min(s*n, d*(n//2)+s))
a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=map(int,input().split(" "))
print("Yes") if (c[0] in a and c[1] in a) or (c[0] in b and c[1] in b) else print("No")

### FIXED CODE ###

a=[1,3,5,7,8,10,12]
b=[4,6,9,11]
c=list(map(int,input().split(" ")))
print("Yes") if (c[0] in a and c[1] in a) or (c[0] in b and c[1] in b) else print("No")
while True:
    (a, op, b) = input().split()
    a =int(a)
    b =int(b)

    if op == '?':
        break

    elif op == '+':
        print(a + b)

    elif op == '-':
        print(a - b)

    elif op == '*':
        print(a * b)

    elif op == '/':
        print(a // b)

### FIXED CODE ###

(r, c) = [int(i) for i in input().split()]
src = []
for _ in range(r):
    row = [int(i) for i in input().split()]
    row.append(sum(row))
    src.append(row)
last_row = [0 for _ in range(c + 1)]
for rc in range(r):
    for cc in range(c+1):
        last_row[cc] += src[rc][cc]
src.append(last_row)
 
for rc in range(r+1):
    print(' '.join([str(a) for a in src[rc]]))
N,M = input().split()
N,M = int(N),int(M)
f_start = [0 for i in range(N)]
A,B = [],[]
for i in range(N):
    a,b = input().split()
    a,b = int(a),int(b)
    A.append(a)
    B.append(-b)
    
def add(q_,add_):
    for i in range(len(add_)):
        heapq.heappush(q_,add_[i])

def kouho(A,B,m):
    kouho_list = []
    for i in range(len(B)):
        if(A[i]==m):
            kouho_list.append(B[i])
    return kouho_list

q = []
heapq.heapify(q)
sum_money = 0

for m in range(1,M+1):
    kouho_list = kouho(A,B,m)
    add(q,kouho_list)
    #print(q)
    if(len(q)>0):
        sum_money += -heapq.heappop(q)
print(sum_money)

### FIXED CODE ###

N,M = input().split()
N,M = int(N),int(M)
f_start = [0 for i in range(N)]
A,B = [],[]
import heapq
for i in range(N):
    a,b = input().split()
    a,b = int(a),int(b)
    A.append(a)
    B.append(-b)
    
def add(q_,add_):
    for i in range(len(add_)):
        heapq.heappush(q_,add_[i])

def kouho(A,B,M):
    kouho_list = [[] for i in range(M+1)]
    for i in range(len(A)):
        if(A[i]<=M):
            kouho_list[A[i]].append(B[i])
    return kouho_list

q = []
heapq.heapify(q)
sum_money = 0

kouho_list = kouho(A,B,M)
for m in range(1,M+1):
    kouho_ = kouho_list[m]
    add(q,kouho_)
    #print(q)
    if(len(q)>0):
        sum_money += -heapq.heappop(q)
print(sum_money)
n,m,*a=map(int,open(0).read().split())
mod=10**9+7
p=[1]
a=iter(a)
b=a.__next__()
if 1==b:
    p.append(0)
    b=next(a,-1)
else:
    p.append(1)
for i in range(2,n+1):
    if i==b:
        p.append(0)
        b=next(a,-1)
        print(i)
    else:
        p.append((p[i-1]+p[i-2])%mod)
print(p[-1])

### FIXED CODE ###

n,m,*a=map(int,open(0).read().split())
mod=10**9+7
p=[1]
a=iter(a)
b=next(a,-1)
if 1==b:
    p.append(0)
    b=next(a,-1)
else:
    p.append(1)
for i in range(2,n+1):
    if i==b:
        p.append(0)
        b=next(a,-1)
    else:
        p.append((p[i-1]+p[i-2])%mod)
print(p[-1])
a=int(input())
d=[]
t=0
g=0
h=map(int,input().split())
for i in range(a-1):
  if h[i]>=h[i+1]:
    g+=1
  else:
    d.append(g)
    g=0
d.append(g)
print(max(d))

### FIXED CODE ###

a=int(input())
d=[]
t=0
g=0
h=list(map(int,input().split()))
for i in range(a-1):
  if h[i]>=h[i+1]:
    g+=1
  else:
    d.append(g)
    g=0
d.append(g)
print(max(d))
import itertools

n = int(input())
list_A = list(map(int, input().split()))
L, R = [], []
A, B = [[-1, 0], [-1, 0]]

for i in range(n):
    if i % 2 == 0:
        L.append(list_A[i])
    else:
        R.append(list_A[i])

L = itertools.groupby(L)
for key, group in L:
    A.append([key, len(list(group))])

A.sort(key=lambda x:x[1], reverse=True)

R = itertools.groupby(R)
for key, group in R:
    B.append([key, len(list(group))])

B.sort(key=lambda x:x[1], reverse=True)

if A[0][0] != B[0][0]:
    print(n - A[0][1] - B[0][1])
else:
    print(min(n - A[1][1] - B[0][1], n - A[0][1] - B[1][1]))

### FIXED CODE ###

n = int(input())
list_V = list(map(int, input().split()))

list_Vx = []
list_Vy = []

for i, s in enumerate(list_V):
    if i % 2 == 0:
        list_Vx.append(s)
    else:
        list_Vy.append(s)

list_Vx_Count = [0 for _ in range(pow(10, 5))]
list_Vy_Count = [0 for _ in range(pow(10, 5))]

for i in list_Vx:
    list_Vx_Count[i-1] += 1
for i in list_Vy:
    list_Vy_Count[i-1] += 1

ans = n - max(list_Vx_Count) - max(list_Vy_Count)

if list_Vx_Count.count(max(list_Vx_Count)) == 1 and list_Vy_Count.count(max(list_Vy_Count)):
    if list_Vx_Count.index(max(list_Vx_Count)) == list_Vy_Count.index(max(list_Vy_Count)):
        ans = n - max(max(list_Vx_Count)+sorted(list_Vx_Count)[-2], max(list_Vy_Count)+sorted(list_Vy_Count)[-2])

print(ans)
import numpy as np
n = int(input())
result = np.array([[0]*4]*4)
for _ in range(n):
  inp = list(map(int, input().split()))
  u, k = inp[0], inp[1]
  v = inp[2:]
  if k != 0:
    for vv in v:
      result[u-1][vv-1] = 1

result = list(result)
for i in range(n):
  print(*result[i])


### FIXED CODE ###

n = int(input())
result = [[0 for _ in range(n)] for _ in range(n)]
for _ in range(n):
  inp = list(map(int, input().split()))
  u, k = inp[0], inp[1]
  v = inp[2:]
  if k != 0:
    for vv in v:
      result[u-1][vv-1] = 1

result = list(result)
for i in range(n):
  print(*result[i])
n, m = map(int,input().split())
    
tbin_o = []
for i in range(m):
    xxx = list(map(int,input().split()))
    tbin_o.append(xxx)

tbin_2 = []
for i in range(len(tbin_o)):
    if tbin_o[i][0] == 1 or tbin_o[i][1] == n:
        tbin_2.append(tbin_o[i])

aaa = 0
for j in range(len(tbin_2)):
    for l in range(len(tbin_2)):
        if tbin_2[j][1] == tbin_2[l][0] and j != l:
            aaa = aaa + 1
            break
            
if aaa == 1 :
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

n, m = map(int,input().split())

boolins =[]
for i in range(n):
    boolins.append(0)
    
for i in range(m):
    xxx = list(map(int,input().split()))
    if xxx[0] == 1:
        boolins[xxx[1]] = boolins[xxx[1]] + 1
    elif xxx[1] == n :
        boolins[xxx[0]]=boolins[xxx[0]]+ 1
    else:
        None


if 2 in boolins:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
from bisect import bisect_left
from bisect import bisect_right

n = int(input())
s = input()
q = int(input())

ind_list = [[] for _ in range(26)]

for i, x in enumerate(s):
    ind_list[ord(x)-97].append(i)

for _ in range(q):
    _type, val1, val2 = input().split()
    if _type == '1':
        i = int(val1)-1
        c = val2
        ind_list[ord(s[i])-97].remove(i)
        ind_list[ord(c)-97].append(i)
        ind_list[ord(c)-97].sort()
    elif _type == '2':
        l = int(val1)-1
        r = int(val2)-1
        ans = 0
        for i in range(26):
            if bisect_right(ind_list[i], r) - bisect_left(ind_list[i], l) > 0:
                ans += 1
        print(ans)
    else:
        print('Exception caught!')
        exit()


### FIXED CODE ###

from bisect import bisect_right
from bisect import bisect_left

n = int(input())
s = list(input())
q = int(input())

ind_list = [[] for _ in range(26)]

for i, x in enumerate(s):
    ind_list[ord(x)-97].append(i)

for _ in range(q):
    _type, val1, val2 = input().split()
    if _type == '1':
        i = int(val1)-1
        c = val2
        if s[i] == c:
            continue
        ind_list[ord(s[i])-97].remove(i)
        p = bisect_right(ind_list[ord(c)-97], i)
        ind_list[ord(c)-97].insert(p, i)
        s[i] = c
    elif _type == '2':
        l = int(val1)-1
        r = int(val2)-1
        ans = 0
        for i in range(26):
            if bisect_right(ind_list[i], r) - bisect_left(ind_list[i], l) > 0:
                ans += 1
        print(ans)
    else:
        print('Exception caught!')
        exit()
n,k=map(int,input().split())
x=list(map(int,input().split()))
for i in range(n):
  if x[i]>=0:
    zero=i
    break
if n-zero+1>k:
  mindis=x[zero+k-1]
else:
  mindis=max(x[n-1],abs(x[n-k]))+min(x[n-1],abs(x[n-k]))*2
for i in range(1,k):
  if zero+k-i-1>n-1:
    continue
  if zero-i<0:
    break
  under=abs(x[zero-i])
  up=x[zero+k-i-1]
  tmp=max(under,up)+min(under,up)*2
  if tmp<mindis:
    mindis=tmp
print(mindis)

### FIXED CODE ###

n,k=map(int,input().split())
x=list(map(int,input().split()))
mintime=abs(x[0])+abs(x[0]-x[n-1])
for i in range(n-k+1):
  r=abs(x[k+i-1])+abs(x[k+i-1]-x[i])
  l=abs(x[i])+abs(x[k+i-1]-x[i])
  if min(r,l)<mintime:
    mintime=min(r,l)
print(mintime)
import sys #追加


n=int(input())
sys.setrecursionlimit(10**6*2)

s=input()
X=int(s,2)

one_cnt=s.count("1")
modp1=X%(one_cnt+1)
modm1=X%(one_cnt-1)

ans=[]

ans_memo=[0]*(2*(10**5)+2)
#print(ans_memo)
ans_memo[1]=1
ans_memo[2]=1

def DEF(x,cnt):
    global ans_memo
    #print(x,cnt,ans_memo)
    if x==0:
        return 0
    if x<2*(10**5)+1:    
        if ans_memo[x]!=0:
            return ans_memo[x]
        else:
            if x%(str(bin(x)).count("1"))==0:
                ans_memo[x]=1
                return 1
            else:
                tmp=DEF(x%(str(bin(x)).count("1")),cnt+1)+1
                ans_memo[x]=tmp
                return tmp
    else:
        if x%(str(bin(x)).count("1"))==0:
            return 1
        else:
            tmp=DEF(x%(str(bin(x)).count("1")),cnt+1)+1
            return tmp


ans=[]

for i in range(n):
    tmp=2**(n-i-1)
    tmp_num=X
    #1の時
    if tmp&tmp_num:
        tmp_num-=tmp
        if tmp_num==0:
            ans.append(0)
        else:
            
            tmp_num=(modm1-tmp%(one_cnt-1))
            if tmp_num<0:
                tmp_num+=(one_cnt-1)

            ans.append(DEF(tmp_num,1)+1)
        
    else:
        tmp_nunm=(tmp%(one_cnt+1)+modp1)%(one_cnt+1)
        #print(bin(tmp_num),n-i-1)
        #tmp_num=tmp_num%(one_cnt+1)
        ans.append(DEF(tmp_num,1)+1)

#print(ans_memo)

for item in ans:
    print(item)
            









### FIXED CODE ###

def popcount(x):
    return bin(x).count("1")

n=int(input())
s=input()
X=int(s,2)

one_cnt=popcount(X)

modp=X%(one_cnt+1)
modm=X%(one_cnt-1) if one_cnt-1!=0 else 0

for i in range(n):
    if s[i]=="1":
        if one_cnt-1==0:
            print(0)
            continue
        else:
            num=(modm-pow(2,n-i-1,one_cnt-1))%(one_cnt-1)
    else:
        num=(modp+pow(2,n-i-1,one_cnt+1))%(one_cnt+1)

    #print(i,"num",num)
    cnt=1
    while num!=0:
        num=num%popcount(num)
        cnt+=1
    print(cnt)
n = int(input())
a = int(input())
b=int(input())
b=int(a%500)
if (b<=n):
  print("Yes")
else:
  print("No")


### FIXED CODE ###

a = int(input())
n = int(input())
if((a%500)<=n):
  print("Yes")
else:
  print("No")
s = ''.join(reversed(input()))
multiplier = 1
divisor = 10 ** 9 + 7
p = [0 for i in range(13)]
np = [0 for i in range(13)]
if s[0] != '?':
  p[int(s[0])] = 1
else:
  for j in range(10):
    p[j] = 1
for i in range(1, len(s)):
  multiplier = (10 * multiplier) % 13
  for j in range(13):
    np[j] = 0
  if s[i] != '?':
    r = int(s[i]) * multiplier
    for j in range(13):
      np[(j + r) % 13] = p[j]
  else:
    for j in range(10):
      r = j * multiplier
      for k in range(13):
        np[(k + r) % 13] += p[k]
  for j in range(13):
    p[j] = np[j] % divisor
print p[5] % divisor


### FIXED CODE ###

s = ''.join(reversed(input()))
multiplier = 1
divisor = 10 ** 9 + 7
p = [0 for i in range(13)]
if s[0] != '?':
  p[int(s[0])] = 1
else:
  for j in range(10):
    p[j] = 1
for i in range(1, len(s)):
  multiplier = (10 * multiplier) % 13
  np = [0 for j in range(13)]
  if s[i] != '?':
    r = int(s[i]) * multiplier
    for j in range(13):
      np[(j + r) % 13] = p[j]
  else:
    for j in range(10):
      r = j * multiplier
      for k in range(13):
        np[(k + r) % 13] += p[k]
  for j in range(13):
    p[j] = np[j] % divisor
print(p[5] % divisor)
while True:
    try:
        s=raw_input().strip().split()
    except EOFError:
        break
    L=[]
    for d in s:
        if not d.isdigit():
            op1=L.pop()
            op2=L.pop()
            if d=="-":
                L.append(op2-op1)
            elif d=="+":
                L.append(op2+op1)
            elif d=="*":
                L.append(op2*op1)
            else:
                L.append(op2/op1)
        else:
            L.append(float(d))
    print L[0]

### FIXED CODE ###

import sys
for s in sys.stdin.readlines():
    L=[]
    for d in s.strip().split():
        if d=="-":
            d=(-(L.pop()-L.pop()))
        elif d=="+":
            d=(L.pop()+L.pop())
        elif d=="*":
            d=(L.pop()*L.pop())
        elif d=="/":
            d=(1/L.pop()*L.pop())
        L.append(float(d))
    print "%.6f"%L[0]