Harryxun/stf_run huggingface dataset:
A, B, C, D = input()
for p in itertools.product(['+', '-'], repeat = 3):
    equ = A + p[0] + B + p[1] + C + p[2] + D
    
    if(eval(equ) == 7):
        print(equ + '=7')
        break

### FIXED CODE ###

import itertools

A, B, C, D = input()
for p in itertools.product(['+', '-'], repeat = 3):
    equ = A + p[0] + B + p[1] + C + p[2] + D
    
    if(eval(equ) == 7):
        print(equ + '=7')
        break
a, b, c, k = [int(e) for e in input().split()]

import numpy as np

all = np.zeros(a+b+c)
all[:a] +=1
all[-c:] -=1

print(int(sum(all[:k])))

### FIXED CODE ###

a, b, c, k = [int(e) for e in input().split()]

count=0

if k <= a:
    count +=k
elif k <= a+b:
    count +=a
else:
    count = 2*a + b - k

print(count)
#coding: utf-8
s = str(input())
child = [1] * len(s)
# for j in range(len(s)):
# 	child[j] = 1

for j in range(2):
	after = [0] * len(s)
	for i in range(len(s)):
		# print(i)
		if child[i] != 0:
			if s[i] == 'R':
				after[i+1] = after[i+1] + child[i]
				# child[i] = 0
			elif s[i] == 'L':
				after[i-1] = after[i-1] + child[i]
				# child[i] = 0
	child = after
	checkFlg = 0
	for k in range(len(child):
		if child[k] != -1:
			checkFlg = 1
	if checkFlg == 0


print(child) 


### FIXED CODE ###

#coding: utf-8
s = str(input())
child = [0] * len(s)
# for j in range(len(s)):
# 	child[j] = 1
r = 0
l = 0
# lIdx = 0
rIdx = 0

for i in range(len(s)):
	# print(str(r)+","+str(l))
	if s[i] == 'R':
		# print(i)
		r = r+1
		if s[i+1] == 'L':
			rIdx = i
	elif s[i] == 'L':
		l = l+1
		if i == len(s)-1 or s[i+1] == 'R':
			#1セットが終了する
			# print('r='+str(r)+" l="+str(l))
			if ((r+l)%2) == 0:
				child[rIdx] = (r+l)//2
				child[rIdx+1] = (r+l)//2
			else:
				if r%2==0:
					child[rIdx+1] = (r+l)//2 + 1
					child[rIdx] = (r+l)//2
				else:
					child[rIdx+1] = (r+l)//2
					child[rIdx] = (r+l)//2 + 1
			r = 0
			l = 0
			# lIdx = i-1
# child[rIdx-1] = l

#roop終わらない解法
# for j in range(10 ** 100):
# 	after = [0] * len(s)
# 	for i in range(len(s)):
# 		# print(i)
# 		if child[i] != 0:
# 			if s[i] == 'R':
# 				after[i+1] = after[i+1] + child[i]
# 				# child[i] = 0
# 			elif s[i] == 'L':
# 				after[i-1] = after[i-1] + child[i]
# 				# child[i] = 0
# 	child = after

print(" ".join(map(str,child)))
import numpy as np
n,*a=map(int,open(0).read().split())
a=np.array(sorted(a))
i = 0
while len(a):
    if a[0] != a[1]:
        i+=1
    a = a[a%a[0] != 0]
print(i)

### FIXED CODE ###

_,*a = map(int, open(0).read().split())
a.sort()
m = -~a[-1]
c = [0]*m
for i in a:
    c[i] += 1
    if c[i] > 1:
        continue
    for j in range(i * 2, m, i):
        c[j] = 2
print(sum(c[i]==1for i in a))
a,b = [int(x) for x in input().split()] #??????????????§??¶??£?????????
print(a*b,(a+b)*2)

### FIXED CODE ###

x = int(input())
print(x**3)
data = map(int, raw_input().split())
data = sorted(data)
data.reverse()
for i in range(3):
    print data[i]
    

### FIXED CODE ###

data = [0]

for i in range(10):
    data.append(int(input()))
    
data = sorted(data)
data.reverse()

for i in range(3):
    print data[i]
a, b = map(int, input().split())

print(max(a+b, a-b, a*b)

### FIXED CODE ###

a, b = map(int, input().split())
 
print(max(a+b, a-b, a*b))
const MOD: i64 = 1_000_000_007;


fn gcd(a: i64, b: i64) -> i64 {
    let (mut a, mut b) = (a, b);
    while b != 0 {
        let tmp = a - (a / b) * b;
        a = b;
        b = tmp;
    }
    a
}


fn lcm(iterable: &Vec<i64>) -> i64 {
    let mut a = iterable[0];

    for b in iterable.iter() {
        a = a * b / gcd(a, *b)
    }
    a

}


fn main() {
    let n: i64 = read();
    let an: Vec<i64> = read_vec();

    let lcm_an = lcm(&an);

    let mut ans = 0;
    for a in an.iter() {
        ans += lcm_an / a;
        ans %= MOD;
    }

    println!("{}", ans);

}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace()
        .map(|e| e.parse().ok().unwrap()).collect()
}

### FIXED CODE ###

import functools

MOD = 10**9 + 7


def lcm(a, b) -> int:
    c, d = a, b
    while d != 0:
        c, d = d, c % d
    return a // c * b


def inv_mod(x):
    return pow(x, MOD - 2)


def pow(x: int, n: int) -> int:
    res = 1
    while n > 0:
        if n & 1 == 1:
            res = res * x % MOD
        x = x * x % MOD
        n >>= 1

    return res


def main():
    N = int(input())
    an = list(map(int, input().split()))

    lcm_an = functools.reduce(lcm, an)
    lcm_an %= MOD

    ans = 0
    for a in an:
        ans = (ans + lcm_an * inv_mod(a)) % MOD

    print(ans)


if __name__ == '__main__':
    main()
#coding:utf-8
s=input()
s.replace(2017,2018)
print(s)

### FIXED CODE ###

#coding:utf-8
s=input()
s=s.replace('2017','2018')
print(s)
from operator import itemgetter
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
b = []
for _ in range(m):
    tb, tc = map(int, input().split())
    b.append([tb, tc])
a.sort()
b.sort(key=itemgetter(1), reverse=True)

c = 0
flag = False
for j in range(m):
    if (flag):
        break
    for i in range(b[j][0]):
        if (c > len(a) or a[c] >= b[j][1]):
            flag = True
            break
        a[c] = b[j][1]
        c += 1

print(sum(a))

### FIXED CODE ###

from operator import itemgetter
import sys
input = sys.stdin.readline

n, m = map(int, input().split())
a = list(map(int, input().split()))
b = []
for _ in range(m):
    tb, tc = map(int, input().split())
    b.append([tb, tc])
a.sort()
b.sort(key=itemgetter(1), reverse=True)

c = 0
flag = False
for j in range(m):
    if (flag):
        break
    for i in range(b[j][0]):
        if (c >= len(a) or a[c] >= b[j][1]):
            flag = True
            break
        a[c] = b[j][1]
        c += 1

print(sum(a))
from decimal import Decimal

A, B = map(float, input().split())
ans = int(A*Decimal(str(B)))
print(ans)

### FIXED CODE ###

from decimal import Decimal

A, B = map(float, input().split())
ans = int(Decimal(str(A))*Decimal(str(B)))
print(ans)
n = input()
print(n * (n + 1) / 2)

### FIXED CODE ###

n = int(input())
print (n * (n + 1) // 2)
# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
STX.sort(key=lambda x: x[2], reverse=True)
event = []
for s, t, x in STX:
    s = max(0, s-x)
    t = max(0, t-x)
    event.append((s, 0, x))
    event.append((t, -1, x))

answer = [None] * Q
for i in range(Q):
    d = ir()
    event.append((d, 1, i))

event.sort(key=lambda x: [x[0], x[1]])
cur = set()
for a, b, c in event:
    if b == 0:
        cur.add(c)
    elif b == -1:
        cur.remove(c)
    elif b == 1:
        if cur:
            answer[c] = min(cur)
        else:
            answer[c] = -1

print('\n'.join(map(str, answer)))
# 19

### FIXED CODE ###

# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

N, Q = lr()
STX = [tuple(lr()) for _ in range(N)]
event = []
for s, t, x in STX:
    event.append((s-x, 0, x))
    event.append((t-x, -1, x))

for i in range(Q):
    d = ir()
    event.append((d, 1, i))

event.sort()
answer = [-1] * Q
cur = set()
flag = False
INF = 10 ** 10
min_x = INF
for a, b, c in event:
    if b == 0:
        cur.add(c)
        if c < min_x:
            min_x = c
            flag = True
    elif b == -1:
        cur.remove(c)
        if min_x == c:
            flag = False
    elif b == 1:
        if cur:
            if not flag:
                min_x = min(cur)
                flag = True
            answer[c] = min_x

print('\n'.join(map(str, answer)))
# 19
import math
n , k = map(int, input().split())

mod = 10 ** 9 + 7
red_count = n - k 
for i in range(1, k+1):
    if red_count == 0:
        print(1)
        continue
    b_dif = math.factorial(k-1) / (math.factorial(i-1) * math.factorial(k-i))
    
    a_dif = math.factorial(red_count + 1)  /  (math.factorial(i) * math.factorial(red_count + 1 - i))

    print(int(a_dif * b_dif % mod))

### FIXED CODE ###


from scipy.misc import comb
n , k = map(int, input().split())

mod = 10 ** 9 + 7
red_count = n - k 
for i in range(1, k+1) :
    if red_count + 1 - i < 0 :
        print(0)
        
    else:

        print(comb(red_count+1, i , exact = True)*comb(k-1, i-1, exact=True) % mod)
n = int(input())

print(sum(list(range(n))))

### FIXED CODE ###

n = int(input())

print((n*(n-1)//2))
#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    H,W,h,w = LI()
    e = (10**9-1)//(h*w-1)
    ans = [[e]*W for i in range(H)]
    x,y = w-1,h-1
    n,m = 2*w-1,2*h-1
    lx = []
    while x < W:
        lx.append(x)
        x += n
    if lx[-1]+w-1 < W-1:
        lx.append(W-1)
    ly = []
    while y < H:
        ly.append(y)
        y += m
    if ly[-1]+h-1 < H-1:
        ly.append(H-1)
    q = -(e*(h*w-1)+1)
    for y in ly:
        for x in lx:
            ans[y][x] = q
    s = sum([sum(ans[y]) for y in range(H)])
    if s > 0:
        print("Yes")
        for i in ans:
            print(*i)
    else:
        print("No")
    return

#Solve
if __name__ == "__main__":
    solve()


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    H,W,h,w = LI()
    if W%w != 0:
        s = [0]+[100000]*(w-1)
        for i in range(W-w+1):
            s.append(s[-w]-1)
        a = [s[i]-s[i-1] for i in range(1,W+1)]
        print("Yes")
        for i in range(H):
            print(*a)
    elif H%h != 0:
        H,W,h,w = W,H,w,h
        s = [0]+[100000]*(w-1)
        for i in range(W-w+1):
            s.append(s[-w]-1)
        a = [s[i]-s[i-1] for i in range(1,W+1)]
        print("Yes")
        ans = [[a[i]]*H for i in range(W)]
        for i in range(W):
            print(*ans[i])
    else:
        print("No")
    return

#Solve
if __name__ == "__main__":
    solve()
n = int(input())
h_list = list(int, input().split())

ans, cnt = 0, 0
tmp = 0
for h in h_list:
    if h > tmp:
        ans = max(cnt, ans)
        cnt = 0
    else:
      cnt += 1
      tmp = h
print(max(cnt, ans))


### FIXED CODE ###

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

ans, cnt = 0, 0
tmp = 0
for h in h_list:
    if h > tmp:
        ans = max(cnt, ans)
        cnt = 0
    else: cnt += 1
    tmp = h
        
print(max(cnt, ans))
n = unt(input())
print((n//2)//n)

### FIXED CODE ###

n = int(input())
print('{:0<10}'.format(((n+1)//2)/n))
n = int(input())
lst = [int, input().split()]
cnt = 0

for i in range(n-2):
  if lst[1][i] < lst[1][i+1] < lst[1][i+2] or lst[1][i] > lst[1][i+1] > lst[1][i+2] or lst[1][i] = lst[1][i+1] < lst[1][i+2] or lst[1][i] > lst[1][i+1] = lst[1][i+2]:
    cnt += 1
    
print(cnt)

### FIXED CODE ###

n = int(input())
lst = list(map(int,input().split()))
cnt = 0

for i in range(n-2):
  if lst[i] < lst[i+1] < lst[i+2]  or \
     lst[i] > lst[i+1] > lst[i+2]:
    cnt += 1
    
print(cnt)
n,m=[int(i) for i in input().split()]
ans=""
if n>=m:
  for i in range(n):
    ans+=m
else:
  for i in range(m):
    ans+=n
print(ans)

### FIXED CODE ###

n,m=[int(i) for i in input().split()]
ans=""
if n>=m:
  for i in range(n):
    ans+=str(m)
else:
  for i in range(m):
    ans+=str(n)
print(ans)
dict1 = {}
dict2 = {}

while True:
	str = raw_input()
	if len(str[0]) == 0:
		break
	
	str.split(",")

	if dict1.has_key(str[0]):
		dict1[str[0]] = dict1[str[0]] + 1
	else:
		dict1[str[0]] = 1
	
while True:
	try:
		str = raw_input().split(",")
		
		if dict2.has_key(str[0]):
			dict2[str[0]] = dict2[str[0]] + 1
		else:
			dict2[str[0]] = 1
		
	except:
		break

list = sorted(set(dict1)&set(dict2), reverse = True)
for var in list:
	if(dict1[var] > 0 and dict2[var] > 0):
		print var, dict1[var] + dict2[var]

### FIXED CODE ###

dict1 = {}
dict2 = {}

while True:
	log = raw_input()
	if len(log) == 0:
		break
	
	log = log.split(",")[0]
	
	if log in dict1:
		dict1[log] = dict1[log] + 1
	else:
		dict1[log] = 1
		
while True:
	try:
		log = raw_input()
		
		log = log.split(",")[0]
		
		if log in dict2:
			dict2[log] = dict2[log] + 1
		else:
			dict2[log] = 1
			
	except EOFError:
		break

list = set(dict1) & set(dict2)
for var in list:
	print var, dict1[var] + dict2[var]
import sys

sys.setrecursionlimit(10000)


N, K = map(int, input().split())
mod = 1000000007 

def dfs(K, graph, now, source):
  if source == -1:
    can_use_color_num = K - 1
  else:
    can_use_color_num = K - 2
  if len(graph[now]) > K:
    return 0
  else:
    case_num = 1
    for dst in graph[now]:
      if dst == source:
        continue
      case_num *= can_use_color_num
      can_use_color_num -= 1
      case_num %= mod
    for dst in graph[now]:
      if dst == source:
        continue
      case_num *= dfs(K, graph, dst, now)
      case_num %= mod
    return case_num
  

graph = [[] for i in range(N)]
for i in range(N - 1):
  a, b = map(lambda x:int(x)-1, input().split())
  graph[a].append(b)
  graph[b].append(a)

answer = K * dfs(K, graph, 0, -1)
answer %= mod
print(answer)

### FIXED CODE ###

import sys

sys.setrecursionlimit(10**9)


N, K = map(int, input().split())
mod = 1000000007 

def dfs(K, graph, now, source):
  if source == -1:
    can_use_color_num = K - 1
  else:
    can_use_color_num = K - 2
  if len(graph[now]) > K:
    return 0
  else:
    case_num = 1
    for dst in graph[now]:
      if dst == source:
        continue
      case_num *= can_use_color_num
      can_use_color_num -= 1
      case_num %= mod
    for dst in graph[now]:
      if dst == source:
        continue
      case_num *= dfs(K, graph, dst, now)
      case_num %= mod
    return case_num
  

graph = [[] for i in range(N)]
for i in range(N - 1):
  a, b = map(lambda x:int(x)-1, input().split())
  graph[a].append(b)
  graph[b].append(a)

answer = K * dfs(K, graph, 0, -1)
answer %= mod
print(answer)
import heapq
def dijkstra(s):
    #始点sから各頂点への最短距離
    d = [float("inf")] * (n+1)
    used = [True] * (n+1) #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in graph_a[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in graph_a[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d

def dijkstra1(s):
    #始点sから各頂点への最短距離
    d = [float("inf")] * (n+1)
    used = [True] * (n+1) #True:未確定
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in graph_b[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        #まだ使われてない頂点の中から最小の距離のものを探す
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in graph_b[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,[e[0]+d[v],e[1]])
    return d


n, m, s, t = map(int, input().split())
# graph作成
graph_a = {i: [] for i in range(1, n + 1)}
graph_b = {i: [] for i in range(1, n + 1)}
for _ in range(m):
    u, v, a, b = map(int, input().split())
    graph_a[u].append([a, v])
    graph_a[v].append([a, u])
    graph_b[u].append([b, v])
    graph_b[v].append([b, u])

yen = dijkstra(s)
snu = dijkstra1(t)

cost = [0] * n
for i in range(n):
    cost.append([yen[i + 1] + snu[i + 1], i])

heapq.heapify(cost)
nn,l = heapq.heappop(cost)
for i in range(n):
    while l <= i:
        nn,l = heapq.heappop(cost)
    print(10 ** 15 - nn)


### FIXED CODE ###

import heapq
INF = 10**18
def dijkstra(s, edge, n):
    d = [INF] * n
    used = [True] * n #True: not used
    d[s] = 0
    used[s] = False
    edgelist = []
    for e in edge[s]:
        heapq.heappush(edgelist,e)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        if not used[minedge[1]]:
            continue
        v = minedge[1]
        d[v] = minedge[0]
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist,(e[0]+d[v],e[1]))
    return d
 
n, m, s, t = map(int, input().split())
s -= 1
t -= 1
graph_a = [[] for _ in range(n)]
graph_b = [[] for _ in range(n)]
for i in range(m):
    u, v, a, b = map(int, input().split())
    u, v = u-1, v-1
    graph_a[u].append((a, v))
    graph_a[v].append((a, u))
    graph_b[u].append((b, v))
    graph_b[v].append((b, u))
 
yen = dijkstra(s, graph_a, n)
snu = dijkstra(t, graph_b, n)

cost = [0] * n
for i in range(n):
    cost[i] = (yen[i] + snu[i],i)

heapq.heapify(cost)
c = -1
aaa = 10 ** 15
for i in range(n):
    if c < i:
        while cost:
            nn, t = heapq.heappop(cost)
            if t >= i:
                c = t
                break
    print(aaa - nn)
import java.io.BufferedReader;
import java.io.InputStreamReader;

class Main{
  public static void main(String[] args) throws Exception{
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] line = br.readLine().split(" ");
    int x = Integer.parseInt(line[0]);
    int y = Integer.parseInt(line[1]);
    System.out.println(x*y+" "+(x+y)*2);
  }
}

### FIXED CODE ###

line = list(map(int,input().split()))
print(line[0]*line[1],line[0]*2+line[1]*2)
n=int(input())
if n%1000==0:
  print(0)
elif:
  print(1000-n%1000)

### FIXED CODE ###

n=int(input())
if n%1000==0:
  print(0)
else:
  print(1000-n%1000)
N = int(NM[0])
M = int(NM[1])
ALL = sum(A)
k = 0
c = ALL/(4*M)

print(N, M, ALL, c)
for Ai in A:
    if Ai>=c:
        k += 1

if k >= M:
    print("Yes")
else:
    print("No")


### FIXED CODE ###


NM = input("").split()
A = list(map(int, input().strip().split()))

N = int(NM[0])
M = int(NM[1])
ALL = sum(A)
k = 0
c = ALL/(4*M)

for Ai in A:
    if Ai>=c:
        k += 1

if k >= M:
    print("Yes")
else:
    print("No")
# /user/bin/python
# -*- coding: utf-8 -*-
from matplotlib import pyplot


def solve(k):
  step = 1
  ret = 0
  mx = 9
  while k > 0:
    ret += step
    k -= 1
    if ret >= mx:
      step *= 10
      mx = mx*10 + 9
    print(ret)

k = int(input())
solve(k)

### FIXED CODE ###

t = i = 1
k = int(input()) 
while k:
  if t < i / sum(map(int, list(str(i)))):
    i += 9 * t
    t *= 10
  else:
    print(i)
    i += t
    k -= 1
N = int(input())
if N == 1:
    print(1)
# calculate primes by sieve
primes = list(range(2, N + 1))
prime_index = 0
n = primes[prime_index]
while n**2 <= N:
    primes = list(filter(lambda x: x == n or x % n != 0, primes))
    prime_index += 1
    n = primes[prime_index]
# calculate exponents
exponents = [0 for _ in range(len(primes))]
for n in range(2, N + 1):
    for prime_index, prime in enumerate(primes):
        exponent = 0
        tmp = n
        while tmp % prime == 0:
            tmp //= prime
            exponent += 1
        exponents[prime_index] += exponent
# calculate answer
const = 10**9 + 7
answer = 1
for e in exponents:
    answer = answer * (e + 1)
    answer %= const
print(answer)

### FIXED CODE ###

N = int(input())
if N == 1:
    print(1)
    exit()
# calculate primes by sieve
primes = list(range(2, N + 1))
prime_index = 0
n = primes[prime_index]
while n**2 <= N:
    primes = list(filter(lambda x: x == n or x % n != 0, primes))
    prime_index += 1
    n = primes[prime_index]
# calculate exponents
exponents = [0 for _ in range(len(primes))]
for n in range(2, N + 1):
    for prime_index, prime in enumerate(primes):
        exponent = 0
        tmp = n
        while tmp % prime == 0:
            tmp //= prime
            exponent += 1
        exponents[prime_index] += exponent
# calculate answer
const = 10**9 + 7
answer = 1
for e in exponents:
    answer = answer * (e + 1)
    answer %= const
print(answer)
input = raw_input().split(" ")
output = 0;
if input[1] == "+":
    output = input[0] + input[2]
else
    output = input[0] - input[2]

print(output)

### FIXED CODE ###

# python
my_input = str(input())
print(str(eval(my_input)))
n= int(input())
k = int(input())
z = 1
for i in range(n):
  if z <= k:
    z = 2Z
  else
    z = z+k
print(z)

### FIXED CODE ###

n= int(input())
k = int(input())
z = 1
for i in range(n):
  if z < k:
    z = 2*z
  else:
    z = z+k
print(z)
import fractions
a,b = map(int,input().split())

def lcm(x,y):
    return (x*y) // fractions.gcd(x,y)

print(lcm(a,b))


### FIXED CODE ###

#11037751
N = int(input())
a = list(map(int,input().split()))
now = 1
cnt = 0
for i in range(N):
    if a[i]==now:
        now += 1
print(N-now+1 if now != 1 else -1)
# -*- coding: utf-8 -*-
N = int(input())
X = input()
X_10 = 0
popcount_X = 0

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

def f_func(n):
  if n == 0:
    return 0
  return n % popcount(n)

for i in range(N):
  j = N - (i + 1)
  X_10 += int(X[i]) * 2 ** j
  if X[i] == '1':
    popcount_X += 1

popcount_X_plus = popcount_X + 1
popcount_X_minus = popcount_X - 1
fX_plus = X_10 % popcount_X_plus
fX_minus = X_10 % popcount_X_minus

for i in range(N):
  j = N - (i + 1)
  
  Xi = 0
  f = 0
  ans = 1
  
  if X[i] == '0':
    Xi = X_10 + 2**j
    if popcount_X_plus == 0:
      f = 0
    else:
      f = (fX_plus + 2**j % popcount_X_plus) % popcount_X_plus
    
  elif X[i] == '1':
    Xi = X_10 - 2**j
    if popcount_X_minus == 0:
      f = 0
    else:
      f = (fX_minus - 2**j % popcount_X_minus) % popcount_X_minus
      
  
  while f > 0:
    f = f_func(f)
    ans += 1
  print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
N = int(input())
X = input()
X_10 = int(X, 2)
popcount_X = X.count("1")
popcount_X_plus = popcount_X + 1
popcount_X_minus = popcount_X - 1
f_plus = X_10 % popcount_X_plus
f_minus = X_10 % popcount_X_minus if popcount_X_minus != 0 else 0

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

def f(n):
  if n == 0:
    return 0
  return n % popcount(n)

for i in range(N):
  j = N - (i + 1)
  n = 0
  ans = 1
  
  if X[i] == '0':
#    n = (f_plus + (2**j % popcount_X_plus)) % popcount_X_plus
    n = (f_plus + pow(2, j, popcount_X_plus)) % popcount_X_plus
  else:
    if popcount_X_minus == 0:
      print(0)
      continue
    else:
#      n = (f_minus - (2**j % popcount_X_minus) + popcount_X_minus) % popcount_X_minus
      n = (f_minus - pow(2, j, popcount_X_minus) + popcount_X_minus) % popcount_X_minus
  
  while n > 0:
    n = f(n)
    ans += 1
  print(ans)