Harryxun/stf_run huggingface dataset:
from collections import deque
from collections import Counter

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

c = [None]*h
d = [[-1 for i in range(w)] for j in range(h)]
dx = [1,0,-1,0]
dy = [0,1,0,-1]
kk = 0

for i in range(h):
    c[i] = input()
    
for i in range(h):
    for j in range(w):
        if c[i][j] == "#":
            d[i][j] = 0
    
def bfs(y,x):
    global kk
    d[y][x] = -1
    for k in range(4):
        nx = x + dx[k]
        ny = y + dy[k]
            
        if 0<=nx and nx<w and 0<=ny and ny<h and d[ny][nx] != -1:
            kk += 1
            bfs(ny,nx)
            

resmin  = 100000
an = []
res = 0
for i in range(h):
    for j in range(w):   
        if d[i][j] == 0:
            bfs(i,j)
            res += 1
            an.append(kk+1)
            
b = Counter(an)
if a == 1 and b == 1:
    print("Yes")
else:
    if b[1] != 0:
        print("No")
    else:
        print("Yes")

### FIXED CODE ###

import sys

h,w = map(int,input().split())
c = [None]*h
dx = [1,0,-1,0]
dy = [0,1,0,-1]

for i in range(h):
    c[i] = input()
    
for i in range(h):
    for j in range(w):
        a = 0
        b = 0
        for k in range(4):
            nx = j + dx[k]
            ny = i + dy[k]
            if c[i][j] == '#' and 0<=nx and nx<w and 0<=ny and ny<h:
                b += 1
                if c[ny][nx] == '.':
                    a += 1
                    
        if a == b and b != 0:
            print("No")
            sys.exit()
            
print("Yes")
import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()
    b = [LI() for _ in range(N)]

    for i in range(1,N):
        if b[i][0] < b[i-1][0] or b[i][1] < b[i-1][1]:
            r = max(math.ceil([i-1][0]/b[i][0]),math.ceil([i-1][1]/b[i][1]))
            b[i][0] *= r
            b[i][1] *= r
    print(sum(b[-1]))

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()
    b = [LI() for _ in range(N)]

    for i in range(1,N):
        if b[i][0] < b[i-1][0] or b[i][1] < b[i-1][1]:
            r = max((b[i-1][0]-1)//b[i][0],(b[i-1][1]-1)//b[i][1]) + 1
            b[i][0] *= r
            b[i][1] *= r
    print(sum(b[-1]))


if __name__ == '__main__':
    main()
a,b=map(int,input().split())

c=[]
for i in range(1,b+1):
	c.append(i*100**a)
if b!=100:
	print(c[b-1])
else:
	print(c[b])


### FIXED CODE ###

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

c=[]
for i in range(1,102):
	c.append(i*100**a)
if b!=100:
	print(c[b-1])
else:
	print(c[b])
def trace(i, j, S, col, num_color):
    next_col = 1 - col
    num_color[col] += 1
    S[i][j] = 2
    if S[i-1][j] == next_col:
        trace(i-1, j, S, next_col, num_color)
    if S[i][j-1] == next_col:
        trace(i, j-1, S, next_col, num_color)
    if S[i+1][j] == next_col:
        trace(i+1, j, S, next_col, num_color)
    if S[i][j+1] == next_col:
        trace(i, j+1, S, next_col, num_color)
    return num_color[0] * num_color[1]

H, W = map(int, input().split())
# 黒0，白1，padding2
S = [[2] * (W+2)]
for _ in range(H):
    S.append([2] + [0 if s == '#' else 1 for s in input()] + [2])
S.append([2] * (W+2))
# print(S)
num_comb = 0
for i in range(1, H+1):
    for j in range(1, W+1):
        if S[i][j] == 0:
            num_color = [0, 0]
            num_comb += trace(i, j, S, 0, num_color)
print(num_comb)


### FIXED CODE ###

import sys
sys.setrecursionlimit(100000000)

def trace(i, j, S, col, num_color):
    next_col = 1 - col
    num_color[col] += 1
    S[i][j] = 2
    if S[i-1][j] == next_col:
        trace(i-1, j, S, next_col, num_color)
    if S[i][j-1] == next_col:
        trace(i, j-1, S, next_col, num_color)
    if S[i+1][j] == next_col:
        trace(i+1, j, S, next_col, num_color)
    if S[i][j+1] == next_col:
        trace(i, j+1, S, next_col, num_color)
    return num_color[0] * num_color[1]

def main():
    H, W = map(int, input().split())
    # 黒0，白1，padding2
    S = [[2] * (W+2)]
    for _ in range(H):
        S.append([2] + [0 if s == '#' else 1 for s in input()] + [2])
    S.append([2] * (W+2))
    num_comb = 0
    for i in range(1, H+1):
        for j in range(1, W+1):
            if S[i][j] == 0:
                num_color = [0, 0]
                num_comb += trace(i, j, S, 0, num_color)
    print(num_comb)

main()
a,b,x=list(map(int,input()))
if a+b >= x:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a,b,x=list(map(int,input().split()))
if a+b >= x and a <= x:
  print("YES")
else:
  print("NO")
h, a = map(int, input())

print(h//a + int(h%a!=0))


### FIXED CODE ###

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

print(h//a + int(h%a!=0))
import fractions
import math
import heapq
import collections

A,B = map(int, input().split(" "))
G = fractions.gcd(A,B)

S = set()


def p_fac(N):
  ans = 2
  if (N % 2 == 0):
    ans += 1
    while(N % 2 ==0):
      N = N // 2
  a = 3
  while(a < N):
    if (N % a == 0):
      ans += 1
      while( N % a == 0):
        N = N // a
    a += 2

  return ans

print(p_fac(G))



### FIXED CODE ###

N = int(input())

if N % 2 == 0:
  print(1/2)
else:
  n = N // 2 + 1
  print(n /N )
N = int(input())
S = input()

z = []
for i in range(1,N):
  x = S[:i]
  y = S[i:]
  if set(x) & set(y):
    z.append(len(set(x)&set(y)))
  else:
    continue

print(max(z))

### FIXED CODE ###

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

z = []
for i in range(1,N):
  x = S[:i]
  y = S[i:]
  if set(x) & set(y):
    z.append(len(set(x)&set(y)))
  else:
    continue

print(max(z) if len(z) != 0 else 0)
import math
n = input()
c = 0

for i in range(n):
    x = input()
    if x == 1:
        x = 0
    for j in range(2,math.floor(math.sqrt(float(x)))+ 1):
        if x % j == 0:
            x = 0
            break
    if x != 0:
        c += 1	
print(c)

### FIXED CODE ###

import math
n = int(input())
count = 0
for i in range(n):
    a = int(input())
    for j in range(2,int(math.sqrt(a) + 1)):
        if a % j == 0:
            break
    else:
        count += 1  
print(count)
in = list(map(int, input().split()))
print(max(in)*10+sum(in)-max(in))

### FIXED CODE ###

lst = list(map(int, input().split()))
print(max(lst)*10+sum(lst)-max(lst))
N = int(input())
ans = 0
for i in range(1,N+1,2):
  cnt = 0
  for j in range(i):
    if i%j==0:
      cnt += 1
  if cnt == 8:
    ans += 1
print(ans)
  

### FIXED CODE ###

N = int(input())
ans = 0
for i in range(1,N+1,2):
  cnt = 0
  for j in range(1,i+1):
    if i%j==0:
      cnt += 1
  if cnt == 8:
    ans += 1
print(ans)
n = int(input())
c = ','.join(input()).split(',')

ans = 0

ri = -1

for i in range(n):
    if c[i] == 'W':
        while c[ri] != 'R':
            ri -= 1
        
        if n < i-ri:
            break
        
        c[i], c[ri] = 'R', 'W'
        ans += 1
    
print(ans)

### FIXED CODE ###

n = int(input())
c = ','.join(input()).split(',')

ans = 0

ri = -1

if c.count('W') == 0:
    print(0)
    exit()

if c.count('R') == 0:
    print(0)
    exit()

for i in range(n):
    if c[i] == 'W':
        while c[ri] != 'R':
            ri -= 1
        
        if n < i-ri:
            break
        
        c[i], c[ri] = 'R', 'W'
        ans += 1
    
print(ans)
from operator import itemgetter

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

a = []
R=[]
D = 0
X = 0
for i in range(N):
    a.append(list(map(int,input().split())))
if N ==1:
    Z = M*int(a[0])
    print(Z)
else:
    a.sort(key = itemgetter(0))

    for i in range(N):
        D += a[i][1]
        if D>M:
            R.append(i)
            break
    for i in range(R[0]+1):
        X += a[i][0]*a[i][1]
    Y = X-(D-M)*a[R[0]][0]
    print(Y)

### FIXED CODE ###

from operator import itemgetter

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


a = [list(map(int,input().split())) for i in range(N)]

if N ==1:
    Z = M*a[0][0]
    print(Z)
else:
    a.sort(key = itemgetter(0))
    X = 0 
    D = 0
    var=0
    while M>D:
        D+=a[var][1]
        X+=a[var][0]*a[var][1]
        var+=1
        
    X += a[var-1][0]*(M-D)
    print(X)
import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    ga, sa, ba = map(int, rl().split())
    gb, sb, bb = map(int, rl().split())
    
    dp1 = [0] * 20000
    dp1[0] = N
    M = N
    for i in range(N + 1):
        dp1[i + ga] = max(dp1[i + ga], dp1[i] - ga + gb)
        dp1[i + sa] = max(dp1[i + sa], dp1[i] - sa + sb)
        dp1[i + ba] = max(dp1[i + ba], dp1[i] - ba + bb)
        M = max(M, dp1[i])
    
    dp2 = [0] * 20000
    dp2[0] = M
    ans = M
    for i in range(M + 1):
        dp2[i + gb] = max(dp2[i + gb], dp2[i] - gb + ga)
        dp2[i + sb] = max(dp2[i + sb], dp2[i] - sb + sa)
        dp2[i + bb] = max(dp2[i + bb], dp2[i] - bb + ba)
        ans = max(ans, dp2[i])
    print(ans)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 7)
rl = sys.stdin.readline


def solve():
    N = int(rl())
    ga, sa, ba = map(int, rl().split())
    gb, sb, bb = map(int, rl().split())
    
    dp1 = [0] * 30000000
    dp1[0] = N
    M = N
    for i in range(N + 1):
        dp1[i + ga] = max(dp1[i + ga], dp1[i] - ga + gb)
        dp1[i + sa] = max(dp1[i + sa], dp1[i] - sa + sb)
        dp1[i + ba] = max(dp1[i + ba], dp1[i] - ba + bb)
        M = max(M, dp1[i])
    
    dp2 = [0] * 30000000
    dp2[0] = M
    ans = M
    for i in range(M + 1):
        dp2[i + gb] = max(dp2[i + gb], dp2[i] - gb + ga)
        dp2[i + sb] = max(dp2[i + sb], dp2[i] - sb + sa)
        dp2[i + bb] = max(dp2[i + bb], dp2[i] - bb + ba)
        ans = max(ans, dp2[i])
    print(ans)


if __name__ == '__main__':
    solve()
h, w, k = [int(x) for x in input.split()]
ans = 0

grid = []

for i in range(h):
	grid.append(input.split())

black = 0

for maskRow in range(0, 1 << h):
	for maskCol in range(0, 1 << w):
      black = 0
      for i in range(h):
        for j in range(w):
          if (maskRow >> i) & 1 == 0 and (maskCol >> j) & 1 == 0 \
                                                    and grid[i][j] == '#':
              black += 1
      if black == k:
        ans += 1

print(ans)


### FIXED CODE ###

# def c():
#     n = int(input())
#     inp = {}
#     for i in range(n):
#         a = input()
#         if inp.get(a) is None:
#             inp[a] = 0
#         inp[a] += 1
#     print(f"AC x {0 if inp.get('AC') is None else inp.get('AC')}")
#     print(f"WA x {0 if inp.get('WA') is None else inp.get('WA')}")
#     print(f"TLE x {0 if inp.get('TLE') is None else inp.get('TLE')}")
#     print(f"RE x {0 if inp.get('RE') is None else inp.get('RE')}")

# c()


h, w, k = [int(x) for x in input().split()]
ans = 0

grid = []

for i in range(h):
    grid.append(list(input()))

black = 0

for maskRow in range(0, 1 << h):
    for maskCol in range(0, 1 << w):
        black = 0
        for i in range(h):
            for j in range(w):
                if (maskRow >> i) & 1 == 0 and (maskCol >> j) & 1 == 0 \
                                                    and grid[i][j] == '#':
                    black += 1
        if black == k:
            ans += 1

print(ans)
from fractions import gcd
from functools import reduce
import numpy as np

MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
np_A = np.array(A)

B = [1 for i in range(N)]
global_lcm = np.lcm.reduce(np_A)
ans = 0
for i in range(N):
    B[i] = int(global_lcm//A[i])
    ans += B[i] % MOD
    ans %= MOD

print(ans)

### FIXED CODE ###

from fractions import gcd
from functools import reduce, lru_cache

MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))

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

B = [1 for i in range(N)]
global_lcm = reduce(lcm, A) % MOD
ans = 0
for i in range(N):
    ans += (global_lcm*pow(A[i], MOD-2, MOD)) % MOD
    ans %= MOD

print(ans)
import itertools
L, R = map(int, input().split())

if R - L + 1 > 2019:
    remainder_list = [N%2019 for N in range(L, L+2019)]
else:
    remainder_list = [N%2019 for N in range(L, R+1)]  
remainder_list = list(set(remainder_list))
all_list = [(i*j)%2019 for i, j in list(itertools.combinations(remainder_list, 2))]
print(min(all_list))

### FIXED CODE ###

N, A, B = map(int, input().split())
if N*A > B:
    print(B)
else:
    print(N*A)
from collctions import Counter

S = list(input())
T = list(input())

Scount = Counter(S).values()
Tcount = Counter(T).values()



if sorted(Scount) == sorted(Tcount):
    ans = 'Yes' 
else:
    ans = 'No'

print(ans)

### FIXED CODE ###

from collections import Counter

S = list(input())
T = list(input())

Scount = Counter(S).values()
Tcount = Counter(T).values()



if sorted(Scount) == sorted(Tcount):
    ans = 'Yes' 
else:
    ans = 'No'

print(ans)
N = int(input())
    if N == 1:
        print("Hello World")
    elif N == 2
        a,b = int(input().split())
        print(a+b)



### FIXED CODE ###

n = int(input())
if n == 1:
    print("Hello World")
elif n == 2:
    a = int(input())
    b = int(input())
    print(a + b)
def num():
    return int(input())
def nums():
    return list(map(int,input().split()))

X,Y,Z,K = nums()
A = nums()
B = nums()
C = nums()

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

AB = [bi + ai for bi in B for ai in A]
res = []
for ab_sum in AB[:K]:
    for ci in C[:K]:
        res.append(ab_sum + ci)
res.sort(reverse=True)
for ans in res[:K]:
    print(ans)

### FIXED CODE ###

def num():
    return int(input())
def nums():
    return list(map(int,input().split()))

X,Y,Z,K = nums()
A = nums()
B = nums()
C = nums()

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

AB = [bi + ai for bi in B for ai in A]
AB.sort(reverse=1)
res = []
for ab_sum in AB[:K]:
    for ci in C[:K]:
        res.append(ab_sum + ci)
res.sort(reverse=True)
for ans in res[:K]:
    print(ans)
import sys
sys.setrecursionlimit(100000)

N = int(input())

edges = {n: [] for n in range(N+1)}

for _ in range(N-1):
    a, b, c = map(int, input().split())

    edges[a].append((b, c))
    edges[b].append((a, c))

Q, K = map(int, input().split())
xy = []
for _ in range(Q):
    xy.append(tuple(map(int, input().split())))


d = [-1] * (N+1)
d[K] = 0


def dfs(n: int):
    for m, c in edges[n]:
        if d[m] == -1:
            d[m] = d[n] + c
            dfs(m)


dfs(K)

for x, y in xy:
    print(d[x] + d[y])

### FIXED CODE ###

import sys
sys.setrecursionlimit(100005)

N = int(input())

edges = {n: [] for n in range(N+1)}

for _ in range(N-1):
    a, b, c = map(int, input().split())

    edges[a].append((b, c))
    edges[b].append((a, c))

Q, K = map(int, input().split())
xy = []
for _ in range(Q):
    xy.append(tuple(map(int, input().split())))


d = [-1] * (N+1)
d[K] = 0


def dfs(n: int):
    for m, c in edges[n]:
        if d[m] == -1:
            d[m] = d[n] + c
            dfs(m)


dfs(K)

for x, y in xy:
    print(d[x] + d[y])
x,y=map(int,input().split())

if y%2==0 and y/x<=4 and y/x>=2:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

for num in range(len(a)):
    if a[num]==0:
        print(num+1)
import sys
import itertools
import networkx as nx
H, W = [int(_) for _ in input().split()]
S = b''.join(sys.stdin.buffer.read().split())

source = 2 * H * W
sink = source + 1

INF = H * W * 3

graph = nx.DiGraph()


def add(start, end, cap):
    graph.add_edge(start, end, capacity=cap)


for i in range(H * W):
    x, y = divmod(i, W)
    if S[i] == ord('.'):
        add(2 * i, 2 * i + 1, 1)
    else:
        add(source, 2 * i + 1, INF)
    for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
        x1, y1 = x + dx, y + dy
        if 0 <= x1 < H and 0 <= y1 < W:
            j = x1 * W + y1
            add(2 * i + 1, 2 * j, INF)
        else:
            add(2 * i + 1, sink, INF)
ans = nx.minimum_cut_value(graph, source, sink)
ans = ans if ans < INF else -1
print(ans)


### FIXED CODE ###

import sys
import itertools
from scipy.sparse import csr_matrix, lil_matrix
from scipy.sparse.csgraph import maximum_flow

H, W = map(int, sys.stdin.buffer.readline().split())
S = b''.join(sys.stdin.buffer.read().split())

source = 2 * H * W
sink = source + 1

INF = source * 2

graph = lil_matrix((sink + 1, sink + 1), dtype=int)

for i in range(H * W):
    x, y = divmod(i, W)
    if S[i] == ord('.'):
        graph[2 * i, 2 * i + 1] = 1
    else:
        graph[source, 2 * i + 1] = INF
    for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
        x1, y1 = x + dx, y + dy
        if 0 <= x1 < H and 0 <= y1 < W:
            j = x1 * W + y1
            graph[2 * i + 1, 2 * j] = 1
        else:
            graph[2 * i + 1, sink] = INF
graph = graph.tocsr()
ans = maximum_flow(graph, source, sink).flow_value
ans = ans if ans < INF else -1
print(ans)
import numpy as np

[H, W, M] = map(int, input().split())
mp = np.zeros((H+1, W+1), dtype=np.int64)
for i in range(M):
    [h, w] = map(int, input().split())
    mp[h][w] = 1

colsum = np.sum(mp, axis=0)
rowsum = np.sum(mp, axis=1)

maxcol = max(colsum)
maxrow = max(rowsum)

#colchk = np.where(colsum==maxcol)
#rowchk = np.where(rowsum==maxrow)

#for i in range(len(rowchk[0])):
#    for j in range(len(colchk[0])):
#        if mp[rowchk[0][i]][colchk[0][j]] == 0:
#            print(int(max(colsum)+max(rowsum)))
#            quit()

print(int(max(colsum)+max(rowsum))-1)



### FIXED CODE ###

import numpy as np

[H, W, M] = map(int, input().split())
colsum = np.zeros(W+1)
rowsum = np.zeros(H+1)
bombs = []
rowbombs = [set() for i in range(H+1)]
for i in range(M):
    [h, w] = map(int, input().split())
    rowsum[h] += 1
    colsum[w] += 1
    bombs.append([h, w])
    rowbombs[h].add(w)

maxcol = max(colsum)
maxrow = max(rowsum)

colchk = np.where(colsum==maxcol)
rowchk = np.where(rowsum==maxrow)

for i in range(len(rowchk[0])):
    for j in range(len(colchk[0])):
        if colchk[0][j] not in rowbombs[rowchk[0][i]]:
            print(int(max(colsum)+max(rowsum)))
            quit()

print(int(max(colsum)+max(rowsum))-1)
from itertools import combinations
from sys import exit, stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
A.sort()
max_a = A[-1]
A.pop(N-1)
ans = 0
ans_a = 0
for a in A:
    tmp = len(list(combinations(range(max_a), a)))
    if tmp > ans:
        ans = tmp
        ans_a = a
print(max_a, ans_a)

### FIXED CODE ###

from sys import stdin
N = int(stdin.readline().rstrip())
A = [int(_) for _ in stdin.readline().rstrip().split()]
A.sort()
max_a = A[-1]
print(max_a, min(A, key=lambda a:abs(max_a-a*2)))
data = [
    [[0 for r in range(10)] for f in range(3) ] for b in range(4)
] 


count = int(input())
for c in range(count):
    b, f, r, v = [int(i) i in input().split()]
    data[b-1] [f-1] [r-1] += v

for bi, b in enumerate(data):
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')
        print()
    print()
  if bi < 3:
     print('#' * 20)

### FIXED CODE ###

data = [
    [[0 for r in range(10)] for f in range(3) ] for b in range(4)
] 


count = int(input())
for c in range(count):
    b, f, r, v = [int(i) for i in input().split()]
    data[b-1] [f-1] [r-1] += v

for bi, b in enumerate(data):
    for f in b:
        for r in f:
            print(' {0}'.format(r), end='')
        print()
    
    if bi < 3:
        print('#' * 20)
if __name__ == '__main__':
    l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    k = int(input())
    print(l[k + 1])

### FIXED CODE ###

if __name__ == '__main__':
    l = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
    n = int(input())
    print(l[n - 1])
a,b = map(int,input().split())
cnt = 0
for i in range(a,b+1):
  if str(i)[0]==str(i)[-1] and str(i)[1] = str(i)[-2]:
    cnt +=1
print(cnt)

### FIXED CODE ###

a,b = map(int,input().split())
cnt = 0
for i in range(a,b+1):
  if str(i)[0]==str(i)[-1] and str(i)[1] == str(i)[-2]:
    cnt +=1
print(cnt)
S=input()
h=S/3600
m=(S%3600)/60
s=S-(h*3600)-(m*60)
print("%d:%d:%d"%(h,m,s)

### FIXED CODE ###

t=int(input())
h=t//3600
m=(t%3600)//60
s=t-h*3600-m*60
print('{}:{}:{}'.format(h,m,s))
N,M = map(int,input().split())
hole=[]
for i in range(M):
    hole.append(int(input()))
res = 0

def serach(locale, num):
    global res
    if locale + num > N:
        return

    if locale + num == N:
        res+=1
        if res >= 1000000007:
            res=res%1000000007
        return

    if locale + num in hole:
        return

    serach(locale+num, 1)
    serach(locale+num, 2)

serach(0,1)
serach(0,2)

print(res)


### FIXED CODE ###

min = 9999999
input()
balances = list(map(int, input().split()))
for i in range(1, len(balances)):
    S1=sum(balances[:i])
    S2=sum(balances[i:])

    if min > abs(S1-S2):
        min = abs(S1-S2)
print(min)
x = int(input())
print(**3)


### FIXED CODE ###

x = int(input())
print(x**3)
#coding:utf-8
import math
x, y = map(int, input().split())
ls = [y-x,y+x+1,-y-x+1,-y+x+2]
ls = [math.inf if i<0 else i for i in ls]
#print (ls)
print (min(ls))

### FIXED CODE ###

#coding:utf-8
x, y = map(int, input().split())
def func(a):
    if a<0:
        return 1e+10
    else:
        return a
ls = [func(y-x),func(y+x)+1,func(-y-x)+1,func(-y+x)+2]
print (min(ls))
from itertools import product
from heapq import heappop, heappush

x,y,z,k = map(int,input().split())
a = sorted(map(int, input().split()), reverse=True)
b = sorted(map(int, input().split()), reverse=True)
c = sorted(map(int, input().split()), reverse=True)

if x * y * z <= 3000:
    lst = sorted([sum(i) for i in product(a,b,c)], reverse=True)
    [print(i) for i in lst[:k]]
    exit()

lst = []
idx = [0,0,0]
heap = []

xxx = [x,y,z]
aaa = idx[0] if idx[0]+1 >= x else idx[0] + 1
bbb = idx[1] if idx[1]+1 >= y else idx[1] + 1
ccc = idx[2] if idx[2]+1 >= z else idx[2] + 1
heappush(heap, [-([aaa] + b[idx[1]] + c[idx[2]]), 0])
heappush(heap, [-([idx[0]] + b[bbb] + c[idx[2]]), 1])
heappush(heap, [-([idx[0]] + b[idx[1]] + c[ccc]), 2])
print(a[idx[0]] + b[idx[1]] + c[idx[2]])
for _ in range(k-1):
    score, ix = heappop(heap)
    print(-score)
    print(idx)
    idx[ix] = idx[ix] if idx[ix] + 1 >= xxx[ix] else idx[ix] + 1
    score = ([idx[0]] + b[idx[1]] + c[idx[2]])
    heappush(heap, [-score, ix])

# lst.sort(reverse=True)
# [print(i) for i in lst[:k]]


### FIXED CODE ###

*xyz,k = map(int, input().split()) 
xyz_list = []
xyz_list.append(list(map(int, input().split())))
xyz_list.append(list(map(int, input().split())))
xyz_list.append(list(map(int, input().split())))
xyz_list[0].sort(reverse=True)
xyz_list[1].sort(reverse=True)
xyz_list[2].sort(reverse=True)

print(xyz_list[0][0]+xyz_list[1][0]+xyz_list[2][0])
p = [1,0,0]
num = lambda x: [
    [x[0]+p[i], x[1]+p[(4-i)%3], x[2]+p[(5-i)%3],
    xyz_list[0][x[0]+p[i]]+xyz_list[1][x[1]+p[(4-i)%3]]+xyz_list[2][x[2]++p[(5-i)%3]]]
    for i in range(3) if x[i]+1 < xyz[i]]
stack = num([0,0,0])
num_dict={}
for i in stack:
    if i[3] not in num_dict:
        num_dict[i[3]] = [[i[0], i[1], i[2]]]
    else:
        num_dict[i[3]].append([i[0], i[1], i[2]])
k -= 1
while k != 0:
    x, y, z, maxi = max(stack, key=lambda x:x[3])
    print(maxi)
    k -= 1
    if k == 0:
      break
    stack.remove([x,y,z,maxi])
    for i in num([x,y,z]):
        if i[3] not in num_dict:
            num_dict[i[3]] = [[i[0], i[1], i[2]]]
            stack.append([i[0], i[1], i[2], i[3]])
        elif [i[0], i[1], i[2]] not in num_dict[i[3]]:
            num_dict[i[3]].append([i[0], i[1], i[2]])
            stack.append([i[0], i[1], i[2], i[3]])
import math
A,B,C,D = map(int, input().split())
X = B//C - (A-1)//C
Y = B//D - (A-1)//D
lcm = round(C*D//gcd(C,D))
Z = B//lcm - (A-1)//lcm
print(B-A+1-X-Y+Z)

### FIXED CODE ###

from fractions import gcd
A,B,C,D = map(int, input().split())
X = B//C - (A-1)//C
Y = B//D - (A-1)//D
lcm = round(C*D//gcd(C,D))
Z = B//lcm - (A-1)//lcm
print(B-A+1-X-Y+Z)
r,g,b = int(input()).split()

a = r * 100 + g * 10 + b
if a % 4 == 0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

r,g,b = map(int,input().split())

a = r * 100 + g * 10 + b
if a % 4 == 0:
  print("YES")
else:
  print("NO")