peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
n,a,b = input().split()
n,a,b = [int(n), int(a), int(b)]
num = n // (a + b)
ber = n % (a + b)
ans = a * num

if ber > a:
  ans += a
else:
  ans += ber
  
print(ans)
# Judge status: Wrong Answer
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    n = int(input())
    a = list(map(int, input().split()))
    a = sorted(a)[::-1]
    if n %2== 0:
        print(a[0]+sum(a[1:n//2]))
    else:
        print(a[0]+sum(a[1:n//2+1])*2)



if __name__ == '__main__':
    main()
# Judge status: Accepted
t = input()
t = [s for s in t]
for i in range(len(t)):
    if t[i]=='?':
        t[i] = 'D'
ans = ''.join(t)
print(ans)
# Judge status: Accepted
A, B= map(int,input().split())
 
if A <6:
  print(0)
elif A>12:
  print(B)
else:
  print(int(B/2))
# Judge status: Accepted
s=input()
if "keyence"==s:exit(print("YES"))
for i in range(10):
  for j in range(i,len(s)):
    if s[:i]+s[j:]=="keyence":exit(print("YES"))
print("NO")
# Judge status: Accepted
X,Y = map(int, input().split())

if X%Y == 0:
  print("-1")
  
else:
  print(X)
# Judge status: Accepted
r=int(input())
pi=3.14159265
print(r*2*pi)
# Judge status: Accepted
#!/usr/bin/env python3

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

if abs(x-a) < abs(x-b):
    print("A")
else:
    print("B")
# Judge status: Accepted
N = int(input())
ans = [] if N != 0 else [0]
while N:
    ans.append(-(N % -2))
    N = -(N // 2)
print("".join(map(str, ans[::-1])))
# Judge status: Accepted
from collections import Counter

n = int(input())
l = list("")
for i in range(n):
    s = ''.join(sorted(input()))
    l.append(s)
c = Counter(l)
c = c.most_common()
ans = 0
for i in range(len(c)):
    x = c[i][1] - 1
    while x > 0:
        ans += x
        x -= 1
print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
an = [0 for i in range(30)]
ans = []
for i in a:
    c = bin(i)
    d = len(c)-1
    count = 0
    while c[d] != 'b':
        if c[d] == '1':
            an[count] += 1
            an[count] %= 2
        d-=1
        count+=1
tmp = 0
for i in range(len(an)):
    if an[i] == 1:
        tmp += 2**i
for i in a:
    ans.append(i ^ tmp)
print(*ans)
# Judge status: Wrong Answer
d,n = map(int,input().split())

print(n*100**d)
# Judge status: Accepted
def main():
    n = int(input())
    p = [int(pn) for pn in input().split()]
    ans = 0
    is_changed = False
    for i in range(n):
        if is_changed:
            is_changed = False
        elif p[i] == i + 1:
            is_changed = True
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()
# Judge status: Accepted
a, b, c = map(int, input().split())
print(c - (a - b)) if (c - (a - b)) > 0 else print(0)
# Judge status: Accepted
s = input()
t = input()

for i in range(len(s)):
    ss = s[i:] + s[:i]
    if ss == t:
        print('Yes')
        exit(0)
print('No')
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))

sx = 1
delcnt = 0
for i in range(N):
    if a[i] == sx:
        sx = sx + 1
    else:
        delcnt = delcnt + 1

if sx > 1:
    print(delcnt)
else:
    print(-1)
# Judge status: Accepted
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
a = inpl()
a[0] -= 1
for i in range(1,n):
    if a[i] > a[i-1]:
        a[i] -= 1
    elif a[i] < a[i-1]:
        print('No')
        break
else:
    print('Yes')
# Judge status: Wrong Answer
N = int(input())
p = list(map(int, input().split()))
li = range(1, N+1)
count = 0
for i in range(len(p) - 1):
    if p[i] == li[i]:
        p[i], p[i + 1] = p[i + 1], p[i]
        count += 1
print(count)
# Judge status: Accepted
x,y=map(int,input().split())
if 0<=x<y:
    print(abs(y-x))
elif -y<x<y:
    print(abs(y+x)+1)
elif x<=-y<0:
    print(abs(-y-x)+1)
elif x<y<=0:
    print(abs(y-x))
elif 0<y<x:
    print(abs(-y+x)+2)
elif y==0 and y<x:
    print(abs(x)+1)
elif -x<=y<0:
    print(1+abs(y+x))
elif 0<=x<-y:
    print(abs(-y-x)+1)
else:
    print(abs(-y+x)+2)
# Judge status: Accepted
def main():
    X, Y = map(int, input().split())
    turtle = (Y - X * 2) / 2
    if turtle.is_integer() and 0 <= turtle <= X:
        print("Yes")
    else:
        print("No")


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
#print#!/usr/bin/env python3
#%% for atcoder uniittest use
import sys
input= lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(10**9)
def pin(type=int):return map(type,input().split())
def tupin(t=int):return tuple(pin(t))
def lispin(t=int):return list(pin(t))
#%%code

def resolve():
    N,=pin()
    A=[int(input())for i in range(N)]
    B=sorted(A)
    first=B[-1]
    second=B[-2]
    for a in A:
        if a==first:print(second)
        print(first)
          
#%%submit!    
resolve()
# Judge status: Accepted
n, k = map(int, input().split())
a = [0] + list(map(int, input().split()))

journey = [1]

for i in range(2 * n + 100):
    next = a[journey[-1]]
    journey.append(next)

if k < n+1:
    print(journey[k])
    exit()

loop_end = n

loop_start = n - 1

while (journey[loop_start] != journey[loop_end]):
    loop_start -= 1

period = loop_end - loop_start
k %= period

while k < n:
    k += period

print(journey[k])
# Judge status: Wrong Answer
X, Y = map(int, input().split())
if Y % X == 0:
    print(-1)
else:
    print(X * 2)
# Judge status: Wrong Answer
import math
a, b, c=input().split(" ")
a = float(a) 
b = float(b)
c = float(c) 
if  4*a*b < (c-a-b)*(c-a-b):
  print("Yes")
else:
  print("No")
# Judge status: Accepted
N=int(input())
A=[int(x) for x in input().rstrip().split()]
ans=[0 for i in range(N)]

for i in A:
  ans[i-1]+=1

for i in ans:
  print(i)
# Judge status: Wrong Answer
#editorial
n=int(input())
*a,=map(int, input().split())
pre=0
ans=1
for i in range(1,n):
    if pre*(a[i]-a[i-1])<0:
        pre=0
        ans+=1
    else:
        pre=a[i]-a[i-1]
print(ans)
# Judge status: Accepted
# ABC127A

a, b = map(int, input().split())
if a >= 13:
    print(b)
elif a >= 6:
    print(b // 2)
else:
    print(0)
# Judge status: Wrong Answer
s=input()
if s=="ARC":
    print("ABC")
else:
    print("ABC")
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
cnt = 0
two = 0
for i in a:
    if i % 4 == 0:
        cnt += 1
    elif i % 4 == 2:
        two += 1
if n // 2 <= cnt:
    print("Yes")
elif two >= 2 and (n - (two - 1)) // 2 <= cnt:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a = list(map(int,input().split()))
A = list(map(int,input().split()))

K = a[0]
N = a[1]

A_nplus1 = K + A[0]
A.append(A_nplus1)

max = -1
max_id = -1

for i in range(0,N):
    if A[i+1]-A[i] > max:
        max = A[i+1] - A[i]
print(K-max)
# Judge status: Wrong Answer


lst = list(input().split())
a = "".join(lst)
print("YES" if int(a) % 4 == 0 else "No")
# Judge status: Accepted
n=int(input())
l=[input() for _ in range(n)]
from collections import Counter as co
d=co(l)
k=max(d.values())
x=[]
for i,j in d.items():
  if j==k:
    x.append(i)
x.sort()
for i in x:
  print(i)
# Judge status: Wrong Answer
import numpy as np
import fractions

a,b=map(int, input().split())
if(a%2):
    print(a*b//2+1)
else:
    print(a*b//2)
# Judge status: Wrong Answer
n = int(input())
nums = [int(x) for x in input().split(" ")]
def gcd(a, b):
  if b == 0:
    return a
  else: return gcd(b, a%b)

lcm = 1
for i in nums:
  lcm = (lcm * i // gcd(lcm, i)) % (1000000007*1000000007)

res = 0
for i in nums:
  res += (lcm // i) % 1000000007
print(res % 1000000007)
# Judge status: Wrong Answer
N = input()
lst = list(map(int,input().split()))
cnt = 0
lst = sorted(lst)
for i in range(len(lst)):
  for j in range(len(lst)):
    for k in range(len(lst)):
      if lst[i]+lst[j] > lst[k]:
        if lst[k] != lst[j] and lst[j] != lst[i]:
          cnt += 1
print(cnt)
# Judge status: Wrong Answer
N, M = map(int, input().split())
if abs(N - M) > 2:
    print(0)
    quit()
MOD = 10 ** 9 + 7
fact = [1] * (max(N, M) + 1)
f = 1
for i in range(1, max(N, M) + 1):
    f = f * i % MOD
    fact[i] = f
print(((N == M) + 1) * fact[N] * fact[M] % MOD)
# Judge status: Wrong Answer
S = int(input())

x1 = 10 ** 9
y1 = 1
x2 = S % (10 ** 9)
y2 = S // (10 ** 9)
x3 = 0
y3 = 0


print(x1, y1, x2, y2, x3, y3)
# Judge status: Accepted
x = input()
cnt = 0
for x_ in x:
    if x_ == 'T' and cnt:
        cnt -= 1
    elif x_ == 'S':
        cnt += 1
print(2 * cnt)
# Judge status: Accepted
N=int(input())
ans=0
v=list(map(int,input().split()))

v.sort(reverse=True)

for i in range(N):
    ans+=v[i]/(2**(i+1))

ans+=v[N-1]/(2**(i+1))

print(ans)
# Judge status: Wrong Answer
a = list(map(int,input().split()))
b = list(map(int,input().split()))
for v in range(a[1]-a[0]):
  c=list(map(numpy.prod.b[0+v:a[0]+v]))
for m in range(a[1]-a[0]):
  if c[m+1]>c[m]:
    print("Yes")
  else:
    print("No")
# Judge status: Accepted
def main():
  n = int(input())
  dp = [0, 0, 0]
  
  for activities in [list(map(int, input().split())) for _ in range(n)]:
    new_dp = [0, 0, 0]
    
    for i in range(3):
      offset = dp[i]
      for j in range(3):
        if i == j: continue
          
        new_dp[j] = max(new_dp[j], offset + activities[j])
    
    dp = new_dp
  
  print(max(dp))

if __name__ == "__main__":
  main()
# Judge status: Accepted
MM = input().split()
a = int(MM[0])
b = int(MM[1])
list1 = [str(a)*b,str(b)*a]
list1.sort()
print(list1[0])
# Judge status: Accepted
import numpy as np

N, M = map(int, input().split())
A = []
for i in range(N):
    A.append([int(i) for i in input().split()])
for i in range(N):
    del A[i][0]

cnt = 0
for i in A[0]:
    flg = True
    for j in range(1,N):
        if not i in A[j]:
            flg = False
            break
    if flg:
        cnt +=1
print(cnt)
# Judge status: Accepted
def resolve():
	s = input()
	if s[0] != 'A':
		print('WA')
		return
	cnt = False
	for i in s[2:-1]:
		if i == 'C':
			cnt += 1
	if cnt != 1:
		print('WA')
		return
	for i in s:
		if i == 'A' or i == 'C':
			continue
		if i.isupper():
			print('WA')
			return
	print('AC')
resolve()
# Judge status: Wrong Answer
def golden_apple(n, d):

    ans = -(-n//((d+1*2)+1))

    return ans

def main():
    n, d = map(int, input().split())
    print(golden_apple(n, d))

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
lia = list(map(int, input().split()))
lib = list(map(int, input().split()))
lic = list(map(int, input().split()))

sati = 0
j = lia[0]

for i in lia:
  sati += lib[i-1]
  if j == i-1:    
    sati += lic[j-1]    
  j = i
  
print(sati)
# Judge status: Wrong Answer
import sys 
input = sys.stdin.readline
for tt in range(1):
	n = int(input())
	s = set()
	for i in range(n):
		if i==n-1:
			s.add(input().lower())
		else:
			s.add(input().lower()[:-1])
	print(len(s))
# Judge status: Accepted
N = int(input())
keys = list(map(int, input().split()))

values = [None] * N
for i in range(N):
    values[i] = i + 1

dic = {key : val for key, val in zip(keys, values)} 
for i in dic.values():
    print(i, end=" ")
# Judge status: Accepted
sx, sy, tx, ty = map(int,input().split())
dx = tx - sx
dy = ty - sy
print("D" + "R"*(dx+1) + "U"*(dy+1) + "L" + "D"*(dy)+ "L"*(dx) + "U" * dy + "R"*dx + "U"+"L"*(dx+1)+"D"*(dy+1) +"R")
# Judge status: Accepted
S = list(input())
if S[0] != 'A':
    print('WA')
    exit()
S[0] = 'a'
if S.count('C') != 1:
    print('WA')
    exit()
i = S.index('C')
if i == 1 or i == len(S)-1:
    print('WA')
    exit()
S[S.index('C')] = 'c'
if ''.join(S) == ''.join(S).lower():
    print('AC')
else:
    print('WA')
# Judge status: Accepted
N, M = map(int, input().split())

ac = 0
wa = dict()

done = dict()

for i in range(M):
    p, S = input().split()
    if p in done:
        continue
    if S == "AC":
        ac+= 1
        done[p] = True
    else:
        if p not in wa:
            wa[p] = 0
        wa[p] += 1

_wa = 0
for x in wa:
    if x in done:
        _wa += wa[x]

print(ac, _wa)
# Judge status: Accepted
n = int(input())
lst = list(map(int, input().split()))
res = 10 ** 10
for i in range(1, n):
  res = min(res, abs(sum(lst[:i]) - sum(lst[i:])))
print(res)
# Judge status: Accepted
H, N = map(int, input().split())

inf = float('inf')
dp = [inf] * (H + 1)
dp[0] = 0
for _ in range(N):
    A, B = map(int, input().split())
    for i in range(H):
        t1 = i + A
        if t1 > H:
            t1 = H
        t2 = dp[i] + B
        if t2 < dp[t1]:
            dp[t1] = t2
print(dp[H])
# Judge status: Wrong Answer
n = int(input())
p = list(map(int, input().split()))
cnt = 0
for i in range(1, n-3+2):
    print(i, p[i])
    if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
        cnt += 1
print(cnt)
# Judge status: Accepted
import re
s=str(input())
s = s.replace('?', '.')
t=str(input())
for i in range(len(s)-len(t),-1,-1):
  if re.match(s[i:i+len(t)],t):
    s=s.replace(".","a")
    print(s[:i]+t+s[i+len(t):])
    exit()
else:
  print("UNRESTORABLE")
# Judge status: Accepted
n,m=map(int,input().split())
if n % m ==0:
    print(0)
else:
    print(1)
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))
result = 0 
import numpy as np
num = np.array(a)
for i, a in enumerate(num):
    sum = np.sum(a*num[(i+1):])
    result += sum
if result >= (10**9 + 7):
    print(result % (10 ** 9 +7))
else:
    print(result)
# Judge status: Wrong Answer
import math
#from decimal import *
a,b = map(float, input().split())
int(a)
b = b*100
int(b)
#b_i = float(b - math.floor(b))
#print(b_i)
ans = int(a*b)
#Decimal(ans)
#ans_i = math.floor(a*b_i)
# ans = math.floor(Decimal(a)*Decimal(b))
print(int(ans//100))
# Judge status: Accepted
N,W = map(int, input().split())

import numpy as np
dp = np.zeros(W+1, dtype=int)

for n in range(N):
  w,v = map(int, input().split())
  dp[w:] = np.maximum(dp[w:], dp[:-w]+v)


print(dp[-1])
# Judge status: Accepted
import math
p=math.pi
a,b,h,m=map(int,input().split())
j=(b*math.cos(p*m/30),b*math.sin(p*m/30))
t=(a*math.cos((h/6+m/360)*p),a*math.sin((h/6+m/360)*p))
print(((j[0]-t[0])**2+(j[1]-t[1])**2)**(0.5))
# Judge status: Accepted
a,b= map(int, input().split())
print(int((b-a)*(b-a+1)/2-b))
# Judge status: Accepted
from itertools import groupby

n = int(input())
r = 'a',
for _ in range(n - 1):
  r = [s + c for s in r for c, _ in groupby(sorted(s) + [chr(ord(max(s)) + 1)])]
print(*r, sep='\n')
# Judge status: Accepted
def multiple(n):
    a = []
    for i in range(1,int(n**.5)+1):
        a.append(i*i)
    return a
n = int(input())
a = multiple(n)
ans = 10**18
for i in a:
    if n-i < 0:
        continue
    ans = min(ans,abs(n-i))
print(n-ans)
# Judge status: Wrong Answer
n = int(input())
s = input()

ans = 0
for i in range(n):
    for j in range(i + 2, n):
        for k in range(j + 2, n):
            if len(set([s[i], s[j], s[k]])) == 3 and abs(i-j) != abs(j-k):
                ans += 1

print(ans)
# Judge status: Accepted
n = int(input())
list = input().split()
flg=True
for i in list :
	i = int(i)
	if i%2==0 and not(i%3==0 or i%5==0):
		flg=False
		
if flg:
	print("APPROVED")
else:
	print("DENIED")
# Judge status: Wrong Answer
N=int(input())
a_list=list(map(int,input().split()))
a_list.sort(reverse=True)
c_list=[None]*N

c_list[0]=2**(len(bin(a_list[0])[2:])-1)
b=a_list[0]

for i,a in enumerate(a_list[1:]):
    c_list[1+i]=b^a^c_list[i]
    b=a

ans=" ".join(list(map(str,c_list)))
print(ans)
# Judge status: Wrong Answer
import math

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

ans = 0
for i in range(1, N+1):
    if i >= K:
        ans += 1/N
    else:
        n = math.ceil( math.log2( 10/i ))
        p = 1/N * (0.5**n)
        ans += p

print(ans)
# Judge status: Wrong Answer
N=input()[-1:]

if N=="3":
  print("bon")
elif N in {0,1,6,8}:
  print("pon")
else:
  print("hon")
# Judge status: Accepted
N=int(input())
xlist=list(map(int,input().split()))

xmin=min(xlist)
xmax=max(xlist)

min_answer=10**9
for i in range(xmin,xmax+1):
  answer=0
  for x in xlist:
    answer+=(x-i)**2

  min_answer=min(answer,min_answer)

print(min_answer)
# Judge status: Wrong Answer
import sys

def solve():
    input = sys.stdin.readline
    N, M = map(int, input().split())
    maxGCD = 1
    for gcd in range(2, M):
        if gcd * gcd > M: break
        else:
            if M % gcd == 0:
                if M // gcd >= N: maxGCD = gcd
    print(maxGCD)

    return 0

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
K = int(input())
x = 7 % K

for count in range(1, K + 1):
  if x == 0:
    print(count)
    break
  x = (x * 10 + 7) % K

else: print(-1)
# Judge status: Wrong Answer
n = int(input())
arr = [int(a) for a in input().split()]

i = max(arr)
j = min(arr, key=lambda a: min(abs(i//2-a), abs((i+1)//2-a)))

print(i, j)
# Judge status: Accepted
N=int(input())
s=[input() for i in range(N)]
r=set(s)
print(len(r))
# Judge status: Accepted
import collections
s = collections.deque(list(input()))
q = int(input())
cnt = 0
for i in range(q):
    fc = input().split()
    if fc[0] == '1':
        cnt += 1
    else:
        if cnt == 1:
            fc[1] = '1' if fc[1] == '2' else '2'
        if fc[1] == '1':
            s.appendleft(fc[2])
        else:
            s.append(fc[2])
    cnt %= 2
if cnt == 1:
    s.reverse()
print(*s, sep='')
# Judge status: Accepted
c, a, b = map(int, input().split())
print(int(min(a, b, c) * (a + b + c - min(a, b, c) - max(a, b, c)) / 2))
# Judge status: Wrong Answer
import sys
N = int(input())

ss = list(str(N))


s = list(map(int, ss))

if(N%2 == 0):
	print('No')
	sys.exit(0)

if(N%5 == 0):
	print('No')
	sys.exit(0)

if(N%7 == 0):
	print('No')
	sys.exit(0)

re = sum(s)

# re = 0
# for s in ss:
# 	re += int(s)
if(re%9 == 0):
# if(N%9 == 0):
	print('Yes')
# Judge status: Wrong Answer
N = int(input())
a = 0

if N>=100:
    a = N % 100
    if a == 2|4|5|7|9:
        print("hon")
    elif a == 0|1|6|8:
        print("pon")
    else:
        print ("bon")
# Judge status: Wrong Answer
x, y = map(int, input().split())

ans = 10**18

if y - x >= 0:
    ans = min(ans, y-x)

x *= -1

if y - x >= 0:
    ans = min(ans, y-x)

x *= -1
y *= -1

if y - x >= 0:
    ans = min(ans, y-x)

x *= -1

if y - x >= 0:
    ans = min(ans, y-x)

print(ans)
# Judge status: Wrong Answer
import sys
a,b = map(int,input().split())
c = 0
if a < 0 and b < 0:
    if  a-b % 2 == 0:
        print("Positive")
elif a < 0 and b >= 0:
    if a%2 == 0:
        print("Positive")
elif a < 0 and b >= 0:
    if b % 2 == 0:
        print("Positive")
elif (a+b) == 0:
    print("Zero")
elif (a+b) > 0:
    print("Positive")
else:
    print("Negative")
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))

k = 1
ans = 0

if 1 not in A:
  print(-1)
  exit()

for a in A:
  if a == k:
    k += 1
  else:
    ans += 1

print(ans)
# Judge status: Accepted
N, M = map(int, input().split())
ans = 1
MOD = 10 ** 9 + 7

if abs(N - M) >= 2:
	print(0)
else:
	for i in range(1, N + 1):
		ans *= (i % MOD)
		ans %= MOD
	for i in range(1, M + 1):
		ans *= (i % MOD)
		ans %= MOD
	if (N + M) % 2 == 0:
		ans *= 2

	print(ans % MOD)
# Judge status: Wrong Answer
n = int(input())
a = sorted(list(map(int, input().split())))

res = 0
for i in range(n):
    for j in range(i):
        if a[j] * 2 > a[i]:
            break
        if a[i] % a[j] == 0:
            res += 1
            break

print(n - res)
# Judge status: Wrong Answer
import math
import sys

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

a = input().split()
l_si_i = [int(b) for b in a]
#print(l_si_i)

#print(max(l_si_i))
#print(sum(l_si_i))

border = math.floor(sum(l_si_i) / (4 * m))
#print(border)

check = 0
for i in range(n):
  c = l_si_i[i]
  if c > border:
    check += 1
    
  if check >= m:
    print("Yes")
    sys.exit()
    
print("No")
# Judge status: Wrong Answer
mod=10**9+7
n,k=map(int,input().split())
ans=(n+1)*( (n+k+1)*(n-k+2)/2 - (n+2)*(2*n+3)/6 )+k*(k-1)*(2*k-1)/6+(n-k+2)
ans=int(ans%mod)
print(ans)
# Judge status: Accepted
s = str(input())
t = str(input())

if(t.startswith(s)):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b = [int(input()) for _ in range(2)]
l = list([1,2,3])
l.remove(a)
l.remove(b)
print(l[0])
# Judge status: Accepted
k=int(input())
a,b=map(int,input().split())
c=0
for i in range(a,b+1):
    if i%k==0:
        c=1
        break
if c==1:
    print('OK')
else:print('NG')
# Judge status: Accepted
# print('input >>')

S = input()

N = len(S)

def is_kaibun(S):
    for i in range(len(S)):
        if S[i] != S[-i-1]:
            return False
    return True

if is_kaibun(S) and is_kaibun(S[:(N-1)//2]) and is_kaibun(S[(N+3)//2-1:N]):
    print('Yes')
else:
    print('No')

# print('-----output-----')
# Judge status: Accepted
s = input()
ints = [ord(i) - ord('a') for i in s]
K = int(input())
n = len(s)
i = 0
while i < n:
    if ints[i] != 0 and 25 - ints[i] + 1 <= K:
        K -= 25 - ints[i] + 1
        ints[i] = 0
    i += 1

K %= 26
ints[-1] = (ints[-1] + K) % 26
s_ = ''
for i in ints:
    s_ += chr(i + ord('a'))

print(s_)
# Judge status: Accepted
n,x,t= map(int,input().split()) #標準入力

if(n%x==0):
	num=n//x
else:
	num=n//x+1

print(num*t) #焼くセット数*時間を計算して出力(())
# Judge status: Accepted
n, m = map(int, input().split())
if n >= 2:
  if m >= 2:
    print((n-2) * (m-2)) 
  else:
    print((n-2) * m)
else:
  if m >= 2:
    print(n * (m-2)) 
  else:
    print(n * m)
# Judge status: Wrong Answer
N=int(input())
for i in range(1,10):
  if (N/i).is_integer==True and (N/i)<10:
      print("Yes")
print("No")
# Judge status: Accepted
from collections import deque
N,M=map(int,input().split())
C=[[] for i in range(N+1)]
for i in range(M):
  A,B=sorted(list(map(int,input().split())))
  C[A].append(B)
  C[B].append(A)

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

queue=deque([1])
while queue:
  now = queue.popleft()
  for i in C[now]:
    if d[i]!=-1:continue
    d[i]=now
    queue.append(i)

if d.count(0)>2:print('No');exit
print('Yes')
for i in range(2,N+1):
  print(d[i])
# Judge status: Wrong Answer
N,M=map(int,input().split())
sc=[list(map(int,input().split()))for _ in [0]*M]

ans=['1']+['0']*(N-1)
count=[0]*N
for s,c in sc:
    if count[s-1]==1 and ans[s-1]!=str(c):
        ans='-1'
        break
    else:
        ans[s-1]=str(c)
        count[s-1]=1

if N>=2 and ans[0]=='0':
    ans='-1'

if M==0:
    ans='0'

print(''.join(ans))
# Judge status: Accepted
N, M = map(int, input().split())
A = list(map(int, input().split()))
b = []
for i in range(M):
    b.append(list(map(int, input().split())))
ans = 0
A.sort()
b.sort(key=lambda x: x[1], reverse=True)
j = 0
for i in range(M):
    if j >= N or b[i][1] <= A[j]:
        break
    while j < N and b[i][0] and b[i][1] > A[j]:
        ans += b[i][1]
        b[i][0] -= 1
        j += 1
if j >= N:
    print(ans)
else:
    print(ans + sum(A[j:]))
# Judge status: Accepted
s = input()
t = input()
n = len(s)
m = len(t)
ans = m
for i in range(n-m+1):
    x = m
    for j in range(m):
        if s[i+j] == t[j]:
            x -= 1
    ans = min(ans,x)
print(ans)
# Judge status: Accepted
N, K = map(int,input().split())

counter = 1
while N >= K:
    N = N/K
    counter = counter + 1

print(counter)
# Judge status: Accepted
X, Y = map(int, input().split())
ans = 0

while X <= Y:
    X *= 2
    ans += 1

print(ans)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
s = [0]*(n+2)
for i in range(n, -1, -1): s[i] = s[i+1]+a[i]

def solve():
    cur = 1
    res = 0
    for i in range(n+1):
        if cur < a[i]: return -1
        res += cur
        cur -= a[i]
        if cur > s[i+1]: return -1
        cur = min(cur*2, s[i+1])
    return res

print(solve())
# Judge status: Accepted
K = int(input())
num_even = K // 2
num_odd = K - num_even
print(num_even * num_odd)
# Judge status: Accepted
def main():
    X = int(input())
    for i in range(1000):
        if 100*i <= X <= 105*i:
            print(1)
            return
    print(0)

if __name__ == "__main__":
    main()
# Judge status: Accepted
a, b, c, d = map(int, input().split())

if b < c or d < a:
    print(0)
else: 
    print(min(b, d) - max(a, c))