Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n = int(input())
a = [int(x) for x in input().split()]
a.sort()
b = [int(x) for x in input().split()]
b.sort()
c = [int(x) for x in input().split()]
c.sort()
l = [[a[i], b[i], c[i]] for i in range(n)]

def solve(value: int, key: int) -> bool:
    return value >= key

def binary_search(l, key: int) -> int:
    ng = -1
    ok = len(l)

    while abs(ok - ng) > 1:
        mid = int((ok + ng) / 2)
        if solve(l[mid], key):
            ok = mid
        else:
            ng = mid
    return ok

result = 0

for c_elem in c:
    cases = binary_search(b, c_elem)
    for b_elem in b[:cases]:
        tmp = binary_search(a, b_elem)
        result += tmp

print(result)
    
    

### FIXED CODE ###

from bisect import bisect_left, bisect_right

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

a.sort()
b.sort()
c.sort()

cnt = 0

for b_e in b:
    a_cases = bisect_left(a, b_e)
    c_cases = bisect_right(c, b_e)
    cnt += a_cases * (n - c_cases)
print(cnt)
### BUGGY CODE ###

n=int(input())
d={}
a=[]
for i in range(n):
  s=input()
  if s not in a:
    a.append(s)
  if s not in d:
    d[s]=1
  else:
    d[s]+=1
a.sort()
m=max(d.values())
for i in a:
  if d[i]==m:
    print(i)

### FIXED CODE ###

n=int(input())
d={}
a=[]
for i in range(n):
  s=input()
  if s not in d:
    d[s]=1
    a.append(s)
  else:
    d[s]+=1
m=max(d.values())
a.sort()
for i in a:
  if d[i]==m:
    print(i)
### BUGGY CODE ###

N = int(input())

def sum_10(n):
  return sum([int(l) for l in str(n)])

li=[]
for i in range(1,N//2 +1):
  for k in range(N-N//2,N+1):
    if i + k == N:
      li.append(sum_10(i)+sum_10(k))
print(min(li))      

### FIXED CODE ###

N = int(input())

def sum_10(n):
  return sum([int(l) for l in str(n)])

li=[]
for i in range(1,N//2 +1):
    if N - N//2 <= N - i <= N:
      li.append(sum_10(i)+sum_10(N - i))
print(min(li))
### BUGGY CODE ###

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

for i in range(N):
    A_list.append(int(input()))

ans_list = []
for i in range(N):
    if A_list[i] in ans_list:
        ans_list.pop(ans_list.index(A_list[i]))
    else:
        ans_list.append(A_list[i])

print(len(ans_list))

### FIXED CODE ###

import sys
input = sys.stdin.readline

N = int(input())

# 集合　listよりも 検索などが高速
# 重複なしの順序も無し
ans_set = set()

for i in range(N):
    A = int(input())
    if A in ans_set:
        ans_set.remove(A)
    else:
        ans_set.add(A)

print(len(ans_set))
### BUGGY CODE ###

a=int(input())
b=input().split(' ')
m=0
s=1
while m<a:
    s=s*int(b[m])
    
    m=m+1
if s>10**18:
	print(-1)

else:
    print(s)

### FIXED CODE ###

a=int(input())
b=input().split(' ')
m=0
s=1
i=0
o=0
while i<a:
    if int(b[i])==0:
        print(0)
        o=o+1
    i=i+1
while m<a and o==0:
    s=s*int(b[m])
    m=m+1
    if s>10**18 and o==0:
        print(-1)
        o=o+1
        break

if o==0:
    print(s)
### BUGGY CODE ###

import collections

n = int(input())
aa = []

for i in range(n):
  s = sorted(input())
  s = [''.join(s)]
  aa.append(*s)

cc = collections.Counter(aa)
c = [c[1] for c in cc.items() if c[1] >1]

def fact(n):
  x = 1
  for i in range(1, n+1):
    x *= i
  return x

def comb(n):
  return fact(n) / ( 2 * fact((n-2)))


ans = 0
for i in range(len(c)):
  ans += comb(c[i])
  

print(int(ans))


### FIXED CODE ###

import collections

from scipy.special import comb


n = int(input())
aa = []

for i in range(n):
  s = sorted(input())
  s = [''.join(s)]
  aa.append(*s)

cc = collections.Counter(aa)
c = [c[1] for c in cc.items() if c[1] >1]

ans = 0
for i in range(len(c)):
  ans += comb(c[i], 2, exact=True)
  

print(int(ans))
### BUGGY CODE ###

import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):  # リストに重複した要素があるか判定（要素にリストがある場合）
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


n, a, b = map(int, input().split())
x = []
while(len(x) < n):
    for i in range(a):
        x.append('b')
    for i in range(b):
        x.append('r')
# print(x[:n])
# print(x)
xx = x[:n]
print(xx.count('b'))


### FIXED CODE ###

import math
import string


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


def nCr(n, r):
    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))


def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not(item in seen):
            seen.append(item)
    return len(seq) != len(seen)


def divisor(n):
    divisor = []
    for i in range(1, n+1):
        if n % i == 0:
            divisor.append(i)
    return divisor


n, a, b = map(int, input().split())
ans = n//(a+b)*a
x = n % (a+b)
ans += min(x, a)
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
from decimal import Decimal

n = int(input())

arg = list(map(int, input().split()))
ans = 1

if 0 in arg:
    ans = 0
else:
    for m in arg:
        ans *= m

    if ans > 1000000000000000000:
        ans = -1

print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
n = int(input())

arg = list(map(int, input().split()))
ans = 1

if 0 in arg:
    ans = 0
else:
    for m in arg:
        ans *= m

        if ans > 1000000000000000000:
            ans = -1
            break

print(ans)
### BUGGY CODE ###

data1 = input()
data2 = input()
circle = int(data1.split()[0])

dist = [int(s) for s in data2.split()]
d = []
for base in dist:
  m = 0
  for e in dist:
    if e != base:
      m += min(abs(e-base),circle-abs(e-base))
  d.append(m)
print(min(d))

### FIXED CODE ###

data1 = input()
data2 = input()
circle = int(data1.split()[0])
house = int(data1.split()[1])
distance = [int(s) for s in data2.split()]
#隣接間の最大距離を省いてみる
between = []
for i,d in enumerate(distance):
  if i != house-1:
    between.append(distance[i+1]-d)
  else:
    between.append(circle-d+distance[0])
print(sum(between)-max(between))
### BUGGY CODE ###

n = int(input())
v = list(map(int,input().split()))
v_odd = []
v_even = []
for i in range(n//2):
    v_odd.append(v[2*i])
    v_even.append(v[2*i+1])
p1 = 0
p2 = 0
q1 = 0
q2 = 0
o_max = -1
e_max = -1
for i in range(n//2):
    a = v_odd[i]
    b = v_even[i]
    x = v_odd.count(a)
    y = v_even.count(b)
    if p1 <= x:
        if o_max != a:
            o_max = a
            p2 = p1
            p1 = x
    else:
        if x > p2:
            p2 = x
    if q1 <= y:
        if e_max != b:
            e_max = b
            q2 = q1
            q1 = y
    else:
        if y > q2:
            q2 = y
s = p1 + q1
if p1 == q1:
    if o_max == e_max:
        s = max(p2,q2) + p1
elif p1 > q2:
    if o_max == e_max:
        s = p1 + q2
else: 
    if o_max == e_max:
        s = p2 + q1
ans = n - s
print(ans)
  
        

### FIXED CODE ###

n = int(input())
v = list(map(int,input().split()))
v_odd = []
v_even = []
d_odd = {}
d_even = {}
o = []
e = []
for i in range(n//2):
    a = v[2*i]
    b = v[2*i+1]
    if a in d_odd:
        d_odd[a] += 1
    else:
        d_odd[a] = 1
        o.append(a)
    if b in d_even:
        d_even[b] += 1
    else:
        d_even[b] = 1
        e.append(b)
O = 0
E = 0
o_max = 0
o_second = 0
e_max = 0
e_second = 0
for i in o:
    x = d_odd[i]
    if x >= o_max:
        O = i
        o_max = x
d_odd.pop(O)
o.remove(O)
for i in o:
    x = d_odd[i]
    if x >= o_second:
        o_second = x
for i in e:
    y = d_even[i]
    if y >= e_max:
        E = i
        e_max = y
d_even.pop(E)
e.remove(E)
for i in e:
    y = d_even[i]
    if y >= e_second:
        e_second = y
if O == E:
    m = max(o_max+e_second,e_max+o_second)
else:
    m = o_max + e_max
print(n-m)
### BUGGY CODE ###

from collections import defaultdict,deque
import copy
import bisect

N = int(input())
A = list(map(int,input().split()))
graph = defaultdict(deque)
for _ in range(0,N-1):
    u,v = map(int,input().split())
    graph[u].append(v)
    graph[v].append(u)

arrive = [False] * (N+1)
dp_dict = [None] * N
dp_dict[0] = [A[0]]


ans = [None] *(N+1)
def dfs(s):
    stack = deque([s])
    while stack:
        v = stack[-1]
        arrive[v] = True
        if graph[v]:
            w = graph[v].pop()
            if arrive[w] == False:
                tar = A[w-1]
                dp = dp_dict[v-1].copy()
                if tar > dp[-1]:
                    dp.append(tar)
                else:
                    dp[bisect.bisect_left(dp, tar)] = tar
                ans[w] = len(dp)
                dp_dict[w-1] = dp
                stack.append(w)

        else:
            stack.pop()


dfs(1)
ans[1] = 1
for i in ans[1::]:
    print(i)

### FIXED CODE ###

import bisect
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)
 
N = int(input())
A = tuple(map(int, input().split()))
graph = [[] for _ in range(N + 1)]
for _ in range(N - 1):
    x, y = map(int, input().split())
    graph[x].append(y)
    graph[y].append(x)
 
ans = [-1] * (N + 1)
inf = 10**18
LIS = [inf] * (N + 1)
 
def DFS(s, parent=0):
    a = A[s - 1]
    i = bisect.bisect_left(LIS, a)
    v = LIS[i]
    LIS[i] = a
    ans[s] = bisect.bisect_left(LIS, inf)
    for t in graph[s]:
        if t == parent:
            continue
        DFS(t, s)
    LIS[i] = v
    return
 
DFS(1)
print(*ans[1:], sep="\n")
### BUGGY CODE ###

from math import gcd
from itertools import product


K = int(input())
l = product(range(1, K+1), repeat=3)

ans = 0
for a, b, c in l:
    ans += gcd(gcd(a, b), c)

print(ans)



### FIXED CODE ###

from math import gcd

K = int(input())

ans = 0
r = range(1, K+1)
for i in r:
    for j in r:
        for k in r:
            ans += gcd(gcd(i, j), k)

print(ans)
### BUGGY CODE ###

from collections import deque
h, w = map(int, input().split())
A = [list(input()) for _ in range(h)]
V = [[-1]*w for _ in range(h)]
que = deque([])
for i,a in enumerate(A):
    for j,_a in enumerate(a):
        if _a == '#':
            que.append([i,j])
            V[i][j] = 0
dhdw = [[-1,0],[1,0],[0,-1],[0,1]]
while que:
    nwh,nww = que.popleft()
    for dh, dw in dhdw:
        if not (0<=nwh+dh<h and 0<=nww+dw<w): continue
        if V[nwh+dh][nww+dw] != -1: continue
        V[nwh+dh][nww+dw] = V[nwh][nww]+1
        que.append([nwh+dh, nww+dw])
print(max(map(max, V)))

### FIXED CODE ###

from collections import deque
h, w = map(int, input().split())
A = [list(input()) for _ in range(h)]
V = [[-1]*w for _ in range(h)]
que = deque([])
for i,a in enumerate(A):
    for j,_a in enumerate(a):
        if _a == '#':
            que.append([i,j])
            V[i][j] = 0
dhdw = [[-1,0],[1,0],[0,-1],[0,1]]
while que:
    nwh,nww = que.popleft()
    for dh, dw in dhdw:
        if not (0<=nwh+dh<h and 0<=nww+dw<w): continue
        if V[nwh+dh][nww+dw] != -1: continue
        V[nwh+dh][nww+dw] = V[nwh][nww]+1
        que.append([nwh+dh, nww+dw])
print(max(map(max, V)))
### BUGGY CODE ###

L, R = list(map(int, input().split()))
a = (L * (L + 1)) % 2019
for i in range(L, R + 1):
    for j in range(i + 1, min(i + 2019, R + 1)):
        if (i * j) % 2019 < a:
            a = (i * j) % 2019
print(a)

### FIXED CODE ###

L, R = list(map(int, input().split()))
a = (L * (L + 1)) % 2019
for i in range(L, min(R + 1, L + 2019)):
    for j in range(i + 1, min(i + 2020, R + 1)):
        if (i * j) % 2019 < a:
            a = (i * j) % 2019
print(a)
### BUGGY CODE ###

# coding: utf-8
N, K = map(int, input().split())
P = list(map(int, input().split()))
# P.sort(reverse=True)
l = []
for i in range(N):
    l.append((P[i]+1) / 2)
ans = 0
for i in range(N-K+1):
    ans = max(ans, sum(l[i:i+K]))
print(ans)

### FIXED CODE ###

# coding: utf-8
N, K = map(int, input().split())
P = list(map(int, input().split()))
# P.sort(reverse=True)
l = []
for i in range(N):
    l.append((P[i]+1) / 2)
ans = 0
tmp = sum(l[:K-1])
p = l[0]
idx = 0
for i in range(K-1, N):
    tmp += l[i]
    # print(tmp)
    ans = max(ans, tmp)
    p = l[idx]
    tmp -= p
    idx += 1
print(ans)
### BUGGY CODE ###

import sys

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


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

    for i in range(M):
        b, c = map(int, input().split())
        A += [c] * b

    A = sorted(A, reverse=True)
    print(sum(A[:N]))


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys

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


def main():
    N, M = map(int, input().split())
    A = []
    for i in list(map(int, input().split())):
        A.append((i, 1))
    for i in range(M):
        b, c = map(int, input().split())
        A.append((c, b))

    A = sorted(A)
    # print(A)
    cnt = 1
    ans = 0
    while cnt <= N:
        b, c = A.pop()
        ans += b
        if c > 1:
            c -= 1
            A.append((b, c))
        cnt += 1
    print(ans)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

#coding: utf-8
from functools import reduce
def gcd(a, b):
    if b == 0:
        return a

    else:
        return gcd(b, a%b)
N, X = map(int, input().split())
x = list(map(int, input().split()))
x = [abs(X - x[i]) for i in range(N)]
l = [x[0]]
for i in range(len(x)):
    for j in range(i+1, len(x)):
        l.append(gcd(max(x[i], x[j]), min(x[i], x[j])))
print(min(l))

### FIXED CODE ###

#coding: utf-8
from functools import reduce
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a%b)
N, X = map(int, input().split())
x = list(map(int, input().split()))
x = [abs(X - x[i]) for i in range(N)]
l = reduce(gcd, x)
print(l)
### BUGGY CODE ###

K = int(input())

def gcd(n,m,l):
    A = [ n , m , l ]
    A = sorted(A)
    
    while A[0] % A[2] != 0 :
        A[0] , A[2] = A[2] , A[0] % A[2]

    while A[1] % A[2] != 0 :
        A[1] , A[2] = A[2] , A[1] % A[2]
    
    return A[2]
  
S = 0

for a in range (1, K + 1):
    for b in range (1, K + 1):
        for c in range (1, K + 1):
            S += gcd(a, b, c)

print ( S )
    



### FIXED CODE ###

K = int(input())

def gcd(n,m,l):
    if n < m :
        n , m = m , n
    while n % m != 0 :
        n , m = m , n % m
    
    if m < l :
        m , l = l , m
    while m % l != 0 :
        m , l = l , m % l
    
    return l
  
S = 0

for a in range (1, K + 1):
    for b in range (1, K + 1):
        for c in range (1, K + 1):
            S += gcd(a, b, c)

print ( S )
### BUGGY CODE ###

s=list(input())
count = 0
i = 0
while i<len(s)-1:
    if s[-1-i] == 'W' and s[-2-i] == 'B':
        s[-1-i] = 'B'
        s[-2-i] = 'W'
        count += 1
        i = i-1
    else:
        i += 1
print(count)

### FIXED CODE ###

s=list(input())
count = 0
black = 0
for name in s:
    if name == 'B':
        black += 1
    else:
        count += black
print(count)
### BUGGY CODE ###

import numpy as np

hint = list(map(int, input().split()))
s = [int(input()) for i in range(sum(hint))]
#print(s)

a = np.asarray(s[:hint[0]])
b = np.asarray(s[hint[0]:-hint[2]])
sum = 0
for t in s[-hint[2]:]:
    a_dis = a[np.argmin(np.abs(a-t))]
    b_dis = b[np.argmin(np.abs(b-t))]
    a_d = np.abs(a_dis-t)
    b_d = np.abs(b_dis-t)
    print(np.min([b_d + np.min(np.abs(a-b_dis)), a_d + np.min(np.abs(b-a_dis))]))

### FIXED CODE ###

import bisect
import numpy as np
 
hint = list(map(int, input().split()))
s = [int(input()) for i in range(sum(hint))]
# print(s)

def search_min_pos(arr, target):
  index = bisect.bisect_left(arr, target)
  if 0 == index:
    dist = arr[index]
  else:
    dist = arr[index-1:index+1]
  if not isinstance(dist, list):
    dist = [dist]
  return dist

a_arr = s[:hint[0]]
b_arr = s[hint[0]:-hint[2]]
sum = 0
for t in s[-hint[2]:]:
  a_pos = search_min_pos(a_arr, t)
  b_pos = search_min_pos(b_arr, t)
  #print(t, a_pos, b_pos)
  min_dist = 10 ** 11
  for a in a_pos:
    b_against_a = search_min_pos(b_arr, a)
    for ba in b_against_a:
      min_dist = min([min_dist, abs(t-a)+abs(ba-a)])
  for b in b_pos:
    a_against_b = search_min_pos(a_arr, b)
    for ab in a_against_b:
      min_dist = min([min_dist, abs(t-b)+abs(ab-b)])
  print(min_dist)
### BUGGY CODE ###

l,r = (int(i) for i in input().split())

ll = l % 2019
rr = r % 2019
mini = 1e+10
for i in range(l,r+1):
  for j in range(i+1,r+1):
    mini = min(mini, (i*j) % 2019)
print(mini)

### FIXED CODE ###

l,r = (int(i) for i in input().split())

if l <= 2019 <= r or r <= 2019 <= l or r - l >= 2019 or l - r >= 2019:
  print(0)
  exit(0)

while l // 2019 > 0 or r // 2019 > 0:
  l = l % 2019
  r = r % 2019

mini = 2*(1e+9)
if l < r:
  for i in range(l,r+1):
    for j in range(i+1,r+1):
      mini = min(mini, (i*j) % 2019)
elif l > r:
  for i in range(r,l+1):
    for j in range(i+1,l+1):

      mini = min(mini, (i*j) % 2019)
elif l == r:
  print(l*r% 2019)
  exit(0)
print(mini)
### BUGGY CODE ###

import heapq
def SME(start,end):
    A = []
    if end > N : end = N
    count = 0
    count2 = 0
    for i,x in enumerate(Whole[start:end]):
        heapq.heappush(A,[x,i])
    for j in range(start,end):
        a = heapq.heappop(A)
        tmp = count
        for i in range(L):
            idx = a[1] + i
            try :
                if ANS[idx] : continue
                else :
                    ANS[idx] = a[0]
                    count += 1
            except IndexError : continue
        if count == tmp : count2 += 1
        if count2 > 350 : break
    for i in range(L):
        if ANS[i] : continue
        else : ANS[i] = min(Whole[:i+1])
    for i in range(L,N):
        if ANS[i] : continue
        else : ANS[i] = min(Whole[i+1-L:i+1])
    return ANS

[N,L] = [int(x) for x in input().split()]
Whole = [int(x) for x in input().split()]
ANS = [None]*N
ANS = SME(0, N)
for i in ANS[L-1:-1]:print(i, end=" ")
print(ANS[-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
### BUGGY CODE ###

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

S, T = map(int, input().split())

q = [(S, 0)]
v = [[-1] * 3 for i in range(N+1)]

while q != []:
    a, t = q.pop(0)
    b = t % 3
    if v[a][b] != -1:
        continue
    v[a][b] = t
    t += 1
    for x in to[a]:
        q.append((x, t))
    #print(q)

if v[T][0] == -1:
    print("-1")
else:
    print(v[T][0] // 3)

### FIXED CODE ###

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

S, T = map(int, input().split())

from collections import deque

q = deque([(S, 0)])
v = [[-1] * 3 for i in range(N+1)]

while q:
    a, t = q.popleft()
    b = t % 3
    if v[a][b] != -1:
        continue
    v[a][b] = t
    t += 1
    for x in to[a]:
        q.append((x, t))
    #print(q)


if v[T][0] == -1:
    print("-1")
else:
    print(v[T][0] // 3)
### BUGGY CODE ###

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

while c<n:
  c=c+a+b
  ans+=a
  
if c==n:
  print(ans)
else:
  if c-n<=b:
    print(ans)
  else:
    print(ans-c+n+b)

### FIXED CODE ###

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

q=n//(a+b)
r=n-q*(a+b)
if r>=a:
  print(a*(q+1))
else:
  print(a*q+r)
### BUGGY CODE ###

from collections import deque


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

ab_list = [list(map(int,input().split())) for _ in range(m)]

ab_count = {key:[] for key in range(1,n+1)}

for i in range(m):
    ab_count[ab_list[i][0]].append(ab_list[i][1])
    ab_count[ab_list[i][1]].append(ab_list[i][0])


#print(ab_count)

que = deque()

#始点は1、階層は0からスタート
que.append([1,0])

checked_dict = {key:[] for key in range(1,n+1)}
temp_dict = {key:[] for key in range(1,n+1)}
where = 0

while que:
    x_pop = que.popleft()
    x = x_pop[0]
    if where != x_pop[1]:
        #階層が代わったから、temp_dictをchecked_dictへ反映させる処理
        for k in range(1,n+1):
            if len(checked_dict[k]) == 0:
                checked_dict[k] = temp_dict[k]
            else:
                aaa = set(checked_dict[k]) & set(temp_dict[k])
                if aaa != set():
                    checked_dict[k] = list(aaa)

    where = x_pop[1]

    for j in ab_count[x]:
        if len(checked_dict[j]) == 0:
            #OK,temp_dictに入れて、queに入れる。
            temp_dict[j].append(x)
            que.append([j,where+1])
        else:
            continue

    

print("Yes")
for i in range(2,n+1):
    print(checked_dict[i][0])



### FIXED CODE ###

from collections import deque


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

ab_list = [list(map(int,input().split())) for _ in range(m)]

ab_count = {key:[] for key in range(1,n+1)}

for i in range(m):
    ab_count[ab_list[i][0]].append(ab_list[i][1])
    ab_count[ab_list[i][1]].append(ab_list[i][0])


#print(ab_count)

que = deque()

#始点は1、階層は0からスタート
que.append([1,0])

checked_dict = {key:[] for key in range(1,n+1)}
#temp_dict = {key:[] for key in range(1,n+1)}
where = 0

while que:
    x_pop = que.popleft()
    x = x_pop[0]
    if where != x_pop[1]:
        pass
        ##階層が代わったから、temp_dictをchecked_dictへ反映させる処理
        #for k in range(1,n+1):
        #    if len(checked_dict[k]) == 0:
        #        checked_dict[k] = temp_dict[k]
        #    else:
        #        aaa = set(checked_dict[k]) & set(temp_dict[k])
        #        if aaa != set():
        #            checked_dict[k] = list(aaa)

    where = x_pop[1]

    for j in ab_count[x]:
        if len(checked_dict[j]) == 0:
            #OK,temp_dictに入れて、queに入れる。
            #temp_dict[j].append(x)
            checked_dict[j].append(x)
            que.append([j,where+1])
        else:
            continue

    

print("Yes")
for i in range(2,n+1):
    print(checked_dict[i][0])
### BUGGY CODE ###

#Replacing
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
Q = int(input())
u, count = np.unique(A,return_counts=True)
asum = A.sum()
for i in range(Q):
    B, C = list(map(int, input().split()))
    if B in u:
        posB = np.where(u==B)
        asum += int(count[posB]) * (C-B)
        # print(u)
        # print(count)
        if not (C in u):
            u[posB] = C
        else :
            posC = np.where(u==C)
            count[posC] += count[posB]
            u = np.delete(u,posB)
            count = np.delete(count,posB)
    print(asum)



### FIXED CODE ###

#Replacing
import numpy as np
N = int(input())
A = np.array(list(map(int, input().split())))
Q = int(input())
u, count = np.unique(A,return_counts=True)
L = np.zeros(10**5,int)
for i in range(len(u)):
    L[u[i]-1] = count[i]
asum = A.sum()
for i in range(Q):
    B, C = list(map(int, input().split()))
    asum += L[B-1] * (C-B)
    L[C-1] += L[B-1]
    L[B-1] = 0
    print(asum)
### BUGGY CODE ###

def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
r,g,b,n=IL()
L=[r,g,b]
L.sort()
s,m,l=L
ans=0
for i in range(n//l+1):
    for j in range(n//m+1):
        if n-i*l-j*m<0:
            break
        elif (n-i*l-j*m)%s==0:
            ans+=1
            
print(ans)

### FIXED CODE ###

def IL(): return list(map(int,input().split()))
def SL(): return input().split()
def I(): return int(input())
def S(): return list(input())
r,g,b,n=IL()
L=[r,g,b]
L.sort()
s,m,l=L
ans=0
for i in range(n//l+1):
    for j in range(n//m+1):
        if n-i*l-j*m<0:
            break
        elif (n-i*l-j*m)%s==0:
            ans+=1
            
print(ans)