Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
# get a integer
a = input()
# output
if len(a) == 6 and a[2] == a[3] and a[4] == a[5]:
	print('Yes')
else
	print('No')

### FIXED CODE ###

# -*- coding: utf-8 -*-
# get a integer
a = input()
# output
if len(a) == 6 and a[2] == a[3] and a[4] == a[5]:
    print('Yes')
else:
    print('No')
N=int(input())
B=list(map(int,input.split()))
A=[0]*N

A[0]=B[0]
A[N-1]=B[N-2]

for i in range (1,N-1):
  A[i]=min(B[i-1],B[i])
print(sum(A))

### FIXED CODE ###

import numpy as np
N=int(input())
B=list(map(int,input().split()))
A=np.zeros(N,dtype="int64")

A[0]=B[0]
A[N-1]=B[N-2]

for i in range (1,N-1):
  A[i]=min(B[i-1],B[i])
print(sum(A))
in_data = input()
def test_fun(in_data):
    data = in_data.split(' ')
    A = int(data[0])
    B = int(data[1])
    c = (B - 1) // A + 1
 
    print(c)
  
test_func(in_data)

### FIXED CODE ###

in_data = input()
 
data = in_data.split(' ')
A = int(data[0])
B = int(data[1])
if B == 1:
  print("0")
else:
  c = (B - 1) // (A - 1)
  d = (B - 1) / (A - 1)
  if c < d:
    c = c + 1
  print(c)
n = int(input())
res = 0
p = [*map(int, input().split())]
res = sum(1 for i in range(1, n - 1) if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1])
print(res)

### FIXED CODE ###

n = int(input())
res = 0
p = list(map(int, input().split()))
res = sum(1 for i in range(1, n - 1) if p[i - 1] < p[i] < p[i + 1] or p[i - 1] > p[i] > p[i + 1])
print(res)
n=int(input())

li=[0]*n
ans=0
for i in range(0,n):
  s=list(input().split())
  li[i]=sorted(s[i])
for j in range(0,n-1):
  for k in range(j+1,n):
    if li[j]==li[k]:
      ans+=1
      
print(ans)      


### FIXED CODE ###

n=int(input())
dic={}
for _ in range(0,n):
  s="".join(sorted(input()))
  if s in dic:
    dic[s]+=1
  else:
    dic[s]=1
    
ans=0    
for a in dic.values():
  ans+=(a*(a-1))/2
  
print(int(ans))
a = 0
for i in range(len(S)):
  a = (a + int(S[len(S)-i-1])*A[i]) %2019
  X.append(a)

X.sort()
flag =1
n = 0
for i in range(len(X)-1):
  if X[i]==0:
    n +=1
  if X[i]==X[i+1]:
    flag += 1
  else:
    n += flag*(flag-1)//2
    flag = 1
print(n)
    



### FIXED CODE ###

S = str(input())

#10**nのmod計算
A = []
p =1
for i in range(len(S)):
  A.append(p)
  p = p*10%2019

#左からi文字以降の数字列のmod計算
X = []
a = 0
for i in range(len(S)):
  a = (a + int(S[len(S)-i-1])*A[i]) %2019
  X.append(a)
X.sort()
flag =1
n = 0

#modが同じになる組み合わせ、またはもともとmodが0になる数字列の個数の総和計算
for i in range(len(X)-1):
  if X[i]==0:
    n +=1
  if X[i]==X[i+1]:
    flag += 1
  else:
    n += int(flag*(flag-1)/2)
    flag = 1
n += int(flag*(flag-1)/2)
if X[len(X)-1]==0:
  n +=1
print(n)
n = int(input())
a = list(map(int, input().split()))
 
r = 1
t = 10 ** 18
for i in a:
  r *= a[i]
  if r > t:
    print(-1)
    return
print(r)

### FIXED CODE ###

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

# a = [0, 10, 10, 10, 10]

a.sort()
r = 1
t = 10 ** 18
for x in a:
  r *= x
  if r > t:
    break
if r <= t:
  print(r)
else:
  print(-1)
from itertools import product

h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]

ans = 0

for row_bit in product(range(2), repeat=h):
	for col_bit in product(range(2), repeat=w):
		cnt = 0
    for row in range(h):
    	for col in range(w):
    		if c[row][col] == '#' and (row_bit[row] and col_bit[col]):
        		cnt += 1
	if cnt == k:
    	ans += 1
      
print(ans)

### FIXED CODE ###

from itertools import product

h, w, k = map(int, input().split())
c = [list(input()) for _ in range(h)]

ans = 0

for row_bit in product(range(2), repeat=h):
    for col_bit in product(range(2), repeat=w):
        cnt = 0
        for row in range(h):
            for col in range(w):
                if c[row][col] == "#" and (row_bit[row] and col_bit[col]):
                    cnt += 1
        if cnt == k:
            ans += 1

print(ans)
import numpy as np
from itertools import combinations_with_replacement

N,M,X = map(int,input().split())
CA = []
for i in range(N):
  CA.append(list(map(int,input().split())))

OK = True
CA = np.array(CA)
sums = np.sum(CA,axis=0)
for i in range(1,M+1):
  if sums[i] < X:
    OK = False
    break

if OK == False:
  print(-1)
else:
  # As = []
  # for A in combinations_with_replacement(range(0, N), r=M):
  #   As.append(tuple(set(A)))
  # As = list(map(list, set(As)))
  min_ = sums[0]
  hoge = []
  kouho = list(range(1,N+1))
  for i in itertools.combinations_with_replacement(kouho, N):
    hoge.append(list(set(i)))
  hoge = list(map(list, set(map(tuple, hoge))))
  for i in hoge:
    mini_CA = []
    for j in i:
      mini_CA.append(CA[j])
    mini_CA = np.array(mini_CA)
    OK2 = True
    sums = np.sum(mini_CA,axis=0)
    for k in range(1,M+1):
      if sums[k] < X:
        OK2 = False
        break
    if OK2 == True and sums[0] < min_:
      min_ = sums[0]
  print(min_)

### FIXED CODE ###

import numpy as np
from itertools import combinations_with_replacement

N,M,X = map(int,input().split())
CA = []
for i in range(N):
  CA.append(list(map(int,input().split())))

OK = True
CA = np.array(CA)
sums = np.sum(CA,axis=0)
for i in range(1,M+1):
  if sums[i] < X:
    OK = False
    break

if OK == False:
  print(-1)
else:
  # As = []
  # for A in combinations_with_replacement(range(0, N), r=M):
  #   As.append(tuple(set(A)))
  # As = list(map(list, set(As)))
  min_ = sums[0]
  hoge = []
  kouho = list(range(1,N+1))
  for i in combinations_with_replacement(kouho, N):
    hoge.append(list(set(i)))
  hoge = list(map(list, set(map(tuple, hoge))))
  for i in hoge:
    mini_CA = []
    for j in i:
      mini_CA.append(CA[j-1])
    mini_CA = np.array(mini_CA)
    OK2 = True
    sums = np.sum(mini_CA,axis=0)
    for k in range(1,M+1):
      if sums[k] < X:
        OK2 = False
        break
    if OK2 == True and sums[0] < min_:
      min_ = sums[0]
  print(min_)
N,Q=map(int,input().split())
ab=[[] for _ in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  ab[a-1].append(b)
  ab[b-1].append(a)

P=[0 for _ in range(N)]
for i in range(Q):
  p,x=map(int,input().split())
  P[p-1]+=x


count=[-1]*N
c=0
def dfs(p):
  global c
  c+=P[p-1]
  count[p-1]=c
  for i in ab[p-1]:
    if count[i-1]==-1:
      dfs(i)
  c-=P[p-1]

dfs(1)
print(" ".join(map(str,count)))

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)
input=lambda :sys.stdin.readline()
N,Q=map(int,input().split())
ab=[[] for _ in range(N)]
for i in range(N-1):
  a,b=map(int,input().split())
  ab[a-1].append(b)
  ab[b-1].append(a)

P=[0 for _ in range(N)]
for i in range(Q):
  p,x=map(int,input().split())
  P[p-1]+=x

def dfs(p,par):
  for i in ab[p-1]:
    if i!=par:
      P[i-1]+=P[p-1]
      dfs(i,p)

dfs(1,-12345)
print(" ".join(map(str,P)))
l,r=map(int,input().split())
import sys
mod=2019
ans=float('inf')

for i in range(l,r):
  for j in range(j+1,r+1):
    ans=min((i%mod)*(j%mod),ans)
    if ans==0:
      print(0)
      sys.exit()
print(ans)

### FIXED CODE ###

import sys
L,R=[int(x) for x in input().strip().split()]

tmp=10**9+1
ans=10**9+1

for i in range(L,R,1):
  for j in range(L+1,R+1,1):
    if i<j:
      ans=min((i*j)%2019,ans)
  
      if ans==0:
        print(0)
        sys.exit()
print(ans)


# 332701087 1753412895
K,N = map(int,input().split())
A = list(map(int,input().split()))

per_dist = list(A[i+1]-A[i] for i in range(0,N-1))
last_dist = A[0] + K - A[N]
per_dist = per_dist.append(last_dist)
max_dist = max(per_dist)
print(K - max_dist)

### FIXED CODE ###

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

per_dist = list(A[i+1]-A[i] for i in range(0,N-1))
last_dist = A[0] + K - A[N - 1]
type(last_dist)
per_dist.append(last_dist)
max_dist = max(per_dist)
print(K - max_dist)
N,A,B = map(int,input().split())

N -= 1
A -= 1
B -= 1

def is_valid(p):
    x,y = p
    return 0 <= x < N and 0 <= y < N

def meet(p):
    x,y = p
    return abs(x-y)//2

def dist(p1,p2):
    x1,y1 = p1
    x2,y2 = p2
    return (abs(x1-x2)+abs(y1-y2))//2

oo = []
if (A + B)%2:
    o = []
    for i in [0,N]:
        for j in [1,-1]:
            o.append((i,B + j * abs(A-i)))
            o.append((A + j * abs(B-i),i))
    for x,y in filter(is_valid,o):
        for i in [1,-1]:
            for j in [1,-1]:
                xx = max(0,min(x+i,N))
                yy = max(0,min(y+i,N))
                oo.append(meet((xx,yy))+dist((A,B),(x,y))+1)
    print(min(oo))
else:
    print(meet((A,B)))

### FIXED CODE ###

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

if (A + B)%2 == 0:
    print(abs(A - B)//2)
else:
    print(min(A-1,N-B)+1+abs(A-B+1)//2)
import sys
sys.setrecursionlimit(20000)

N, M, K = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))

max_num = 0


def dfs(curr_a, curr_b, choice, time_required, count):
    global max_num
    if choice == 0:
        if curr_a >= N - 1:
            if max_num < count:
                max_num = count
            return
        else:
            curr_a += 1
            time_required += a[curr_a]
    else:
        if curr_b >= M - 1:
            if max_num < count:
                max_num = count
            return
        else:
            curr_b += 1
            time_required += b[curr_b]
    if time_required > K:
        return
    count += 1
    if max_num < count:
        max_num = count
    dfs(curr_a, curr_b, 0, time_required, count)
    dfs(curr_a, curr_b, 1, time_required, count)

curr_a = -1
curr_b = -1
time_required = 0
count = 0
dfs(curr_a, curr_b, 0, time_required, count)
curr_a = -1
curr_b = -1
time_required = 0
count = 0
dfs(curr_a, curr_b, 1, time_required, count)

print(max_num)

### FIXED CODE ###

N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a, b = [0], [0]
for i in range(N):
    a.append(a[i] + A[i])
for i in range(M):
    b.append(b[i] + B[i])

ans, j = 0, M
for i in range(N + 1):
    if a[i] > K:
        break
    while b[j] > K - a[i]:
        j -= 1
    ans = max(ans, i + j)
print(ans)
n,m = map(int,input().split())
lis = list(map(int,input().split()))
lis.sort(key = lambda x:x[1])
ans = 0
cou = 0
num = 0
while cou < m:
  nu = min(lis[num],m-cou)
  cou += nu
  ans += lis[num] * nu
  num += 1
print(ans)
  

### FIXED CODE ###

n, m = map(int, input().split())
lis = [list(map(int,input().split())) for i in range(n)]
lis.sort(key=lambda x:x[0])
ans = 0
cou = 0
num = 0
while cou < m:
    nu = min(lis[num][1], m - cou)
    cou += nu
    ans += lis[num][0] * nu
    num += 1
print(ans)
n = int(input())
ab = [list(map(int,input().split()))for _ in range(n-1)]

graph = [[] for _ in range(n+1)]
ans = [0]*(n-1)
for i in range(n-1):
    graph[ab[i][0]].append((ab[i][1],i))
    graph[ab[i][1]].append((ab[i][0],i))

visit = [False]*(n+1)
def dfs(p,c):
    color = 1
    visit[p] = True
    for n,i in graph[p]:
        if visit[n] == False:
            if color == c:
                color += 1
            ans[i] = color
            dfs(n,color)
            color += 1

dfs(1,0)
print(max(ans))
for t in ans:
    print(t)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**5)
n = int(input())
ab = [list(map(int,input().split()))for _ in range(n-1)]

graph = [[] for _ in range(n+1)]
ans = [0]*(n-1)
for i in range(n-1):
    graph[ab[i][0]].append((ab[i][1],i))
    graph[ab[i][1]].append((ab[i][0],i))

visit = [False]*(n+1)
def dfs(p,c):
    color = 1
    visit[p] = True
    for n,i in graph[p]:
        if visit[n] == False:
            if color == c:
                color += 1
            ans[i] = color
            dfs(n,color)
            color += 1

dfs(1,0)
print(max(ans))
for t in ans:
    print(t)
n, m, l = [int(i) for i in input().split()]

A = []
B = []
C = []

for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

for i in range(n):
    C.append([int(i) for i in input().split()])
    for j in range(l):
        C[i].append(0)
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]
            
for li in range(l):
    print(" ".join(C[li]))

### FIXED CODE ###

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

A = []
B = []
C = []

for ni in range(n):
    A.append([int(i) for i in input().split()])

for mi in range(m):
    B.append([int(i) for i in input().split()])

for i in range(n):
    C.append([])
    for j in range(l):
        C[i].append(0)
        for k in range(m):
            C[i][j] += A[i][k] * B[k][j]

for ni in range(n):
    print(" ".join([str(s) for s in C[ni]]))
import sys
input = sys.stdin.readline.rstrip
sys.setrecursionlimit(10**6)
import decimal
from decimal import Decimal
decimal.getcontext().prec = 10

from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque 

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)

# ---------------------------------------

s = input()
if s[-1] == "s":
    s += "es"
else:
    s += "s"
print(s)


### FIXED CODE ###

s = input()
if s[-1] == "s":
    s += "es"
else:
    s += "s"
print(s)
N = int(input())
L = list(map(int, input().split()))

if len(set(L)) > 3:
  L = list(set(L))

ans = 0
for a in range(0, N-2):
  for b in range(a+1, N-1):
    for c in range(b+1, N):
      if L[a] < (L[b]+L[c]):
        if L[b] < (L[a]+L[c]):
          if L[c] < (L[a]+L[b]):
            ans += 1

print(ans)

### FIXED CODE ###

N = int(input())
L = list(map(int, input().split()))
L.sort()
from bisect import bisect_left
ans = 0

for a in range(0, N-2):
  for b in range(a+1, N-1):
    t = L[a] + L[b]
    idx = bisect_left(L,t)
    ans += max(0, idx-b-1)

print(ans)
import numpy as np

N = int(input())
price = []

for i in range(N):
    price.append(int(input()))
    
price = np.array(price)
max_index = np.argmax(price)

print(int(np.sum(price) - price[max_index] / 2))


### FIXED CODE ###

day = int(input())

difference = int(25 - day)

if difference > 0:
    answer = "Christmas " + "Eve " * (difference - 1) + "Eve"
else:
    answer = "Christmas"

print(answer)
n,m=map(int,input().split())
x=0
s=[list(map(int,input().split())) for i in range(m)]
s=sorted(s)
for i in range(m):
  if s[i][0]==1 and s[i][1]==0:
    x=-1

for i in range(m):
  for j in range(m):
    if s[i][0]==s[j][0] and s[i][1]!=s[j][1]:
      x=-1

a=[0]*n
for i in range(m):
  a[s[i][0]]=s[i][1]

for i in range(m):
  ans=a[i]*10**(n-i-1)
if a[0]==0:
  ans+=100
print(x,ans)

### FIXED CODE ###

n,m=map(int,input().split())
x=99999
s=[list(map(int,input().split())) for i in range(m)]
s=sorted(s)
for i in range(m):
    if s[i][0]==1 and s[i][1]==0 and n!=1:
        x=-1

for i in range(m):
    for j in range(m):
        if s[i][0]==s[j][0] and s[i][1]!=s[j][1]:
            x=-1

a=[0]*n
ans=0
for i in range(m):
    a[s[i][0]-1]=s[i][1]

if a[0]==0 and n!=1:
    a[0]=1

for i in range(n):
    ans+=a[i]*(10**(n-i-1))


print(min(x,ans))
n,m = map(int,input().split())
food = [0]*m
for i in range(n):
  k,*a = map(int,input().split())
  for j in range(k):
    food[a[j]]+=1
print(food.count(n))


### FIXED CODE ###

n,m = map(int,input().split())
food = [0]*(m+1)
for i in range(n):
  k,*a = map(int,input().split())
  for j in range(k):
    food[a[j]]+=1
print(food.count(n))
N, limit = map(int, input().split())
bounce = input().split()
b = [0]
count = 0
for i in range(len(bounce)):
  b.append(b[i]+bounce[i])
  
for j in range(len(b)):
  if b[j] <= limit:
    count += 1
print(count)


### FIXED CODE ###

N, limit = map(int, input().split())
bounce = input().split()
b = [0]
count = 0
for i in range(len(bounce)):
  b.append(b[i]+int(bounce[i]))
  
for j in range(len(b)):
  if b[j] <= limit:
    count += 1
print(count)
n, m = map(int, input().split())
a = [int(input()) for i in range(m)]
dp = [0 for i in range(n + 1)]
dp[0] = 1
MOD = 10 ** 9 + 7
if a[0] > 1:
    dp[1] = 1
for i in range(2, n + 1):
    if i - 1 not in a:
        dp[i] += dp[i - 1]
    if i - 2 not in a:
        dp[i] += dp[i - 2]
    dp[i] %= MOD
print(dp[-1])


### FIXED CODE ###

n, m = map(int, input().split())
if m > 0:
    a = {int(input()): None for i in range(m)}
else:
    a = {}
dp = [0] * (n + 1)
dp[0] = 1
MOD = 10 ** 9 + 7
if m == 0 or 1 not in a:
    dp[1] = 1
for i in range(2, n + 1):
    if i - 1 not in a:
        dp[i] += dp[i - 1]
    if i - 2 not in a:
        dp[i] += dp[i - 2]
    dp[i] %= MOD
print(dp[-1])
n,k=map(int,input().split())
a=list(map(int,input().split()))
x=[0 for i in range(n)]
y=[]
s=0
for i in range(n):
  if a[i] in a:
    x[a[i]-1]+=1
    
for i in range(n):
  if x[i]:
    y.append(x[i])
y.sort()
i=0
while(len(y)>k):
  s+=y[i]
  y.pop(i)
  i+=1
print(s)

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
x=[0 for i in range(n)]
y=[]
s=0
for i in range(n):
  x[a[i]-1]+=1
    
for i in range(n):
  if x[i]:
    y.append(x[i])
y.sort()
z=len(y)
i=0
while(z>k):
  s+=y[i]
  z-=1
  i+=1
print(s)
a, b, h = map(int, input().split())
print((a+b)*h//2)

### FIXED CODE ###

a = int(input()) 
b = int(input())
h = int(input())
print((a+b)*h//2)
n,m=map(int,input().split())
jouken=[]
for x in range(m):
  jouken.append(list(map(int,input().split())))

for x in range(10**n):
  ans=0
  for y in range(m):
    a=jouken[y][0]-1
    b=jouken[y][1]
    if not x[a]==b:
      ans+=1
  if ans==0:
    print(x)
    break

if ans>1:
  print(-1)

### FIXED CODE ###

n=int(input())

s=n//2
a=n%2

if a==1:
  print(s+1)
else:
  print(s)
from functools import reduce
l = [int(input()) for _ in range(5)]
r = min([i % 10 for i in l if i % 10 != 0])
l = [i // 10 * 10 + 10 for i in l]
print(reduce(lambda a, b: a + b, l) + r - 10)


### FIXED CODE ###

import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
l = [a, b, c, d, e]
ans = 9
n = 0
j = 0
for i in [i % 10 for i in l]:
    if i != 0 and i < ans:
        ans = i
        n = j
    j += 1
m = l.pop(n)
r = 0
for i in l:
    r += math.ceil(i / 10) * 10
print(r + m)
import.math
A, B = map(int, input().split())
ans = A*B
ant = math.floor(ans)
print(ant)

### FIXED CODE ###

def resolve():
    A, B = input().split()
    ans = int(A)*int(B[0])*100+int(A)*int(B[2:])
    print(str(ans)[:-2] if len(str(ans)) >= 3 else "0")
resolve()
import math

N=int(input())
l=10**9+7
nums=list(map(int,input().split()))
k=math.log2(max(nums))+1
mat=[]
for each in nums:
    num=str(bin(each))[2:].zfill(k)
    mat.append(list(num))
 
mat=list(zip(*mat))
ans=0
 
for i in range(k):
    b=mat[i].count("1")
    ans+=b*(N-b)*pow(2,(k-i-1),l)
print(ans%l)

### FIXED CODE ###

mod=10**9+7
N=int(input())
str_a = ''.join(['{:060b}'.format(a) for a in map(int, input().split())])

ans=0
for i in range(60):
    ones=str_a[59-i::60].count("1")
    ans+= pow( 2, i ,mod)* ones *(N-ones)
print(ans%mod)
s = list(input())
lis = ["A","T","G","C"]
ans = []
for i in range(len(s)):
    cnt = 0
    for j in range(len(s)-i):
        if s[i+j] in lis:
            cnt +=1
        else:
            ans.append(cnt)
            break
print(max(ans))


### FIXED CODE ###

s = list(input())
lis = ["A","T","G","C"]
ans = []
for i in range(len(s)):
    cnt = 0
    for j in range(len(s)-i):
        if s[i+j] in lis:
            cnt +=1
        else:
            ans.append(cnt)
            break
    else:ans.append(cnt)
print(max(ans))
N,Q=map(int,input().split())

T=[[] for i in range(N)]

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

O=[0 for i in range(N)]

for i in range(Q):
    p,x=map(int,input().split())
    O[p-1]+=x

def dfs(n,r):
    for i in T[n]:
        if i==r:
            continue
        O[i]+=O[n]

        dfs(i,n)

dfs(0,-1)

print(*O)
    


### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)
input=sys.stdin.readline

N,Q=map(int,input().split())

T=[[] for i in range(N)]

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

O=[0 for i in range(N)]

for i in range(Q):
    p,x=map(int,input().split())
    O[p-1]+=x

def dfs(n):
    for i in T[n]:
        if r[i]:continue
        r[i]=1
        O[i]+=O[n]
        dfs(i)

r=[1]+[0]*(N-1)

dfs(0)

print(*O)
from fractions import gcd
from functools import reduce
 
N,*A = map(int,read().split())
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
 
answer = sum((lcm//x) % MOD for x in A)
answer %= MOD

### FIXED CODE ###

from fractions import gcd
from functools import reduce
 
N = int(input())
A = list(map(int, input().split()))
 
MOD = 10 ** 9 + 7
 
lcm = reduce(lambda x,y: x*(y//gcd(x,y)), A)
 
answer = sum(lcm//x for x in A)
answer %= MOD
print(answer)
a, b, c, d = map(int, input(),split())
print(max(a*b, c*d))

### FIXED CODE ###

a, b, c, d = map(int, input().split())
print(max(a*b, c*d))
import sys

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

N = ir()
A = [ir() for _ in range(N)]
answer = A[0] - 1
cur_limit = 2
for a in A[1:]:
    if a == cur_limit:
        cur_limit += 1
        continue
    answer += (a-cur_limit) // cur_limit)

print(answer)
# 44


### FIXED CODE ###

import sys

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

N = ir()
A = [ir() for _ in range(N)]
answer = A[0] - 1
cur_limit = 2
for a in A[1:]:
    if a == cur_limit:
        cur_limit += 1
        continue
    answer += -((-(a-cur_limit)) // cur_limit)

print(answer)
# 44
def erase(w, h, x, y):
    c[y][x] = '0'
    for dx, dy in ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)):
        nx, ny = x + dx, y + dy
        if 0 <= nx <= w -1 and 0 <= ny <= h - 1:
            if c[ny][nx] == '1':
                erase(w, h, nx, ny)

while True:
    w, h = map(int, input().split())
    if w == h == 0:
        break
    c = [[i for i in input().split()] for _ in range(h)]
    ans = 0
    for y in range(h):
        for x in range(w):
            if c[y][x] == '1':
                ans += 1
                erase(w, h, x, y)
    print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 5)
 
def erase(x, y):
    c[y][x] = '0'
    for dx, dy in ((1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1), (0, -1), (1, -1)):
        nx, ny = x + dx, y + dy
        if 0 <= nx < w and 0 <= ny < h and c[ny][nx] == '1':
            erase(nx, ny)
 
while True:
    w, h = map(int, input().split())
    if w == h == 0:
        break
    c = [input().split() for _ in range(h)]
    ans = 0
    for y in range(h):
        for x in range(w):
            if c[y][x] == '1':
                ans += 1
                erase(x, y)
    print(ans)