Harryxun/stf_run huggingface dataset:
def q3():
    """ C - Anti-Division """
    import math
    A,B,C,D = (int(i) for i in input().split())

    def lcm(x, y):
        """ 最小公倍数を求める """
        return (x * y) // math.gcd(x, y)

    num_C = B // C - (A - 1) // C  # Cで割り切れる個数
    num_D = B // D - (A - 1) // D  # Dで割り切れる個数
    num_CD = B // lcm(C, D) - (A - 1) // lcm(C, D)  # CとDの最小公倍数で割り切れる個数
    num_all = num_C + num_D - num_CD  # 全ての割り切れる個数
    ans = B - A + 1 - num_all
    print(ans)

if __name__ == '__main__':
    q3()

### FIXED CODE ###

def q3():
    """ C - Anti-Division """
    from fractions import gcd  # 3.4.3ではmath.gcdは無い
    A,B,C,D = (int(i) for i in input().split())

    def lcm(x, y):
        """ 最小公倍数を求める """
        return (x * y) // gcd(x, y)

    num_C = B // C - (A - 1) // C  # Cで割り切れる個数
    num_D = B // D - (A - 1) // D  # Dで割り切れる個数
    lcm_CD = lcm(C, D)
    num_CD = B // lcm_CD - (A - 1) // lcm_CD  # CとDの最小公倍数で割り切れる個数
    num_all = num_C + num_D - num_CD  # 全ての割り切れる個数
    ans = B - A + 1 - num_all
    print(ans)


if __name__ == '__main__':
    q3()
n,m=map(int,input().split())
a=[b for b in int(input())]
def func(n,a):
    if n< sum(a):return -1
    else: 
        return n-sum(a)

### FIXED CODE ###

import math
n=int(input())
def func(n):
    return math.pi*n*2
print(func(n))
import numpy as np
N=int(input())
list_N=list(range(1,N+1))
P=[list_N[-1]]
P.extend(list_N[:-1])

ret=np.sum(np.array(P)%np.array(list_N))
print(ret)

### FIXED CODE ###

N=int(input())-1
if N%2==0:
	print(int(N/2)*(N+1))
else:
  	print((N)*int((N+1)/2))
import math
import sys

X,Y,Z,K=map(int,input().split())

x=sorted(list(map(int,input().split())),reverse=True)
y=sorted(list(map(int,input().split())),reverse=True)
z=sorted(list(map(int,input().split())),reverse=True)



"""
if X*Y*Z<=3000:
    ans=[]
    for i in range(X):
        for j in range(Y):
            for k in range(Z):  ans.append(x[i]+y[j]+z[k])
    ans.sort()
    for i in range(min(3000,X*Y*Z)):
        print(ans[i])
    sys.exit()
"""

yz=[]
for i in range(Y):
    yz=yz+[ y[i]+z[j] for j in range(Z)]

yz.sort(reverse=True)

if len(yz)>K:
    yz=yz[:K]


n=len(yz)
ans=[]

for i in range(X):
    tmp=[yz[j]+x[i] for j in range(len(yz))]
    ans =ans+tmp

ans.sort(reverse=True)


for i in range(K):
    print(ans[i])


### FIXED CODE ###

import math
import sys

a=[int(input()) for i in range(5)]
k=int(input())

for i in range(5):
        for j in range(5):
                if a[i]-a[j]>k:
                        print(":(")
                        sys.exit()

print("Yay!")
# coding: utf-8
# Your code here!
N,M = map(int,input().split())
lst = [i for i in range(N)]

def root(n):
    if n == lst[n]:
        return n
    lst[n] = func(lst[n])
    return lst[n]

def union(x,y)
    rootX, rootY = root(x), root(y)
    if rootX != rootY:
        lst[max(x,y)] = min(x,y)

for i in range(M):
    X,Y,Z = map(int,input().split())
    X -= 1
    Y -= 1
    union(X, Y)

for i in range(N):
    func(i)

ans = len([i for i in range(N) if lst[i] == i])
print(ans)



### FIXED CODE ###

# coding: utf-8
# Your code here!
N,M = map(int,input().split())
lst = [i for i in range(N)]

def root(n):
    if n == lst[n]:
        return n
    lst[n] = root(lst[n])
    return lst[n]

def union(x,y):
    rootX, rootY = root(x), root(y)
    if rootX != rootY:
        if rootX > rootY:
            lst[rootX] = rootY
        if rootY > rootX:
            lst[rootY] = rootX

for i in range(M):
    X,Y,Z = map(int,input().split())
    X -= 1
    Y -= 1
    union(X, Y)

ans = len([i for i in range(N) if root(i) == i])
print(ans)
text = input()
rows = text.split('\n')
k = int(rows[0])
a = int(rows[1].split(' ')[0])
b = int(row[1].split(' ')[1])
for i in range(a, b + 1):
    if i % k == 0:
        print('OK')
        break
else:
    print('NG')


### FIXED CODE ###

row1 = input()
row2 = input()
k = int(row1)
a = int(row2.split(' ')[0])
b = int(row2.split(' ')[1])
for i in range(a, b + 1):
    if i % k == 0:
        print('OK')
        break
else:
    print('NG')
a, b, c, d = map(int, input().split())
if a * b > c * d:
    print(a * b)
elif a * b < c * d:
    pritn(c * d)
else:
    print(a * b)

### FIXED CODE ###

a, b, c, d = map(int, input().split())
if a * b > c * d:
    print(a * b)
elif a * b < c * d:
    print(c * d)
else:
    print(a * b)
a,b,c = map(str,input().split())
if a[-1]=b[0] and b[-1]=c[0]:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

a,b,c = map(str,input().split())
if a[-1]==b[0] and b[-1]==c[0]:
  print('YES')
else:
  print('NO')
a,b,c=map(int,input().split())
if c-a-b<=0:
    print("No")
else:
    l=a*b*4
    r=(c-a-b)**2
    if r>l:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

k=int(input())
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]
print(l[k-1])
n = int(input())
A = [int(i) for i in input().split()]

s = [0]*60
for a in A:
    cnt = 0
    while a != 0:
        # print(cnt,a)
        if(a&1)==1:
            s[cnt+1] += 1
        cnt+=1
        a = a >> 1
ans = 0
for i in range(60):
    # print("a",2**(i-1)*s.get(i,0)*(n-s.get(i,0)))
    # print("b",s.get(i,0))
    # print("c",(n-s.get(i,0)))
    ans += (2**(i-1)*s.get(i,0)*(n-s.get(i,0))) % (10**9+7)
ans = ans % (10**9+7)
print(int(ans))
# print(s)


### FIXED CODE ###

n = int(input())
A = [int(i) for i in input().split()]

s = [0]*61
for a in range(n):
    for i in range(61):
        if(A[a]>>i&1)==1:
            s[i+1] += 1
ans = 0
for i in range(60):
    # print("a",2**(i-1)*s.get(i,0)*(n-s.get(i,0)))
    # print("b",s.get(i,0))
    # print("c",(n-s.get(i,0)))
    ans += 2**(i)*s[i+1]*(n-s[i+1])
ans = ans % (10**9+7)
print(int(ans))
# print(s)
# coding=UTF-8
from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
import numpy as np
import time
sys.setrecursionlimit(10**6)


def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    ans = 0
    max_a = max(a)
    arr = [1] * (max_a + 1)

    for num in a:
        if a.count(num) > 1:
            arr[num] = 0
        for i in range(num*2, max_a+1, num):
            arr[i] = 0

    for i in range(n):
        if arr[a[i]] == 1:
            ans += 1

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# coding=UTF-8
from collections import deque
from operator import itemgetter
from bisect import bisect_left, bisect
import itertools
import sys
import math
import numpy as np
import time


def main():

    N = int(input())
    A = [int(i) for i in input().split()]
    D = set()
    S = set()
    for i in range(N):
        if A[i] in S:
            D.add(A[i])
        else:
            S.add(A[i])
    M = max(S)
    X = [1 for i in range(M+1)]
    for a in S:
        if a in D:
            X[a] = 0
        for i in range(2*a, M+1, a):
            X[i] = 0
    ans = 0
    for i in range(N):
        if X[A[i]] == 1:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
# sys.stdin.readline()
import sys
input = sys.stdin.readline
import math

def decision(s,td,index):
    #index番目の文字が落ちるかどうかを判別
    #右に落ちるときは1，左に落ちるときは-1，落ちないときは0を返す
    global N,Q
    qi = 0
    j = index
    for qi in range(Q):
        if j < 0 or j >= N:
            break
        if s[j] == td[qi][0]:
            if td[qi][1] == 'L':
                j -= 1
            elif td[qi][1] == 'R':
                j += 1
    if j == -1:
        return -1
    elif j == N:
        return 1
    else:
        return 0
    
 
 
N,Q = map(int,input().split())
s = input()
 
td = [0] * Q
for i in range(Q):
    td[i] = (input().split())
    
#td[i][j]:i番目の文字(j=0)と方向(j=1)
    
    
RN = math.log2(N)
#2分探索
left = 0
right = N-1
#右側のボーダー
for i in range(RN):
    mid = int((right+left)/2)
    state = decision(s,td,mid)
    if state < 1:
        left = mid
    else:
        right = mid
    if (right - left) == 1:
        break
if right == N-1 and decision(s,td,right) == 0:
    right += 1
border_r = right
    
left = 0
right = N-1
#左側のボーダー
for i in range(RN):
    mid = int((right+left)/2)
    state = decision(s,td,mid)
    if state > -1:
        right = mid
    else:
        left = mid
    if (right - left) == 1:
        break
if left == 0 and decision(s,td,left) == 0:
    right -= 1
border_l = right
print(border_r-border_l)
 

### FIXED CODE ###

# sys.stdin.readline()
import math
import sys
input = sys.stdin.readline


def decision(s,td,j):
    #index番目の文字が落ちるかどうかを判別
    #右に落ちるときは1，左に落ちるときは-1，落ちないときは0を返す
    global N,Q
    for [qi,v] in td:
        if j < 0 or j >= N:
            break
        if s[j] == qi:
            if v == 'L':
                j -= 1
            else:
                j += 1
    if j == -1:
        return -1
    elif j == N:
        return 1
    else:
        return 0
 
N,Q = map(int,input().split())
s = input()
td = [input().split() for _ in range(Q)]
    
#td[i][j]:i番目の文字(j=0)と方向(j=1)
    
    
RN = math.ceil(math.log2(N))
#2分探索
left = 0
right = N-1
#右側のボーダー
for i in range(RN):
    mid = (right+left)//2
    state = decision(s,td,mid)
    if state < 1:
        left = mid
    else:
        right = mid
    if (right - left) == 1:
        break
if right == N-1 and decision(s,td,right) == 0:
    right += 1
border_r = right
    
left = 0
right = N-1
#左側のボーダー
for i in range(RN):
    mid = ((right+left)//2)
    state = decision(s,td,mid)
    if state > -1:
        right = mid
    else:
        left = mid
    if (right - left) == 1:
        break
if left == 0 and decision(s,td,left) == 0:
    right -= 1
border_l = right
print(border_r-border_l)
N = input()
X = list(map(int, input().split()))
sum = 0
for a in X:
    sum = sum + a
C = sum/N
for b in X:
    ans = (b-C)**2
print(int(ans))

### FIXED CODE ###

N = int(input())
X = list(map(int, input().split()))
sum = 0
all = True
for a in X:
    sum = sum + a
C = int(sum / N + 0.5)
ans = 0
for b in X:
    ans = ans + (b-C)**2
print(ans)
n=int(input())
a= list(map(int, input().split()))

dp=[[-float('inf'),-float('inf'),-float('inf')] for i in range(n)]
# dp[i][0]:iまででまだ飛ばしてない
# dp[i][1]:一つ飛ばしてる
# dp[i][2]:２つ飛ばしてる
dp[0][0]=a[0]
dp[1][1]=a[1]
dp[2][2]=a[2]

if n==2:
    print(max(a[0],a[1]))
    exit()
    
for i in range(2,n):
    dp[i][0]=dp[i-2][0]+a[i]
    if i>=3:
        dp[i][1]=max(dp[i-2][1]+a[i],dp[i-3][0]+a[i])
    if i>=4:
        dp[i][2]=max(dp[i-2][2]+a[i],dp[i-3][1]+a[i],dp[i-4][0]+a[i])

if n%2==0:
    print(max(dp[-2][0],dp[-1][1]))
else:
    print(max(dp[-3][0],dp[-2][1],dp[-1][2]))

### FIXED CODE ###

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

# aを偶数奇数の要素で振り分け
a1=[]
a2=[]

for i in range(n):
    if i%2==0:
        a1.append(a[i])
    else:
        a2.append(a[i])

# 累積和も作っておく
a3=list(itertools.accumulate(a1))
a4=list(itertools.accumulate(a2))


x1=sum(a1)
x2=sum(a2)


if n%2==0:
    ans=-float('inf')
    for i in range(n//2):
        ans=max(a3[i]+x2-a4[i],ans)
    print(max(ans,x1,x2))
else:
    # 奇数番目だけの要素を選んだ時の最大値
    ans1=sum(a1)-min(a1)
    # dp1[i]=奇数偶数奇数or偶数奇数と移動した時のi番目までのMAX
    dp1 = [-float('inf')] * (n // 2 + 1)
    dp1[0] = a1[0]
    # dp2[i]=奇数偶数or偶数のみと移動した時のi番目までのMAX
    dp2 = [-float('inf')] * (n // 2)
    dp2[0] = a2[0]
    for i in range(n // 2 - 1):
        dp2[i + 1] = max(a3[i] + a2[i + 1], dp2[i] + a2[i + 1])
        if i==0:
            dp1[i + 2] = dp2[i] + a1[i + 2]
        else:
            dp1[i + 2] = max(dp2[i] + a1[i + 2], dp1[i + 1] + a1[i + 2])
    print(max(dp1[-1], dp2[-1],ans1))
while True:
	n, x = map(int, raw_input().split())
	if n == x == 0:
		break
	else:
		m = 0
		for i in xrange(1, n-1):
			for j in xrange(i+1, n):
				if i + j + j + 1 <= x and x <= i + j + n:
					m += 1
		print m

### FIXED CODE ###

print raw_input().swapcase()
n,a,b,c = map(int,input().split())

ss = []
for i in range(n):
    ss.append(input())

ans = []
tower = [a,b,c]
s2num = {"AB":[0,1],"BC":[1,2],"AC":[0,2]}
num2s = {0:"A",1:"B",2:"C"}
flag =True

def check_large(l,r,t):
    if t[l]>t[r]:
        return l,r,False
    elif t[l]<t[r]:
        return r,l,False
    else:
        return l,r,True

for i in range(n):
    s = ss[i]
    l,r = s2num[s]
    big,small,f = check_large(l,r,tower)
    if f:
        if i == n-1:
            pass
        else:
            nex = s2num[ss[i+1]]
            if big in nex:
                small,big = big,small
            else:
                continue
            
    if tower[big] <= 0:
        flag = False
        break
    else:
        tower[big]-=1
        tower[small]+=1
        ans.append(num2s[small])

if flag:
    print("Yes")
    for i in range(n):
        print(ans[i])
else:
    print("No")

### FIXED CODE ###

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

ss = []
for i in range(n):
    ss.append(input())

ans = []
tower = [a,b,c]
s2num = {"AB":[0,1],"BC":[1,2],"AC":[0,2]}
num2s = {0:"A",1:"B",2:"C"}
flag =True

def check_large(l,r,t):
    if t[l]>t[r]:
        return l,r,False
    elif t[l]<t[r]:
        return r,l,False
    else:
        return l,r,True

for i in range(n):
    s = ss[i]
    l,r = s2num[s]
    big,small,f = check_large(l,r,tower)
    if f:
        if i+1 < n:
            nex = s2num[ss[i+1]]
            if big in nex:
                small,big = big,small

    if tower[big] <= 0:
        flag = False
        break
    else:
        tower[big]-=1
        tower[small]+=1
        ans.append(num2s[small])

if flag:
    print("Yes")
    for i in range(n):
        print(ans[i])
else:
    print("No")
x = input('>')

y = x**3

print int(y)

### FIXED CODE ###

x = input()

y = x**3

print int(y)
n = [int(_) for _ in list(input())]
a, b = 0, 1
for i in n:
    a, b = min(a+i, b+10-i), min(a+(i+1), b+10-(i+1))
print(a)

### FIXED CODE ###

import numpy as np


def count_pair(x):
    # A内のペアで積がxより小さいものの個数
    # まず(i,j)と(j,i)を重複して数える
    cnt = 0
    # A[i]<0なる各iに対してA[j]>x/A[i]なるjの個数
    cnt += (N-np.searchsorted(A, x//A_nega, side='right')).sum()
    if x > 0:
        # 各iに対してA[j]=0なるjの個数
        cnt += len(A_zero)*N
    # A[i]>0なる各iに対してA[j]<x/A[i]なるjの個数
    cnt += np.searchsorted(A, -(-x//A_posi), side='left').sum()
    # i=jを除いてから2で割る
    cnt = (cnt-(A**2 < x).sum())//2
    return cnt


# count_pair(x)<Kをみたすxの最大値を二分探索で求める
N, K = map(int, input().split())
* A, = map(int, input().split())
A = np.array(A)
A = np.sort(A)
A_posi = A[A > 0]
A_zero = A[A == 0]
A_nega = A[A < 0]
inf = 10**18+1
l, r = -inf, inf
while r - l > 1:
    c = (l + r) // 2
    if count_pair(c) < K:
        l = c
    else:
        r = c
print(l)
a, b = list(map(int, input().split()))
number = 1
outlet_number = a
while outlet_number < b:
    outlet_number += a - 1
    number += 1
print(number)

### FIXED CODE ###

forecasts     = input()
real_weathers = input()

correct_number = 0
for date in range(len(forecasts)):
    if forecasts[date] == real_weathers[date]:
        correct_number += 1
print(correct_number)
h,w = map(int,input().split())
tate = [[0]*w for i in range(h)]
yoko = [[0]*w for i in range(h)]
s = [str(input()) for i in range(h)]

for i in range(h):
    cnt = 0
    now = 0
    for j in range(w):
        if s[i][j] == ".":
            cnt += 1
        else:
            for k in range(now,cnt+1):
                yoko[i][k] = cnt
            cnt = 0
for i in range(w):
    cnt = 0
    now = 0
    for j in range(h):
        if s[j][i] == ".":
            cnt += 1
        else:
            for k in range(now,cnt+1)
                tate[k][i] = cnt
            cnt = 0
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans,tate[i][j]+yoko[i][j])
print(ans)

### FIXED CODE ###

h,w = map(int,input().split())
tate = [[0]*w for i in range(h)]
yoko = [[0]*w for i in range(h)]
s = [str(input()) for i in range(h)]

for i in range(h):
    cnt = 0
    now = 0
    for j in range(w):
        if s[i][j] == ".":
            cnt += 1
        else:
            for k in range(now,j+1):
                yoko[i][k] = cnt
            cnt = 0
            now = j+1
    for k in range(now,j+1):
        yoko[i][k] = cnt
for i in range(w):
    cnt = 0
    now = 0
    for j in range(h):
        if s[j][i] == ".":
            cnt += 1
        else:
            for k in range(now,j):
                tate[k][i] = cnt
            cnt = 0
            now = j+1
    for k in range(now,j+1):
        tate[k][i] = cnt
ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans,tate[i][j]+yoko[i][j]-1)
print(ans)
N = int(input())
a = input().split()
A = []
for i in range(N):
    A.append(int(a[i]))
b = input().split()
B = []
for i in range(N):
    B.append(int(b[i]))
if sum(A) < sum(B):
    print(-1)
else:
    num = 0
    fix = 0
    for i in range(N):
        if A[i] - B[i] <  0:
            num += 1
            fix += B[i] - A[i]
if num == 0:
    print(0)
else:
    ret = []
    for i in range(N):
        if A[i] - B[i] > 0:
            ret.append(A[i] - B[i])
        else:
            ret.append(0)
    ret.sort(reverse=True)
    su = 0
    for i in range(N):
        su += ret[i]
        num += 1
        if su >= fix:
            break
    print(num)

### FIXED CODE ###

N = int(input())
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
if sum(A) < sum(B):
    print(-1)
else:
    num, fix = 0, 0
    for i in range(N):
        if A[i] - B[i] <  0:
            num += 1
            fix += B[i] - A[i]
    if num != 0:
        ret = []
        for i in range(N):
            if A[i] - B[i] > 0:
                ret.append(A[i] - B[i])
        ret.sort(reverse=True)
        su = 0
        for i in range(len(ret)):
            su += ret[i]
            num += 1
            if su >= fix:
                break
    print(num)
# coding: utf-8
import sys
import numpy as np

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

x1, y1, x2, y2 = lr()
P2 = np.array([x2, y2])  # 2つ目の点
A = np.array([[0, -1], [1, 0]])
vec = np.array([x2-x1, y2-y1])
vec2 = np.dot(A, vec)
vec3 = np.dot(A, vec2)
P3 = np.array(P2) + vec2
P4 = np.array(P3) + vec3
print(*P3, *P4)


### FIXED CODE ###

X1, Y1, X2, Y2 = map(int, input().split())
X3, Y3 = X2-(Y2-Y1), Y2+(X2-X1)
X4, Y4 = X3-(Y3-Y2), Y3+(X3-X2)
print(X3, Y3, X4, Y4)
x, y = map(int, input().split())

a = y / 2
b = 0
while (a + b) != x:
  a -= 2
  b += 1
  if a < 0: break

s = 2 * a + 4 * b
if s == y and a >= 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

X = [int(i) for i in input().split()]

for i in range(len(X)):
  if X[i] == 0:
    print (i+1)
import itertools
N,M,X = map(int,input().split())
A = [0,0,0,0]
C = []
Z = []
cz = []
b = 0
for i in range(N) :
    C.append(list(map(int,input().split())))

for i in range(1,N+1) :
    c = list(itertools.combinations(C,i))
    for j in range(len(c)) :
        A = [0,0,0,0]
        cj = c[j]
        for k in range(i) :
            ck = cj[k]
            A[0]+= ck[0]
            A[1] += ck[1]
            A[2] += ck[2]
            A[3] += ck[3]
            if A[1]>=X and A[2]>= X and A[3]>=X :
                cz.append(A[0])
                b = 1     
                break   
        if b == 1 :
            b = 0
            break

if len(cz) == 0 :
    print(-1)
else :
    print(min(cz))

### FIXED CODE ###

import numpy
N,M,X = map(int,input().split())
A = numpy.array([[int(i) for i in input().split()] for _ in range(N)])
ans = 10**8
for i in range(2**N) :
    i = format(i,'b').zfill(N)
    check = numpy.array([0]*(M+1))
    for j in range(N) :
        if i[j] == '0' :
            continue
        check +=  A[j][0:]
    if all (check[m] >= X for m in range(1,M+1)) :
        ans = min(ans,check[0])

if ans == 10**8 :
    print(-1)
else :
    print(ans)
import math
from functools import reduce

N, K = [int(i) for i in input().split(' ')]
X = [int(i) for i in input().split(' ')]

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

X.append(K)
diff = []
for i,x in enumerate(X):
    if i != 0:
        diff.append(abs(X[i-1] - x))

print(gcd_list(diff))


### FIXED CODE ###

import fractions
from functools import reduce

N, K = [int(i) for i in input().split(' ')]
X = [int(i) for i in input().split(' ')]

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

X.append(K)
diff = []
for i,x in enumerate(X):
    if i != 0:
        diff.append(abs(X[i-1] - x))

print(gcd_list(diff))
line = input().strip()
while line!='':
	print(0)
	line = input().strip()

### FIXED CODE ###

from __future__ import division
import sys
if sys.version_info[0]>=3: raw_input=input

X=4
Y=2
i=0
m={}
prev={}
v=[]
for i in range(X*Y): v.append(str(i))
m[''.join(v)]=[0,0]
prev[''.join(v)]=[''.join(v),None]
q=[v]
while len(q)>0:
	v=q.pop(0)
	coor=m[''.join(v)][0]
	x=coor%X
	y=coor//X
	depth=m[''.join(v)][1]
	nextstr=''.join(v)
	if 0<x:
		v[coor],v[coor-1]=v[coor-1],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor-1,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'R']
		v[coor],v[coor-1]=v[coor-1],v[coor]
	if x<X-1:
		v[coor],v[coor+1]=v[coor+1],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor+1,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'L']
		v[coor],v[coor+1]=v[coor+1],v[coor]
	if 0<y:
		v[coor],v[coor-X]=v[coor-X],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor-X,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'D']
		v[coor],v[coor-X]=v[coor-X],v[coor]
	if y<Y-1:
		v[coor],v[coor+X]=v[coor+X],v[coor]
		if ''.join(v) not in m:
			m[''.join(v)]=[coor+X,depth+1]
			q.append(v[:])
			prev[''.join(v)]=[nextstr,'U']
		v[coor],v[coor+X]=v[coor+X],v[coor]

try:
	while True:
		v=raw_input().split()
		print(m[''.join(v)][1])
except EOFError:
	pass
import sys
import numpy as np
input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    A = np.array(list(map(int, input().split())), dtype='i8')
    A = A.reshape((1, N))
    B = np.zeros((N, N), dtype='i8')
    for i in range(N):
        B[i][i - N] = 1
        B[i][i + 1 - N] = 1

    ans = np.linalg.inv(B) @ (A * 2).T
    ans = ' '.join(map(str, list(map(int, ans.flatten().tolist()))))
    print(ans)


if __name__ == '__main__':
    solve()


### FIXED CODE ###

import sys
import numpy as np
input = lambda: sys.stdin.readline().rstrip()


def solve():
    N = int(input())
    A = np.array(list(map(int, input().split())), dtype='i8')
    ans = np.zeros(N, dtype='i8')
    A = A * 2
    s = np.sum(A) // 2

    na1 = 0
    for i in range(1, N, 2):
        na1 += A[i]

    ans[0] = s - na1
    for i in range(N - 1):
        ans[i + 1] = A[i] - ans[i]

    print(' '.join(map(str, ans.tolist())))


if __name__ == '__main__':
    solve()
a=list(str(input()))
e=int(''.join(a))


b=int(a[1])-int(a[1]*111)
c=a[0]
c=int(c)
b = e-c*111
if b =<0:
  print(c*111)
else:
  c+=1
  print(c*111)

### FIXED CODE ###

a=list(str(input()))
e=int(''.join(a))


b=int(a[1])-int(a[1]*111)
c=a[0]
c=int(c)
b = e-c*111
if b <=0:
  print(c*111)
else:
  c+=1
  print(c*111)