peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a,b,c,x,y=map(int,input().split())

if a+b <= c*2:
    print(a*x +b*y)
else:
    if x>y:
        i=a
    elif x<y:
        i=b
    else:
        i=0
    
    p=min(x,y)*c*2 + abs(x-y)*i
    q=max(x,y)*c*2
    
    if p >= q:
        print(q)
    else:
        print(p)
# Judge status: Wrong Answer
import bisect,collections,copy,itertools,math,string
def I(): return int(input())
def S(): return input()
def LI(): return list(map(int,input().split()))
def LS(): return list(input().split())
##################################################
X = I()
_500 = X//500
_nokori = (X%500)//5
print(_nokori)
print(_500*1000+_nokori*5)
# Judge status: Accepted
def solve():
    n, m = map(int, input().split())

    ans = abs(0*4 + 0*(n-2)*2 + 0*(m-2)*2 + 1*(n-2)*(m-2))

    return ans

print(solve())
# Judge status: Accepted
K = int(input())
m = 0
for k in range(1,K + 1):
  m = m * 10 + 7
  m = m % K
  if m == 0:
    print(k)
    break
if m > 0:
  print(-1)
# Judge status: Wrong Answer
A, B = map(int, input().split())

N = 1000
p1 = 0.08
p2 = 0.1

for i in range(1, N + 1):
    if int(i * p1) == A and int(i * p2):
        print(i)
        exit()

print("-1")
# Judge status: Accepted
a, b = [int(x) for x in input().split()]

As = str(a) * b
Bs = str(b) * a

print(min(As, Bs))
# Judge status: Wrong Answer
s = input()
import itertools
def countstrs(s):
    return [(k, len(list(g))) for k, g in itertools.groupby(s)]
c = countstrs(s)
ma , mi  = 0, 0
c = 0
r = []
for i in range(len(s)):
    r.append(c)
    if s[i] == "<":
        c += 1
    else:
        c -= 1
r = max(r) - min(r) + 1
res = 0
for i in range(r+1):
    res += i
print(res)
# Judge status: Accepted
import math
X = int(input())
print(360 // math.gcd(X, 360))
# Judge status: Accepted
a, b, k = list(map(int, input().split()))

for i in range(k):
    x = a + i
    if x <= b:
        print(a + i)
    
for i in range(k):
    x = b - k + i + 1
    if x <= a + k - 1 or x < a:
        pass
    else:
        print(x)
# Judge status: Accepted
# A
import sys
s = input()
pre = ''
for c in s:
    if c == pre:
        print('Bad')
        sys.exit()
    pre = c
print('Good')
# Judge status: Accepted
rStr = input()

A = int(rStr.split(' ')[0])
B = int(rStr.split(' ')[1])
T = int(rStr.split(' ')[2])

result = int((T + 0.5) / A) * B

print(result)
# Judge status: Wrong Answer
N = int(input())

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

ans = sum(A)^2

for a in A:
  ans -= a^2

ans /= 2

print(int(ans%(10^9+7)))
# Judge status: Accepted
n,*a=map(int,open(0).read().split());t=sum(a);v=w=1
for q in a:
  if(w:=min(2*(w-q),t:=t-q))<0:exit(print(-1))
  v+=w
print(v)
# Judge status: Accepted
s = input()
k = int(input())
i = 0
while True:
  if s[i] == '1':
    if k <= i+1:
      print('1')
      break
    else:
      i += 1
  else:
    print(s[i])
    break
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
n = int(input())
a1 = int(input())
a = [a1]
for _ in range(n-1):
  ai = int(input())
  if ai <= a[-1]:
    a.append(ai)
  elif ai >= a[0]:
    a = [ai]+a[1:]
  else:
    h = 0
    l = len(a)-1
    while l-h>1:
      m = (l+h)//2
      if ai > a[m]:
        l = m
      else:
        h = m
    a = a[:l]+[ai]+a[l+1:]
print(len(a))
# Judge status: Accepted
N,M = map(int, input().split())
H = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
ans = [1]*N
for A,B in AB:
    if H[A-1] > H[B-1]:
        ans[B-1] = 0
    elif H[A-1] < H[B-1]:
        ans[A-1] = 0
    else:
        ans[B-1] = 0
        ans[A-1] = 0
print(ans.count(1))
# Judge status: Accepted
N,M = list(map(int,input().split()))
xfrom1 = []
xton =[]
for i in range(M):
    a,b = list(map(int,input().split()))
    if a == 1:
        xfrom1.append(b)
    elif a== N:
        xton.append(b)
    elif b==N:
        xton.append(a)
if len(set(xfrom1) & set(xton)) >0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Judge status: Accepted
n=int(input()) 
flag = False
for i in range(100*n,100*(n+1)):
  if i%108 == 0:
    x = int(i//108)
    print(x)
    flag = True
    break
if flag == False:
  print(':(')
# Judge status: Accepted
S = list(map(int, input()))

if 0<S[0]*10+S[1]<=12 and 0<S[2]*10+S[3]<=12:
    print('AMBIGUOUS')
elif 0<S[0]*10+S[1]<=12:
    print('MMYY')
elif 0<S[2]*10+S[3]<=12:
    print('YYMM')
else:
    print('NA')
# Judge status: Accepted
H,N=map(int,input().split());A=list(map(int,input().split()));print('Yes' if sum(A)>=H else 'No')
# Judge status: Accepted
a = int(input())
a = a + a * a + a * a * a
print(a)
# Judge status: Wrong Answer
N, M = map(int, input().split())
a = [0]*M
b = [0]*M
for i in range(M):
  a[i], b[i] = map(int, input().split())
  
c = []
for i in range(M):
  if b[i] == M:
    c.append(a[i])
if len(c) != 0:
  for i in range(M):
    if a[i] == 1:
      for j in range(len(c)):
        if b[i] == c[j]:
          print("POSSIBLE")
          exit()
print("IMPOSSIBLE")
# Judge status: Accepted
a, b = map(int, input().split())

if a % 3 == 0 or b % 3 == 0 or (a + b) % 3 == 0:
    print('Possible')
else:
    print('Impossible')
# Judge status: Accepted
x=int(input())
ans=0
money=100
while money<x:
  ans+=1
  money=money+money//100
print(ans)
# Judge status: Accepted
a=input()
if (a=='a')or(a=='i')or(a=='u')or(a=='e')or(a=='o'):
    print('vowel')
else:
    print('consonant')
# Judge status: Wrong Answer
N = raw_input()
ans = 0

for item in reversed(N):
    if int(item) < 6:
        ans = ans + int(item)
    else:
        ans = ans + (11-int(item))

print ans
# Judge status: Accepted
S=input()
S=sorted(set(S))
if S.count("N")==1:
	if S.count("S")==0:
		print("No")
		exit()
if S.count("S")==1:
	if S.count("N")==0:
		print("No")
		exit()
if S.count("E")==1:
	if S.count("W")==0:
		print("No")
		exit()
if S.count("W")==1:
	if S.count("E")==0:
		print("No")
		exit()
print("Yes")
# Judge status: Wrong Answer
import bisect
n,k = map(int, input().split())
x = list(map(int, input().split()))
z = bisect.bisect_left(x,0)

ans=10**12
s=z-k+1
if s < 0:
  s=0
g=z+k-1
if g >= n or g==0:
  g=n

for i in range(s,g):
  if i+k > n:
    break
  t=x[i:i+k]
  if min(t)*max(t) > 0:
    ans=min(ans, abs(max(t)))
  else:
    tmp=abs(min(t))+max(t)
    tmp+=min(abs(min(t)),abs(max(t)))
    ans=min(ans,tmp)
print(ans)
# Judge status: Accepted
S = {i:list(input()) for i in 'abc'}
s = 'a'
while S[s]:
    s = S[s].pop(0)
print(s.upper())
# Judge status: Accepted
import collections

n = int(input())
s = [input() for x in range(n)]
m = int(input())
t = [input() for y in range(m)]
ans = 0

S = collections.Counter(s)
T = collections.Counter(t)

for k, v in S.items():
    tmp = 0
    tmp = v
    if k in T:
        tmp -= T[k]
    ans = max(ans, tmp)

print(ans)
# Judge status: Wrong Answer
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
s = readline().decode().rstrip()

cost = [0]*n
cost[0] = s.count('E')
if s[0] == 'W':
    cost[1] += 1

for i in range(1, n):
    if s[i] == 'E':
        cost[i] += cost[i - 1] - 1
    else:
        cost[i] += cost[i - 1]
        if i < n - 1:
            cost[i + 1] += 1
print(min(cost))
# Judge status: Wrong Answer
n = int(input())
s = input()
half = n // 2

if n / 2 == 1:
  print("No")
elif s[:half] == s[half:]:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
from bisect import bisect_right, bisect_left
from itertools import groupby, permutations, combinations
from fractions import gcd
import numpy as np
from sys import stdin, stderr

def main():
    H = int(input())
    W = int(input())
    N = int(input())

    l = max(H,W)
    ret = N // l
    return ret


if __name__ == "__main__":
    print(main())
# Judge status: Accepted
n = int(input())
s = input()
for i in range(len(s)):
    print(chr(65 + (ord(s[i]) - 65 + n) % 26), end = "")
print()
# Judge status: Wrong Answer
import sys
S = list(input())
C_cnt,low,upp = 0,0,0
if S[0] != "A" or S[-1].isupper() or S[1] == 'C':
  print("WA")
  sys.exit()
for i in range(2,len(S)-1):
  if S[i] == "C":
    C_cnt += 1
  elif S[i].islower():
    low += 1
  elif S[i].isupper():
    upp += 1
if C_cnt == 1 and low == len(S)-3 and upp == 0:
  print("AC")
else :
  print("WA")
# Judge status: Accepted
x = int(input())
print(0) if x == 1 else print(1)
# Judge status: Accepted
#coding:utf-8

s = str(input())

if s == 'ABC':
    print('ARC')
elif s == 'ARC':
    print('ABC')
# Judge status: Accepted
from itertools import combinations
n = int(input())
arr = list(map(int, input().split()))
count = 0
for i, j, k in combinations(arr, 3):
    if i == j or j == k or k == i:
        continue
    elif (i + j) > k and (j + k) > i and (k + i) > j:
        count += 1
print(count)
# Judge status: Accepted
X,Y = map(int,input().split())
if Y%2 == 0 and 2*X<=Y<=4*X:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
x, y, z = map(int, input().split())
n = z
cnt = 0
while n < x:
  n += (y + z)
  cnt += 1
print(cnt)
# Judge status: Accepted
from math import gcd
N = int(input())
A = list(map(int, input().split()))
res = A[0]
for i in range(1,N):
    res = gcd(res,A[i])
print(res)
# Judge status: Accepted
# 入力
A, B = map(int, input().split())

# 出力
if A + B == 24:
    w = 0
elif A + B > 24:
    w = abs(24 - (A + B))
else:
    w = A + B


print(w)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

cnt = [0]*(10**5+5)
for i in a:
    cnt[i] += 1

ans = 0
for i in range(1, 10**5+3):
    ans = max(ans, sum(cnt[i-1:i+2]))
print(ans)
# Judge status: Accepted
n = int(input())
a = [int(val) for val in input().split()]
mp = dict()
ans = 0
for i in range(n):
    addval = a[i] + (i + 1)
    subval = (i + 1) - a[i]
    if subval in mp.keys():
        ans += mp[subval]
    mp[addval] = mp.get(addval, 0) + 1

print(ans)
# Judge status: Accepted
from math import factorial
N, M = map(int, input().split())
if N > 1:
  a = factorial(N) / (factorial(2) * factorial(N-2))
else:
  a = 0
if M > 1:
  b = factorial(M) / (factorial(2) * factorial(M-2))
else:
  b = 0
print(int(a+b))
# Judge status: Accepted
num = int(input())
if num % 1000 == 0:
    print(0)
else:
    t = num // 1000
    t += 1
    print(t * 1000 - num)
# Judge status: Wrong Answer
D=int(input())
c=[]
c=list(map(int,input().split()))
s=[]
for i in range(D):
    s.append(list(map(int,input().split())))
 
for i in range(D-1):
  print('8')
# Judge status: Accepted
def order(x):
    return (x + 9) // 10 * 10

def wait(x):
    return order(x) - x

dishes = [int(input()) for _ in range(5)]
total = sum(order(i) for i in dishes)
total -= max(wait(i) for i in dishes)
print(total)
# Judge status: Accepted
lst=sorted(map(int,input().split()))
print("Yes" if lst[0]+lst[1]==lst[2] else "No")
# Judge status: Wrong Answer
q, h, s, d = map(int, input().split())
n = int(input())
min_1l = min(q*4, h*2, s)
min_2l = min(min_1l*2, d)

print(min(n*min_1l, (n//2)*min_2l + min_1l))
# Judge status: Accepted
# A - Between Two Integers
# https://atcoder.jp/contests/abc061/tasks/abc061_a

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

result = 'No'

if A <= C <= B:
    result = 'Yes'

print(result)
# Judge status: Accepted
s = input()

if len(s) == len(set(s)):
    print('yes')
else:
    print('no')
# Judge status: Wrong Answer
n,m = map(int,raw_input().split(' '))
print n*(n-1) + m*(m-1)
# Judge status: Accepted
N= input()
A = list(map(int,input().split()))
A = sorted(A,reverse=True)
print(sum(A[::2]) - sum(A[1::2]))
# Judge status: Wrong Answer
#abc 158 b
"""
input().split()
map(int,input().split())
print("Yes" if flag else "No")
for i in range():
"""
n,a,b=map(int,input().split())
ans=0
if a+b>=2:
    ans=n//(a+b)
elif a==0:
    ans=0
elif b==0:
    ans=n
elif n%(a+b)-b<0:
    ans+=n%(a+b)
else:
    ans+=n%(a+b)-b
print(ans)
# Judge status: Wrong Answer
S=int(input())
if S<10**18:
    x1,y1,x2,y2,x3,y3=0,0,-(-S//10**9),10**9-S%10**9,1,10**9
else:
    x1,y1,x2,y2,x3,y3=(0,0,10**9,1,0,10**9)
print(x1,y1,x2,y2,x3,y3)
# Judge status: Accepted
n = int(input())
s = [input() for _ in range(n)]

s_t = set(s)
print(len(s_t))
# Judge status: Wrong Answer
n = int(input())
a = int(input())
mod = n % 500
if mod < a:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
def gcd(a,b):
    x=max(a,b)
    y=min(a,b)
    if x%y==0:
        return y
    else:
        while x%y!=0:
            z=x%y
            x=y
            y=z
        else:
            return z
        
def lcm(a,b):
    return int(a*b//gcd(a,b))

N=int(input())

a=int(input())

for n in range(1,N):
    b=int(input())
    a=lcm(a,b)
print(a)
# Judge status: Accepted
x, y = map(int, input().split())
#A = []

ans = 0
while x <= y:
    ans += 1
    x *= 2
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())
if n == 1 and m == 1:
    print(1)
    exit()
elif n == 1 or m == 1:
    print(n*m-2)
    exit()
elif n == 2 or m == 2:
    print(0)
    exit()
else:
    print(n*m-(2*(m-1)+2*(n-1)))
# Judge status: Accepted
a=int(input())
k=1
for i in range(0,100000):
  if a<(k**2):
    break
  else:
    k+=1
print((k-1)**2)
# Judge status: Accepted
a=int(input())
even_num = 0
odd_num = 0
if a %2==0:
    even_num += a/2
    odd_num +=a/2
else:
    even_num +=(a+1)/2 - 1
    odd_num +=(a+1)/2
print(int(even_num*odd_num))
# Judge status: Accepted
n = int(input())
s = str(input())
cnt1 = s.count("W") # Wの文字数
cnt2 = len(s) - cnt1 # Rの文字数
ss = s[:cnt2]
cnt3 = ss.count("W")
print(min(cnt1, cnt3))
# Judge status: Accepted
import math
N,M = map(int,input().split())
f = 1
if abs(N-M) > 1:
    print(0)
    exit()
if (N+M) % 2 == 0:
    f = 2

print(math.factorial(N) % (10**9+7) * math.factorial(M) % (10**9+7) * f % (10**9+7))
# Judge status: Accepted
from collections import Counter

N = int(input())
A = list(map(int, input().split()))
if A[0] != 0:
  print(0)
  exit()
AC = list(Counter(A).items())
AC.sort()
MOD = 998244353
ans = 1
last_v = 1
last_k = -1
for k, v in AC:
  if k == 0:
    if v != 1:
      print(0)
      exit()
    last_k = 0
    continue
  if k != last_k+1:
    print(0)
    exit()
  ans = ans*pow(last_v, v, MOD)%MOD
  last_v = v
  last_k = k
print(ans)
# Judge status: Wrong Answer
import math
a,b,x = map(int,input().split())
def f(t):
    t = math.radians(t)
    if a * math.tan(t) <= b:
        return a**2 * b - a**2 * math.tan(t) / 2
    else:
        return b**2 / math.tan(t) * a / 2
tmax = 90
tmin = 0
for i in range(10**6):
    tmid = tmin + (tmax-tmin) / 2
    if f(tmid) < x:
        tmax = tmid
    else:
        tmin = tmid
print(tmid)
# Judge status: Accepted
from itertools import permutations 
N = int(input())
P = tuple(map(int, input().split()))
Q = tuple(map(int, input().split()))
perm = list(permutations(range(1,N+1), N))
print(abs(perm.index(P) - perm.index(Q)))
# Judge status: Wrong Answer
N = int(input())
T = [list(map(int, input().split())) for i in range(N)]
print(T)
dp = [[0 for i in range(3)] for j in range(N+1)]
print(dp)
dp[1] = T[0]
print(dp)
for i in range(2,N+1):
    dp[i][0] = max(dp[i-1][1]+T[i-1][0],dp[i-1][2]+T[i-1][0])
    dp[i][1] = max(dp[i-1][0]+T[i-1][1],dp[i-1][2]+T[i-1][1])
    dp[i][2] = max(dp[i-1][0]+T[i-1][2],dp[i-1][1]+T[i-1][2])
    print(dp)
print(max(dp[-1]))
# Judge status: Accepted
W,H,N=map(int,input().split())
W0=0
H0=0
for i in range(N):
    x1,y1,a1=map(int,input().split())
    if a1 ==1 and W0<x1:
        W0=x1
    elif a1==2 and W>x1:
        W=x1
    elif a1==3 and H0<y1:
        H0=y1
    elif a1==4 and H>y1:
        H=y1

if W-W0>0 and H-H0>0:
    print((W-W0)*(H-H0))
else:
    print(0)
# Judge status: Accepted
N = int(input())
S = str(input())
N = N%26

for s in S:
    print(chr(((ord(s)-65)+N)%26+65), end="")
print()
# Judge status: Accepted
import math
def factorization(n):
  arr = []
  temp = n
  for i in range(2, int(math.sqrt(n))+1):
    if temp%i == 0:
      cnt = 0
      while temp%i == 0:
        cnt += 1
        temp //= i
      arr.append([i, cnt])
  if temp != 1:
    arr.append([temp, 1])
  if arr == []:
    arr.append([n, 1])
  return arr

n = int(input())
factors = factorization(n)
res = 0
for j,cnt in factors:
  if j == 1: continue
  i = 1
  while cnt >= i:
    cnt -= i
    i += 1
    res += 1

print(res)
# Judge status: Accepted
# N = int(input())
N, A, B = map(int, input().split())
students = list(input())
through = 0
abroad_rank = 0
for student in students:
    if through >= A+B:
        print('No')
        continue
    if student == 'a':
        print('Yes')
        through += 1
    elif student == 'b':
        if abroad_rank+1<=B:
            print('Yes')
            through += 1
            abroad_rank += 1
        else:
            print('No')
    else:
        print('No')
# Judge status: Wrong Answer
X = int(input())
K = int(360/X)
print(K)
# Judge status: Accepted
#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
    A, B, C, D = map(int, input().split())
    ans = -10**9**2

    for ab in (A, B):
        for cd in (C, D):
            if ab * cd > ans:
                ans = ab * cd

    print(ans)


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
i=list(map(int,input().split()))
i.sort()
a=0
for k in range(len(i)):
  if i[k]!=i[k-1]:
    a+=1
print(a)
# Judge status: Accepted
x = "T"+input()+"S"
ans = len(x)-2
s = t = 0
for i in x:
    if i=="S":
        ans -= min(s,t)*2
        if s>t:
            s -= t
            t = 0
        else: t = s = 0
        s += 1
    else: t += 1
print(ans)
# Judge status: Accepted
print(max(-(b:=(c:=sum(a:=[*map(int,[*open(0)][1].split())]))>0),sum((b:=min(c:=c-a,b-a<<1))for a in a)+1))
# Judge status: Accepted
n,m = list(map(int, input().split()))

ac = [0]*n
wa = [0]*(n+1)
pena = 0

for i in range(m):
  ques, state = input().split()
  ques = int(ques)-1
  
  if (state=="AC") and (ac[ques]==0):
    ac[ques] = 1
    pena += wa[ques]
  elif (state=="WA") and (ac[ques]==0):
    wa[ques] += 1
    
print(sum(ac), pena)
# Judge status: Wrong Answer
K,A,B=map(int,input().split())
ans=0
if B-A<=2 or K+1<=A: #ぼったくり
  ans=K+1
else: #notぼったくり
  # A-1回ポケット叩いてA個のビスケットを用意する。A-1/Kつかう
  # B枚に交換してBの方が大きいので交換し続ける。それぞれ2/Kつかう
  # 最後に1回あまればビスケットを1枚増やしとく。1/Kつかう
  t=(K-A+1)//2 #交換する回数
  ans=B*t+(K-A+1)%2
print(ans)
# Judge status: Wrong Answer
def ceil(a, b):
    return (a + b - 1) // b


N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
n = sum(b) - sum(a)
for _a, _b in zip(a, b):
    if _a > _b:
        n -= _a - _b
    if _a + _b & 1:
        n -= 1
if n >= 0:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
P = tuple(map(int,input().split()))
Q = tuple(map(int,input().split()))
from itertools import permutations
s = list(permutations([i for i in range(1,N+1)]))
for i,e in enumerate(s):
    if e == P:
        p_ans = i
    if e == Q:
        q_ans = i
print(abs(p_ans-q_ans))
# Judge status: Accepted
#python3
def main():
    s = input()
    ans = 0
    cnt = 0
    for i in range(len(s)):
        if (s[i] == "A") | (s[i] == "T") | (s[i] == "C") | (s[i] == "G"):
            cnt += 1
        else:
            cnt = 0
        ans = max(ans, cnt)
    print(ans)
main()
# Judge status: Wrong Answer
n = int(open(0).read())
A = [1] + [6**i for i in range(1, 7)] + [9**i for i in range(1, 6)]
dp = [0] * (10**6 + 1)
dp[1] = 1
for i in range(2, n+1):
    dp[i] = min(dp[i-a]+1 for a in A if i>a)
for a in A:
    dp[a] = 1
print(dp[n])
# Judge status: Wrong Answer
n = input()
t = len(n)
count= 0
for i in range(t):
    for j in range(t+1):
        if(i<j):
            if(int(n[i:j]) % 2019 == 0):
                print(n[i:j])
                count+= 1
print(count)
# Judge status: Accepted
n,m = map(int,input().split())
ab = [list(map(int,input().split())) for i in range(n)]
cd = [list(map(int,input().split())) for i in range(m)]
min = 5e+8
c = 0

for i in range(n):
    for j in range(m):
        d = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if d<min:
            min=d
            c = j+1
    min = 5e+8
    print(c)
# Judge status: Accepted
K, S = map(int, input().split())

l = max(S-K*2, 0)
h = min(K, S)

res = 0
for i in range(l, h+1):
    x = S-i
    ll = max(x-K, 0)
    hh = min(h, x)
    res += hh-ll+1

print(res)
# Judge status: Accepted
c = input()
vowel = ["a", "i", "u", "e","o"]

if c in vowel:
    print("vowel")
else:
    print("consonant")
# Judge status: Accepted
from collections import defaultdict
from collections import deque
import itertools
import math

def readInt():
  return int(input())
def readInts():
  return list(map(int, input().split()))
def readChar():
  return input()
def readChars():
  return input().split()

n = readInt()
s = input()
t = input()

if n>=len(s)+len(t):
  print(n)
  exit()

de = 0
for i in range(min(len(s),len(t))):
  if s[i*-1-1:]==t[:i+1]:
    de = i+1

print(len(s)+len(t)-de)
# Judge status: Accepted
N = int(input())

MIN = 100000000000000
for i in range(1,N):
  A = sum(map(int,list(str(i))))
  B = sum(map(int,list(str(N-i))))
  MIN = min(A+B,MIN)
  
print(MIN)
# Judge status: Accepted
A,B,C = map(int,input().split())
print('Yes' if sum([A,B])>=C else 'No')
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))

X=[A[i] for i in range(0,N,2)]
Y=[A[i] for i in range(1,N,2)]

if N%2:
    A=X[::-1]
    B=Y
else:
    A=Y[::-1]
    B=X

print(" ".join(map(str,A+B)))
# Judge status: Accepted
n=int(input())-1
radix=26
ord_a=97

ans=""
while n>=0:
  n,m=divmod(n,radix)
  ans=chr(m+ord_a)+ans
  n-=1
print(ans)
# Judge status: Wrong Answer
nums = list(map(int, input().split()))
nums.sort()
count = nums[2] - nums[1]
nums[0] += nums[2] - nums[1]
if (nums[2]-nums[0])%2 == 0:
  count += (nums[2]-nums[0])//2
else:
  count += (nums[2]-nums[0])//2 + 2
# Judge status: Accepted
n = int(input())
a = [int(input()) for _ in range(n)]
a.append(0)
r = 0
for i in range(n):
    r += a[i]//2
    if a[i]%2==1 and a[i+1]>0:
        r += 1
        a[i+1] -= 1
print(r)
# Judge status: Accepted
a =list( map(int,input().split()))


a.sort()
if (a[0]*a[1]*a[2])%2 :
    print(a[0]*a[1])


else:
    print(0)
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))
town=[0]*n
info=[1]
now=1
while town[now-1]==0:
    town[now-1]+=1
    now=a[now-1]
    info.append(now)
loop_list=list(info[info.index(now):-1])
loop_len=len(loop_list)
before_loop_list=list(info[:info.index(now)])
if k<len(before_loop_list):
    print(before_loop_list[k])
else:
    print(loop_list[((k-len(before_loop_list))%loop_len)])
# Judge status: Wrong Answer
import sys
import heapq

def main():
    input = sys.stdin.readline
    n, m = map(int, input().split())
    a_list = list(map(int, input().split()))
    a_list = list(map(lambda x: x*(-1), a_list))
    heapq.heapify(a_list)

    while m > 0:
        max_a = heapq.heappop(a_list)
        heapq.heappush(a_list, (-1)*(-max_a//2))
        m -= 1
    
    print(-sum(a_list))
# Judge status: Wrong Answer
# AGC 002: A – Range Product
a, b = [int(s) for s in input().split()]

if a > 0:
    print('Positive')
elif b < 0:
    if (b - a + 1) % 2 == 0:
        print('Positive')
    else:
        print('Negative')
elif a <= 0 <= b:
    print('zero')
# Judge status: Accepted
import itertools

N = int(input())
L = [i for i in range(1, N+1)]
P = list(map(int, input().split()))
Q = list(map(int, input().split()))

if P == Q:
  print(0)
  exit()

cnt = a = b = 0

for v in list(itertools.permutations(L)):
  cnt += 1
  if list(v) == P:
    a = cnt
  elif list(v) == Q:
    b = cnt

print(abs(a-b))
# Judge status: Accepted
N = int(input())
s = input()
t = input()
ans = 2*N
for i in range(N):
    if s[i:N] != t[0:N-i]:
        continue
    ans = N+i
    break
print(ans)
# Judge status: Accepted
x, a, b = map(int, input().split())

if abs(x - a) < abs(x - b):
    print('A')
else:
    print('B')
# Judge status: Accepted
x=int(input())
if x <= 6:
    print(1)
    exit()
cnt = (x//11)*2
x %= 11
if x <= 0:
    print(cnt)
elif x <= 6:
    print(cnt+1)
else:
    print(cnt+2)
# Judge status: Accepted
N,M,K=map(int,input().split())
for i in range(M+1):
  for j in range(N+1):
    if i*(N-j)+j*(M-i)==K:
      print("Yes")
      exit()
print("No")