Harryxun/stf_run huggingface dataset:
a, b, c = map (int, input().split())
count = 0
for i in range(a, b+1):
    if c % i == 0:
        count += 1

print (count)

### FIXED CODE ###

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

print ("%d %d %.10f" % (a // b, a % b, a / b))
a, b = [int(x) for x in input().split()]

if b > 3:
    if a <= 1:
        s_c = 1

    a_keta = len(str(bin(a))) - 2
    b_keta = len(str(bin(b))) - 2
    m_a = (2 ** a_keta - a) % 4
    m_b = (b - (2 ** (b_keta-1)) + 1) % 4
    #print(m_a)
    #print(m_b)

    if m_a == 0:
        s_a = 0
    elif m_a == 1:
        s_a = a
    elif m_a == 2:
        s_a = 1
    elif m_a == 3:
        s_a = a - 1

    if m_b == 0:
        s_b = 0
    elif m_b == 1:
        s_b = b
    elif m_b == 2:
        s_b = 1
    elif m_b == 3:
        s_b = b + 1
    print(s_a ^ s_b ^ s_c)
else:
    if a == 0 and b == 0:
        print(0)
    if a == 0 and b == 1:
        print(1)
    if a == 0 and b == 2:
        print(3)
    if a == 0 and b == 3:
        print(0)
    if a == 1 and b == 1:
        print(1)
    if a == 1 and b == 2:
        print(3)
    if a == 1 and b == 3:
        print(0)
    if a == 2 and b == 2:
        print(2)
    if a == 2 and b == 3:
        print(1)
    if a == 3 and b == 3:
        print(3)


### FIXED CODE ###

a, b = [int(x) for x in input().split()]

if b > 3:
    if a <= 1:
        s_c = 1
    else:
        s_c = 0

    a_keta = len(str(bin(a))) - 2
    b_keta = len(str(bin(b))) - 2
    m_a = (2 ** a_keta - a) % 4
    m_b = (b - (2 ** (b_keta-1)) + 1) % 4
    #print(m_a)
    #print(m_b)

    if m_a == 0:
        s_a = 0
    elif m_a == 1:
        s_a = a
    elif m_a == 2:
        s_a = 1
    elif m_a == 3:
        s_a = a - 1

    if m_b == 0:
        s_b = 0
    elif m_b == 1:
        s_b = b
    elif m_b == 2:
        s_b = 1
    elif m_b == 3:
        s_b = b + 1
    print(s_a ^ s_b ^ s_c)
else:
    if a == 0 and b == 0:
        print(0)
    if a == 0 and b == 1:
        print(1)
    if a == 0 and b == 2:
        print(3)
    if a == 0 and b == 3:
        print(0)
    if a == 1 and b == 1:
        print(1)
    if a == 1 and b == 2:
        print(3)
    if a == 1 and b == 3:
        print(0)
    if a == 2 and b == 2:
        print(2)
    if a == 2 and b == 3:
        print(1)
    if a == 3 and b == 3:
        print(3)
N,K=map(int,input().split())

Sanuke=list(range(K))

for i in range(N):
  di=int(input())
  A=list(map(int,input().split()))
  for j in A:
    Sanuke[j]+=1

higaisha=0

for i in Sanuke:
  if i ==0:
    higaisha += 1

print(higaisha)

### FIXED CODE ###

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

ans=[0]*n

for i in range(k):
  d=int(input())
  a=[int(k) - 1 for k in input().split()]
  for j in a:
    ans[j]+=1

ansint=0


for i in range(n):
  if ans[i]==0:
    ansint+=1


print(ansint)
L = sorted(list(map(int, input().split())))
print('Yes' if sum(L[:2] == L[2]) else 'No')

### FIXED CODE ###

L = [int(x) for x in input().split()]
L.sort()
if L[0] + L[1] == L[2]:
    print("Yes")
else:
    print("No")
N, Y =map(int,input().split(" "))
for i in range(N+1):
    for j in range(N-i+1):
        if i * 10000 + j*5000 + (N-i-j)*1000 ==y:
            print(i, j, N-i-j)
            exit()
print(-1, -1, -1)

### FIXED CODE ###

N, Y =map(int,input().split(" "))
for i in range(N+1):
    for j in range(N-i+1):
        if i * 10000 + j*5000 + (N-i-j)*1000 ==Y:
            print(i, j, N-i-j)
            exit()
print(-1, -1, -1)
n,k,c = map(int,input().split())
s = list(input())

front = [0]*n
back = [0]*n

# 前から貪欲
c = k
i = 0
while c > 0:
  if s[i] == "o":
    front[i] = 1
    i += c+1
  else:
    i += 1
  c -= 1

# 後ろから貪欲

c = k
i = n-1
while c > 0:
  if s[i] == "o":
    back[i] = 1
    i -= c+1
  else:
    i -= 1
  c -= 1
  
for i in range(n):
  if front[i] == 1 and back[i] == 1:
    print(i+1)

### FIXED CODE ###

import copy
 
n,k,c = map(int,input().split())
s = list(input())
 
front = []
back = []
 
# 前から貪欲
j = copy.copy(k)
i = 0
while j > 0:
  if s[i] == "o":
    front.append(i)
    i += c+1
    j -= 1
  else:
    i += 1
 
# 後ろから貪欲
 
j = copy.copy(k)
i = n-1
while j > 0:
  if s[i] == "o":
    back.append(i)
    i -= c+1
    j -= 1
  else:
    i -= 1

back.sort()
for i in range(k):
  if front[i] == back[i]:
    print(front[i]+1)
N, K = map(int,input().split())
h = map(int,input().split())
count = 0
for i in range(N):
  if K <= h[i]:
    count = count + 1
  else:
    continue
    
print(count)

### FIXED CODE ###

N, K = map(int,input().split())
h = list(map(int,input().split()))
count = 0
for i in range(N):
  if K <= h[i]:
    count = count + 1
  else:
    continue
    
print(count)
N = int(input())
H = [int(h) for h in input().split()]
cost = [0]*N

def dp(i):
  if i == 0:
    return 0
  elif i == 1:
    return abs(H[i-1] - H[i])
  else:
    return min(
      dp(i-1) + abs(H[i-1] - H[i]), 
      dp(i-2) + abs(H[i-2] - H[i]))
  
print(dp(N-1))

### FIXED CODE ###

import sys
#from functools import lru_cache
sys.setrecursionlimit(100000)

N = int(input())
H = [int(h) for h in input().split()]
INF = 10**5+1
cost = [INF]*N
cost[0] = 0
cost[1] = abs(H[0] - H[1])

#@lru_cache(maxsize=None)
def dp(i):
  if cost[i] != INF:
    return cost[i]
  else:
    cost[i] = min(
      dp(i-1) + abs(H[i-1] - H[i]),
      dp(i-2) + abs(H[i-2] - H[i]))
  return cost[i]

for i in range(N-1):
  dp(i)
print(dp(N-1))
import math

N = input()
list = []
min = 0
for i in range(5):
	list.append(int(input()))
	if min > list[i] or i = 0:
      min = list[i]

print(math.ceil(N/min) + 4)


### FIXED CODE ###

import math

N = int(input())
list = []
min = 0
for i in range(5):
  list.append(int(input()))
  if min > list[i] or i == 0:
    min = list[i]

print(math.ceil(N/min) + 4)
import math

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


a, b = map(int, input().split())
c = lcm(a, b)
print(c)

### FIXED CODE ###

import fractions

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


a, b = map(int, input().split())
c = lcm(a, b)
print(c)
N = int(input())
hotel = list(map(int, input().split()))
count = 0
for i in range(1, N):
  for j in range(i):
    if all(hotel[i] >= hotel[j]):
      count += 1
print(count+1)


### FIXED CODE ###

N = int(input())
hotel = list(map(int, input().split()))
count = 0
c = 0
for i in range(1, N):
    c=0
    for j in range(0, i):
        
        if hotel[i] >= hotel[j]:
            c += 1
        if c == i:
            count += 1
print(count+1)
import sys
input = sys.stdin.readline

s = input()
MOD = 2019

dp = [0] * ((MOD) * (len(s) + 1))
# dp = [[0] * (MOD) for i in range(len(s) + 1)]

dp[0] = 0
for i in range(len(s)):
    tmp = int(s[i])
    dp[(i + 1) * MOD + tmp] += 1
    for val in range(MOD):
        dp[(i + 1) * MOD + (val * 10 + tmp) % MOD] += dp[i * MOD + val]

ans = 0
for i in range(len(s) + 1):
    ans += dp[i * MOD]
    
print(ans)


### FIXED CODE ###

s = input()
MOD = 2019

dp = [0] * MOD
dq = [0] * MOD
ans = 0

for i in range(len(s)):
    tmp = int(s[i])
    if i % 2 == 0:
        for val in range(MOD):
            dp[((val * 10) + tmp) % MOD] += dq[val]
            dq[val] = 0
        dp[tmp] += 1
        ans += dp[0]

    else:
        for val in range(MOD):
            dq[((val * 10) + tmp) % MOD] += dp[val]
            dp[val] = 0
        dq[tmp] += 1
        ans += dq[0] 
    
print(ans)
x,y=map(int,raw_input().split())


print a*b,(a+b)*2


### FIXED CODE ###

x,y=map(int, input().split())


print(x*y,(x+y)*2)
flag = True

while flag:
    e = int(input())
    if e == 0:
        flag = False
    else:
        ans = float('inf')
        for z in range(e+1):
            z3 = z ** 3
            if z3 <= e:
                for y in range(e-z3+1):
                    y2 = y ** 2
                    if y2 <= e - z3:
                        x = e - z3 - y2
                        s = x + y + z
                        if s < ans:
                            ans = s
                    else:
                        break
            else:
                break
        print(ans)


### FIXED CODE ###

while True:
    e = int(input())
    if e == 0:
        break
    z, ans = 0, float('inf')
    while z ** 3 <= e:
        r = e - z ** 3
        y = int(r ** 0.5)
        x = r - y ** 2
        ans = min(ans, x + y + z)
        z += 1
    print(ans)
N = int(input())
S = input()

left = 0
right = 1
max_length = 0

while left < N:
    if right - left > N - right:
        break
    if S[left:right] in S[right:]:
        max_length = max(max_length, len(serch_str))
        right += 1
    else:
        left += 1

print(max_length)


### FIXED CODE ###

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

left = 0
right = 1
max_length = 0

while left < N:
    if right - left > N - right:
        break
    serch_str = S[left:right]
    if serch_str in S[right:]:
        max_length = max(max_length, len(serch_str))
        right += 1
    else:
        left += 1

print(max_length)
A,B,C,K=map(int,input().split())
S=[]
S.extend([1]*A)
S.extend([0]*B)
S.extend([-1]*C)
print(sum(S[:K]))

### FIXED CODE ###

A,B,C,K = map(int,input().split())
ans=0
if A>=K:
    ans+=K
else:
    K=K-A
    if B>=K:
        ans+=A
    else:
        K=K-B
        ans=A-K
print(ans)
import math
def main():
    N, M = map(int, input().split())
    S = input()
    T = input()
    result = N * M / math.gcd(N, M)
    cand = (result / N) * (result / M) / math.gcd((result / N), (result / M))
    for i in range(0, result / cand):
        if S[(i * cand) / (result / N)] != T[(i * cand) / (result / M)]:
            return -1
    return result
print(main())

### FIXED CODE ###

def gcd(a, b):
    if a < b:
        a, b = b, a
    if b == 0:
        return a
    c = a % b
    return gcd(b, c)

def main():
    N, M = map(int, input().split())
    S = input()
    T = input()
    result = N * M / gcd(N, M)
    cand = (result / N) * (result / M) / gcd(int((result / N)), int((result / M)))
    for i in range(0, int(result / cand)):
        if S[int((i * cand) / (result / N))] != T[int((i * cand) / (result / M))]:
            return '-1'
    return int(result)
print(main())
from math import gcd
import copy 

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

if __name__ == '__main__':
	N=int(input())
	A=list(map(int,input().split()))

	ans=0
	for i in range(N):
		l=copy.deepcopy(A)
		l.pop(int(i))
		if(N>2):
			tmp_gcd=math.gcd(l[0],l[1])
			for j in range(2,len(l)):
				tmp_gcd=gcd(l[j],tmp_gcd)
			if(tmp_gcd > ans):
				ans=tmp_gcd
		else:
			ans=gcd(A[0],A[1])
	print(ans)



### FIXED CODE ###

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

print(B*(T//A))
n=int(input())
if n in 9:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

print("Yes" if "9" in input() else "No")
import sys
import math

s=input()
k = int(input())
cnt = False
ans=0
for i in range(0,k+1):
    if s[i] != '1':
        ans = s[i]
        cnt = True
        break
    cnt+=1
if (not cnt):
    print(1)
else:
    print(ans)


### FIXED CODE ###

import sys
import math

s=input()
k = int(input())
cnt = False
ans=0
for i in range(0,k):
    if s[i] != '1':
        ans = s[i]
        cnt = True
        break
if (not cnt):
    print(1)
else:
    print(ans)
#ABC050.B
N =int(input())
T = list(map(int,input().split()for _ in range(N)))
S = sum(T)
M = int(input())

for _ in range(M):
    a = S
    p,x = map(int,input().split())
    a -= T[p-1]
    a += x
    print(a)

### FIXED CODE ###

#ABC050.B
N =int(input())
T = list(map(int,input().split()))
S = sum(T)
M = int(input())

for _ in range(M):
    a = S
    p,x = map(int,input().split())
    a -= T[p-1]
    a += x
    print(a)
import functools
import operator

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

def nCr(n, r):
    r = min(r, n-r)
    num = functools.reduce(lambda x, y: x*y%mod, range(n, n-r, -1))
    den = functools.reduce(lambda x, y: x*y%mod, map(lambda x: pow(x, mod-2, mod), range(1, r+1)))
    return num * den % mod

mod = 10**9 + 7
print((pow(2, n, mod) - nCr(n, a) - nCr(n, b) - 1) % mod)


### FIXED CODE ###

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

mod = 10**9 + 7

def nck(k):
    y, z = 1, 1
    for i in range(1, k+1):
        y = (y * (n+1-i)) % mod
        z = (z * pow(i, mod-2, mod)) % mod
    return (y*z) % mod

ans = (pow(2, n, mod) - 1 - nck(a) - nck(b)) % mod
print(ans)
n = int(input())
b = list(map(int, input().split()))

b.append(100010)
a = []
a.append(b[0])

for i in range(1,n):
  a.append(min(b[i], b[i-1])
           
print(sum(a))

### FIXED CODE ###

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

b.append(100010)
a = 0
a += b[0]

for i in range(1,n):
  a += (min(b[i], b[i-1]))
           
print(a)
# vをcに塗る。pはvの親
def dfs(v, p, c):
    res[v] = c
    for e in G[v]:
        if e[0] == p:
            continue
        if e[1] & 1:
            dfs(e[0], v, 1-c)
        else:
            dfs(e[0], v, c)


N = int(input())

G = [[] for _ in range(N)]
res = [0] * N
for _ in range(N-1):
    u, v, w = map(int, input().split())
    G[u-1].append([v-1, w])
    G[v-1].append([u-1, w])
dfs(0, -1, 1)
print('\n'.join(map(str, res)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(pow(10, 7))


# vをcに塗る。pはvの親
def dfs(v, p, c):
    res[v] = c
    for e in G[v]:
        if e[0] == p:
            continue
        if e[1] & 1:
            dfs(e[0], v, 1-c)
        else:
            dfs(e[0], v, c)


N = int(input())

G = [[] for _ in range(N)]
res = [0] * N
for _ in range(N-1):
    u, v, w = map(int, input().split())
    G[u-1].append([v-1, w])
    G[v-1].append([u-1, w])
dfs(0, -1, 1)
print('\n'.join(map(str, res)))
import sys
from collections import Counter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    Q, *BC = map(int, read().split())

    total = sum(A)
    d = [0] * (N+1)
    for a in A:
        d[a] += 1

    for b, c in zip(BC[::2], BC[1::2]):
        total += (c - b) * d[b]
        d[c] += d[b]
        d[b] = 0
        print(total)

    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import Counter

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N = int(readline())
    A = list(map(int, readline().split()))
    Q, *BC = map(int, read().split())

    total = sum(A)
    d = Counter(A)
    for b, c in zip(BC[::2], BC[1::2]):
        total -= b * d[b]
        total += c * d[b]
        d[c] += d[b]
        d[b] = 0
        print(total)

    return


if __name__ == '__main__':
    main()
a = int(input())
b = int(input())
print(a * b)
print((a + b) * 2)


### FIXED CODE ###

a , b = map(int, input().split())
print(a * b, (a + b) * 2)
print("縦と横の長さを入力")
a=int(input("a:"))
b=int(input("b:"))

print("面積:",a*b)
print("周の長さ",a*2+b*2)



### FIXED CODE ###


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

r=a*b
length=a*2+b*2
print(r,length)
def popcount(i):
    assert 0 <= i < 0x100000000
    i = i - ((i >> 1) & 0x55555555)
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
    return (((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) & 0xffffffff) >> 24
memo = [None] * 300000
def do2(x):
    if memo[x] is not None:
        return memo[x]
    cnt = 0
    while x != 0:
        x = x % popcount(x)
        cnt += 1
    memo[x] = cnt
    return cnt

def do():
    ll = int(input())
    s = input()
    n = int(s, 2)

    x = n
    cnt = 0
    ss = bin(x)[2:]
    cnt += 1
    num1 = ss.count("1")
    num1m = num1 - 1
    num1p = num1 + 1
    rs = ss[::-1]
    res1m = 0
    res1p = 0
    for j in range(len(rs)):
        if rs[j] == "1":
            res1m += pow(2, j, num1m)
            res1m %= num1m
            res1p += pow(2, j, num1p)
            res1p %= num1p

    #print(res1m, res1p, num1m, num1p)
    for i in range(len(s)):
        #print("i", i)
        if s[i] == "1": # 0になるから
            #print("down")
            #print(res1m, pow(2, ll - i -1, num1m))
            if num1m == 0 or num1m == -1:
                print(0)
                continue
            x = res1m - pow(2, ll - i -1, num1m)
            x %= num1m
        elif s[i] == "0": # 1になるから
            #print("up")
            #print(res1p, pow(2, ll - i -1, num1p))
            x = res1p + pow(2, ll - i-1, num1p)
            x %= num1p

        if x == 0:
            print(1)
            continue
        print(do2(x) + 1)
do()


### FIXED CODE ###

def popcount(i):
    assert 0 <= i < 0x100000000
    i = i - ((i >> 1) & 0x55555555)
    i = (i & 0x33333333) + ((i >> 2) & 0x33333333)
    return (((i + (i >> 4) & 0xF0F0F0F) * 0x1010101) & 0xffffffff) >> 24
memo = [None] * 300000
def do2(x):
    if memo[x] is not None:
        return memo[x]
    cnt = 0
    while x != 0:
        x = x % popcount(x)
        cnt += 1
    memo[x] = cnt
    return cnt

def do():
    ll = int(input())
    s = input()
    n = int(s, 2)

    x = n
    cnt = 0
    ss = bin(x)[2:]
    cnt += 1
    num1 = ss.count("1")
    num1m = num1 - 1
    num1p = num1 + 1
    rs = ss[::-1]
    res1m = 0
    res1p = 0
    for j in range(len(rs)):
        if rs[j] == "1":
            if num1m != 0 and num1m != -1:
                res1m += pow(2, j, num1m)
                res1m %= num1m
            res1p += pow(2, j, num1p)
            res1p %= num1p

    #print(res1m, res1p, num1m, num1p)
    for i in range(len(s)):
        #print("i", i)
        if s[i] == "1": # 0になるから
            #print("down")
            #print(res1m, pow(2, ll - i -1, num1m))
            if num1m == 0 or num1m == -1:
                print(0)
                continue
            x = res1m - pow(2, ll - i -1, num1m)
            x %= num1m
        elif s[i] == "0": # 1になるから
            #print("up")
            #print(res1p, pow(2, ll - i -1, num1p))
            x = res1p + pow(2, ll - i-1, num1p)
            x %= num1p

        if x == 0:
            print(1)
            continue
        print(do2(x) + 1)
do()
from itertools import accumulate

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

sum_l = [0]+list(accumulate(a))
sum_r = [0]+list(accumulate(a[-1::-1]))

cost = sum_r[-1]
for i in range(n+1):
    cost = min(cost, abs(sum_l[i]-sum_r[n-i]))
print(cost)

### FIXED CODE ###

x, y = map(int, input().split())

prize = 0
if x==1:
    prize += 300000
elif x==2:
    prize += 200000
elif x==3:
    prize += 100000

if y==1:
    prize += 300000
elif y==2:
    prize += 200000
elif y==3:
    prize += 100000

if x==1 and y==1:
    prize += 400000

print(prize)
import math

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

def C(N,P):
    if N == 1: return P
    b=int(math.log2(N))
    a=P**(1/b)

    res=1
    for i in range(2,int(a)+2):
        if i**N > P : break
        if P % i**N == 0 : res = i

    return res

print(C(n,p))

### FIXED CODE ###

print(input().count("2"))
if X >= 30:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

X = int(input())
if X >= 30:
  print("Yes")
else:
  print("No")
from math import factorial
def ncr(n,r):
 if n == 1:
  return 0
 else:
  return  factorial(n) / factorial(r) / factorial(n - r)

n= int(input())
a = list(int(i) for i in input().split())
s = [0]
for i in range(n):
  s.append(s[i]+a[i])
s = sorted(s,reverse =True)
ans = 0
for i in list(set(s)):
  ans += ncr(s.count(i),2)
print(int(ans))

### FIXED CODE ###

from math import factorial
import sys
input = sys.stdin.readline
def ncr(n):
 if n <= 1:
  return 0
 elif n == 2:
  return 1
 else:
  return  (factorial(n) // 2) // factorial(n - 2)

n= int(input())
a = list(int(i) for i in input().split())
s = [0]
for i in range(n):
  s.append(s[i]+a[i])
s = sorted(s,reverse =True)
ans = 0
tmp = 1
for i in range(len(s)-1):
  if s[i] == s[i+1]:
   tmp += 1
  else:
   ans += ncr(tmp)
   tmp = 1
ans += ncr(tmp)
print(ans)
print(len(set(input.split())))

### FIXED CODE ###

print(len(set([x for x in input().split()])))
n = int(input())
alist = [int(input())-1 for _ in range(n)]

now = 0
count = 0
while True:
    if now == 1:
        print(c)
        break
    elif c >= n:
        print(-1)
        break
    else:
        count += 1
        now = alist[now]

### FIXED CODE ###

n = int(input())
alist = [int(input())-1 for _ in range(n)]

now = 0
count = 0
while True:
    if now == 1:
        print(count)
        break
    elif count >= n:
        print(-1)
        break
    else:
        count += 1
        now = alist[now]
def resolve():
    import sys
    input = sys.stdin.readline
    n, k = [int(x) for x in input().rstrip().split()]
    n_set = set()
    while n not in n_set:

        n_set.add(n)
        if n == 0:
            break

        n = abs(k-n)
        if k < n:
          n = n - k*(abs(k-n)//k)
        # print(n)
        # print(n_set)

    print(min(n_set))

resolve()


### FIXED CODE ###


def resolve():
    import sys
    input = sys.stdin.readline
    s = input().rstrip().split()
    print(s[2], s[0], s[1])
   
resolve()
n = input()
zorome = [i*100 + i*10 + i for i in range(1, 10)]

for i in zorome:
    if n <= i:
        print(i)
        exit()


### FIXED CODE ###

import re
import sys

n = int(input())

for i in range(n, 1000):
    if re.match('^([0-9])\\1+$', str(i)):
        print(i)
        sys.exit(0)
H, W, M = map(int, input().split())
hn = [0]*W
wn = [0]*W
flag = set()
for i in range(M):
  h, w = map(int, input().split())
  hn[h-1] += 1
  wn[w-1] += 1
  flag.add((h,w))
  
#hrank = sorted(hn, key=lambda t:-t[1])
#wrank = sorted(wn, key=lambda t:-t[1])

hmax = max(hn)
wmax = max(wn)

hmaxlist =[]
for h in hn:
  if h == hmax:
    hmaxlist.append(h)
  
wmaxlist =[]
for w in wn:
  if w == wmax:
    wmaxlist.append(w)
  
flag2 = set()
for i in hmaxlist:
  for j in wmaxlist:
    flag2.add((i,j))

if len(flag2 - flag) == 0:
  print(hmax+wmax -1)
else:
  print(hmax+wmax)

### FIXED CODE ###

import sys
H, W, M = map(int, input().split())
hn = [0]*H
wn = [0]*W
flag = set()
for i in range(M):
  h, w = map(int, input().split())
  hn[h-1] += 1
  wn[w-1] += 1
  flag.add((h,w))
  
#hrank = sorted(hn, key=lambda t:-t[1])
#wrank = sorted(wn, key=lambda t:-t[1])

hmax = max(hn)
wmax = max(wn)

hmaxlist = {i+1 for i,h in enumerate(hn) if h == hmax}
#for h in hn:
#  if h == hmax:
#    hmaxlist.append(h)
  
wmaxlist = {i+1 for i,w in enumerate(wn) if w == wmax}
#for w in wn:
#  if w == wmax:
#    wmaxlist.append(w)
  

for i in hmaxlist:
  for j in wmaxlist:
    if (i,j) not in flag:
      print(hmax+wmax)
      sys.exit()
print(hmax+wmax-1)
X,Y,A,B,C=map(int, input().split())
p=list(map(int, input().split()))
q=list(map(int, input().split()))
r=list(map(int, input().split()))

x=X-1
y=Y-1

p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r,reverse=True)

#print(p[:X],q[:Y])

if p[x]>=q[y]:
  a=q[y]
  f=1
else:
  a=p[x]
  f=2
while a<r[0] and len(r)>=1:
#  print(a,r[0])
  if f==1 :
#    print('f=1')
    q[y]=r[0]
    y-=1
    r.pop(0)
  elif f==2 :
#    print('f=2')
    p[x]=r[0]
    x-=1
    r.pop(0)
  else:
#    print('break1')
    break
    
#  print(x,y,p[x],q[y])
    
  if (y==-1 and x>=0) or (x>=0 and p[x]<q[y]):
#    print('a=p[x]')
    a=p[x]
    f=2
  elif (x==-1 and y>=0) or (y>=0 and p[x]>=q[y]):
#    print('a=q[y]')
    a=q[y]
    f=1
  else:
#    print('break2')
    break

ans=0
#print(p[:X],q[:Y])
for i in p[:X]:
  ans+=i
for i in q[:Y]:
  ans+=i

print(ans)

### FIXED CODE ###

X,Y,A,B,C=map(int, input().split())
p=list(map(int, input().split()))
q=list(map(int, input().split()))
r=list(map(int, input().split()))

x=X-1
y=Y-1

p=sorted(p,reverse=True)
q=sorted(q,reverse=True)
r=sorted(r,reverse=True)

#print(p[:X],q[:Y])

if p[x]>=q[y]:
  a=q[y]
  f=1
else:
  a=p[x]
  f=2
while len(r)>=1 and a<r[0]:
#  print(a,r[0])
  if f==1 :
#    print('f=1')
    q[y]=r[0]
    y-=1
    r.pop(0)
  elif f==2 :
#    print('f=2')
    p[x]=r[0]
    x-=1
    r.pop(0)
  else:
#    print('break1')
    break
    
#  print(x,y,p[x],q[y])
    
  if (y==-1 and x>=0) or (x>=0 and p[x]<q[y]):
#    print('a=p[x]')
    a=p[x]
    f=2
  elif (x==-1 and y>=0) or (y>=0 and p[x]>=q[y]):
#    print('a=q[y]')
    a=q[y]
    f=1
  else:
#    print('break2')
    break

ans=0
#print(p[:X],q[:Y])
for i in p[:X]:
  ans+=i
for i in q[:Y]:
  ans+=i

print(ans)