peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
S = input()
a = len(S)
if S[a-1] == 's':
    print(S[:a-1]+'es')
else:
    print(S+'s')
# Judge status: Accepted
import sys; input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
from collections import defaultdict
con = 10 ** 9 + 7; INF = float("inf")

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

def calc(N, p):
	n = int(N // p)
	cnt = int((n * (n + 1) * p // 2))
	return cnt


#処理内容
def main():
	N = int(input())
	ans = 0
	for i in range(1, N + 1):
		ans += calc(N, i)

	print(ans)



if __name__ == '__main__':
	main()
# Judge status: Accepted
from collections import Counter
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
c = Counter(A)

for i in range(1, N + 1):
    if Q - c[i] >= K:
        print("No")
    else:
        print("Yes")
# Judge status: Accepted
S,W=map(int,input().split())

if W>=S:
  print('unsafe')
else:
  print('safe')
# Judge status: Wrong Answer
S=input()

if(S[2]==S[3]):
  if(S[4]==S[5]):
    if(S[0]!=S[1]):
      print("Yes")
else:
  print("No")
# Judge status: Accepted
s = input()
print('x'*len(s))
# Judge status: Accepted
n = int(input())
d = [list(map(int, input().split()))for _ in range(n)]

cnt = 0
for i, (p, q) in enumerate(d):
    if p == q:
        cnt += 1
    else:
        cnt = 0
    if cnt == 3:
        print("Yes")
        break
else:
    print("No")
# Judge status: Wrong Answer
S = input()
count1 = [S[i] for i in range(len(S)) if i % 2 == 0]
count2 = [S[i] for i in range(len(S)) if i % 2 != 0]
point = 1 if len(S) % 2 == 0 else 0
print(min(count1.count('0')+count1.count('1')-point, count2.count('0')+count2.count('1')-point))
# Judge status: Accepted
import sys
input=sys.stdin.buffer.readline
A,B,C = map(int,input().split())

def F(A,B,C):
    if any(x&1 for x in [A,B,C]):
        return 0
    if A == B == C:
        return -1
    return 1 + F((A+B)//2,(B+C)//2,(C+A)//2)

answer = F(A,B,C)
print(answer)
# Judge status: Accepted
def main():
    n, m = map(int, input().split())
    if n == m:
        print("Yes")
    else:
        print("No")


main()
# Judge status: Wrong Answer
a,b= map(int,input().split())
if (b-a)%2==0:
  print((a+b)/2)
else:
  print("IMPOSSIBLE")
# Judge status: Accepted
n = int(input())
x = list(map(int,input().split()))
y = sorted(x)
lidx = n//2
sidx = lidx-1
for v in x:
    if v <= y[sidx]:
        print (y[lidx])
    else:
        print (y[sidx])
# Judge status: Accepted
def main(s):
    #s=10**17-0
    a=10**9
    if s<=10**9:
        x1,y1,x2,y2,x3,y3=0,0,s,0,0,1
    elif s%a==0:
        x1,y1,x2,y2,x3,y3=0,0,a,0,a,s//a
    else:
        x1,y1=0,0
        x2,y2=s//a+1,a-s%a
        x3,y3=1,a
    print(x1,y1,x2,y2,x3,y3)
if __name__=='__main__':
    s=int(input())
    main(s)
# Judge status: Wrong Answer
# -*- coding: utf-8 -*-
import sys

# スペース区切りの整数の入力
N, *d = map(int, open(0).read().split())
A = 1

for O in d:
    A = A*O
    print(O)
    if A > 10 ** 18:
     A = -1
     break
    
print(A)
# Judge status: Wrong Answer
N = int(input())
A = input().split()
count = 0
count_min = 0
for i in range(N):
    count = 0
    Ai = int(A[i])
    while Ai % 2 == 0:
        count += 1
        Ai = Ai / 2
    if count_min == 0:
        count_min = count
    elif count_min > count:
        count_min = count

print(count_min)
# Judge status: Accepted
import sys
H = int(input())

if H == 1:
    print(1)
    sys.exit(0)

ans = 0
count = 0
while H > 0:
    H = H // 2
    ans += 2**count
    count += 1

print(ans)
# Judge status: Accepted
H1, M1, H2, M2, K = map(int, input().split())
print((H2 - H1) * 60 + (M2 -M1) - K)
# Judge status: Wrong Answer
N = input()
A = list(map(int, input().split()))
A.sort()
first = A[0]

cnt = 0

while cnt < len(A):
  div = A[cnt]
  for l in range(cnt):
    if div%A[l] == 0:
      continue
  delete_index = []
  for k in range(cnt+1, len(A)):
    amari = A[k] % div
    if amari == 0:
      delete_index.append(k)
  for j in sorted(delete_index, reverse=True):
    A.pop(j)
  cnt += 1

if len(A)==1 and A[0]==first:
  print(0)
else:
  print(len(A))
# Judge status: Accepted
s=input()
s0=s[0]
s1=s[1]
if s0==s1:
    if s[2]==s[3] and s[2]!=s0:
        print("Yes")
    else:
        print("No")
else:
    if (s[2]==s0 and s[3]==s1) or (s[2]==s1 and s[3]==s0):
        print("Yes")
    else:
        print("No")
# Judge status: Accepted
def main():
    import sys
    input = sys.stdin.readline
    sys.setrecursionlimit(10**6)
    x = int(input())
    print(x ^ 1)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a,b = [int(x) for x in input().split()]
import fractions
g = fractions.gcd(a,b)
ans = 1
flag = 0
mama = int(g**(1/2))
for i in range(2,mama+1):
    while True:
        if a%i != 0 or b%i != 0:
            break
        else:
            a = a/i
            b = b/i
            flag = 1
    if flag == 1:
        ans += 1
    flag = 0
if g == a and ans == 1:
    ans += 1
print(ans)
# Judge status: Accepted
N, A, B = list(map(int, input().split()))

shou = N // (A + B)
amari = N % (A + B)
print(shou * A + min(A, amari))
# Judge status: Accepted
A,B = map(int, input().split())
if A*B%2 == 0:
  print('Even')
else:
  print('Odd')
# Judge status: Accepted
S=input()
k=S.count('a')
l=S.count('b')
m=S.count('c')

if abs(k-l)<=1 and abs(l-m)<=1 and abs(m-k)<=1:
    print('YES')
else:
    print('NO')
# Judge status: Wrong Answer
s = []
t = []
N = int(input())
for _ in range(N):
  s.append(str(input()))
M = int(input())
for _ in range(M):
  t.append(str(input()))

from collections import Counter
sc = Counter(s)
tc = Counter(t)
s_keys, s_values = zip(*sc.most_common())
t_keys, t_values = zip(*tc.most_common())
ans = 0
for i in range(len(s_values)):
  for j in range(len(t_values)):
    minus = 0
    if s_keys[i] == t_keys[j]:
      minus = t_values[j]
      ans = max(ans, s_values[i] - minus)
print(ans)
# Judge status: Accepted
# -*- coding:utf-8 -*-

def solve():
    S = input()
    ans = ""
    for moji in S:
        ans += "x"

    print(ans)

if __name__ == "__main__":
    solve()
# Judge status: Wrong Answer
import math
def main():
    judge_l = {'AC':0, 'WA':0, 'TLE':0, 'RE':0}
    l = int(input().rstrip())
    for i in range(l):
      judge = input().rstrip()
      judge_l[judge] += 1
    for key in judge_l.keys():
        print('{} × {}'.format(key, judge_l[key]))
    
if __name__ == "__main__":
    main()
# Judge status: Accepted
mod=10**9+7
N,K=map(int,input().split())
ans=0
for i in range(K,N+2):
    MIN=(i*(i-1))//2
    MAX=((N+1)*N)//2-((N-i+1)*(N-i))//2
    ans+=MAX-MIN+1
    ans%=mod
    #print(i,MIN,MAX)
print(ans)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

A.sort(reverse=True)
Alice = 0
Bob = 0

for i in range(N):
    if i%2 == 0:
        Alice += A[i]
    else :
        Bob += A[i]
print(Alice - Bob)
# Judge status: Accepted
from fractions import Fraction
N , K = list(map(int,input().split()))
denom_list = []
Z=0


def detame_keisan( N , K , i ):
    kijun = K
    score = i
    count = 0
    
    while score < kijun:
        count += 1
        score = ( score *  2 )
    return N * (2 ** count)

for i in range( 1,N+1 ):
    X = detame_keisan( N , K , i)
    denom_list.append( X )

for item in denom_list:
    #Z += 1/item
    Z += Fraction(1, item)
#print( Z)
print( float( Z ))
# Judge status: Wrong Answer
N = int(input())

arr=[1]*N


if(N==1):
    print("a")
    exit()

def num2alpha(num):
    return chr(num+96)

def keta(num):
    if(arr[num-1]<arr[num]):
        keta(num-1)
    else:
        for k in range(num+1,N):
            arr[k] = 1
        arr[num] += 1
        


i = N-1
while arr[0]==1:
    ans = map(num2alpha,arr)
    print((''.join(ans)))
    keta(N-1)
# Judge status: Wrong Answer
n = sorted(input())
print("Yes" if n == "abc" else "No")
# Judge status: Accepted
n=int(input())
l=list(map(int,input().split()))
d=list(map(int,input().split()))
k=list(map(int,input().split()))
s=sum(d)
for i in range(n-1):
    if(l[i]+1==l[i+1]):
        s+=k[l[i]-1]
print(s)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())

a = [0]* n
b = [0]* n
for i in range(n):
    a[i], b[i] = map(int, input().split())

ans= 0
for i in reversed(range(n)):
    a[i]+=ans
    tmp = -(-a[i] // b[i])
    ans += tmp*b[i]-a[i]

print(ans)
# Judge status: Accepted
A,B,C,K = map(int,input().split())

if A >= K:
    print(K)
elif A+B >= K:
    print(A)
else:
    print(A-(K-A-B))
# Judge status: Accepted
def dfs(i, f, sum):
  if i == 3:
    if sum == 7:
      print(f + '=7')
      exit()
  else:
    dfs(i + 1, f + '-' + s[i + 1], sum - int(s[i + 1]))
    dfs(i + 1, f + '+' + s[i + 1], sum + int(s[i + 1]))
    
s = input()
dfs(0, s[0], int(s[0]))
# Judge status: Accepted
a,b=map(int,input().split())
if a>8 or b>8:
  print(":(")
else:
  print("Yay!")
# Judge status: Accepted
x, y, z = map(int, input().split())
print((x-z)//(y+z))
# Judge status: Accepted
n=int(input())
rob=[list(map(int,input().split())) for i in range(n)]
rob=[[sum(rob[i]), rob[i][0]-rob[i][1]] for i in range(n)]
rob.sort(key=lambda i:i[0])
robp=[rob[i][0] for i in range(n)]
robm=[rob[i][1] for i in range(n)]
#print(robp)
#print(robm)

ans=0
x=-10**9
for i in range(n):
  if x<=robm[i]:
    ans+=1
    x=robp[i]
print(ans)
# Judge status: Accepted
# input
N = int(input())
T, A = map(int, input().split())
H = list(map(int, input().split()))

check = []
append = check.append
for i, h in enumerate(H):
    append(
        {
            "index": i + 1,
            "temp": T - h * 0.006
        }
    )
check.sort(key=lambda x: abs(A - x["temp"]))

print(check[0]["index"])
# Judge status: Accepted
from collections import deque


x, y, a, b, c = map(int, input().split())
p = list(map(int, input().split()))
p.sort(reverse=True)
q = list(map(int, input().split()))
q.sort(reverse=True)
r = list(map(int, input().split()))
ans = []
ans.extend(p[:x])
ans.extend(q[:y])
ans.extend(r)
ans.sort(reverse=True)
print(sum(ans[:x+y]))
# Judge status: Wrong Answer
n, k, s = map(int, input().split())
if k == n:
    print(" ".join([str(s) for _ in range(n)]))
    exit()
x = 0
if k == 0:
    arr = [s - 1]
else:
    arr = [1]
while True:
    if x == k:
        break
    arr.append(s - arr[-1])
    x += 1
while len(arr) < n:
    arr.append(8 ** 9 + 9999)  # テキトー

print(" ".join(list(map(str, arr))))
# Judge status: Wrong Answer
n, m = tuple(map(int, input().split()))
paths = [tuple(map(int, input().split())) for _i in range(m)]

shirube = [0] * n

for f, t in paths:
    temp_path = shirube[f - 1] + 1

    if shirube[t - 1] == 0 or temp_path < shirube[t - 1]:
        shirube[t - 1] = temp_path

if all([e != 0 for e in shirube[1:]]):
    print("Yes")
else:
    print("No")

for e in shirube[1:]:
    print(e)
# Judge status: Accepted
# coding: utf-8

# https://atcoder.jp/contests/abc098/tasks/abc098_b


def main():
    N = int(input())
    S = input()

    ans = 0
    for i in range(1, N):
        X = S[:i]
        Y = S[i:]
        tmp = 0
        for code in range(97, 97+26):
            c = chr(code)
            if c in X and c in Y:
                tmp += 1
        
        if tmp > ans:
            ans = tmp
        
    return ans


print(main())
# Judge status: Accepted
a, b = map(int, input().split())
 
if 0<a<10 and 0<b<10:
  print(a*b)
else:
  print(-1)
# Judge status: Accepted
K=int(input())
S=list(input())
T=int(len(S))
if T>K:
    X=S[0:K]
    Y=str("".join(X))
    Z=str("...")
    print(Y+Z)
else:
    print("".join(S))
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1, n + 1):
    for j in range(i, n + 1, i):
        ans += j
print(ans)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))

t=sum(a)
m=10**9
flag=0
for i in range(len(a)-1):
    t-=2*a[i]
    if i==0:
        m=abs(t)
    else:
        m=min(abs(t),m)
print(m)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
num = sum(a)
x = 0
ans = 10**9
for i in range(n):
    x += a[i]
    num -= a[i]
    ans = min(ans,abs(num-x))
print(ans)
# Judge status: Accepted
import numpy as np
k, n = map(int, input().split())
A = list(map(int, input().split()))
A.append(A[0] + k)
a = np.array(A)
 
max_dist = np.max(np.diff(A))
print(k - max_dist)
# Judge status: Accepted
def gcd(a,b):
 while b!=0:
   a,b=b,a%b
 return a


n = int(input())
l = list(map(int,input().split()))
l.sort()

tmp = gcd(l[0],l[1])
for i in range(2,len(l)):
    tmp = gcd(tmp,l[i])

print(tmp)
# Judge status: Accepted
a, b = map(int, input().split())

ans = 0
for _ in range(2):
    choice = max(a, b)
    ans += choice
    if choice == a:
        a -= 1
    else:
        b -= 1

print(ans)
# Judge status: Wrong Answer
s = input()
t = input()
d = dict()
for i in range(len(s)):
  if not s[i] in d:
    d[s[i]] = t[i]
  else:
    if d[s[i]] != t[i]:
      print('No')
      exit()
print('Yes')
# Judge status: Accepted
s = input()
counter = 0
for i in range(int(len(s)/2)):
    if s[i] != s[len(s) - 1 - i]:
        counter += 1

print(counter)
# Judge status: Accepted
N = int(input())
p = list(map(int, input().split()))

i = 0
ans = 0
while i < N:
  if p[i] == i+1:
    if (i+1<N) and (p[i+1]==i+2):
      ans += 1
      i += 2
    else:
      ans += 1
      i += 1
  else:
    i += 1
print(ans)
# Judge status: Wrong Answer
n=int(input())
boulist=list(map(int,input().split()))
boulist.sort(reverse=True)

count=0
for i in range(n):
  for j in range(i,n):
    for k in range(j,n):
      if boulist[j] != boulist[k] and boulist[i] != boulist[j] and boulist[i]+boulist[j]>boulist[k]:
        count+=1

print(count)
# Judge status: Wrong Answer
N = int(input())
a = [int(i) for i in input().split()]
A = 1
if 0 in a:
    A = 0
else: 
    for i in range(N-1):
        A = A * a[i]
        if A > 1000000000000000000:
            A = -1
        break
print(A)
# Judge status: Accepted
s = str(input())
s_0,s_1 = 0,0
for i in range(len(s)):
    if(s[i] == "0"):
        s_0 += 1
    else:
        s_1 += 1
c = len(s)-(max(s_0,s_1)-min(s_0,s_1))
print(c)
# Judge status: Accepted
#!/usr/bin/python3

from functools import reduce
from operator import add
import sys


def main():
    N, K = map(int, input().split(' '))
    sys.setrecursionlimit(N + 50)

    C = 1
    for i in range(K, N + 1):
        C += (N * (N + 1) // 2 - (N - i) * (N - i + 1) // 2) \
            - ((i * (i - 1)) // 2) \
            + 1
    print(C % 1000000007)


if __name__ == '__main__':
    main()
# Judge status: Accepted
S,T = input().split()
A,B = map(int,input().split())
U = input()
if S==U:
    A -= 1
else:
    B -= 1
print(A,B)
# Judge status: Accepted
import sys
from collections import deque
sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

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()))

P.sort(reverse=True)
Q.sort(reverse=True)
R.sort(reverse=True)

P = P[:X]
Q = Q[:Y]

ALL = P + Q + R
ALL.sort(reverse=True)

ans = sum(ALL[: X + Y])
print(ans)
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if a<=c:
  if a+b>=c:
    print('Yes')
  else:
    print('No')
else:
  print('No')
# Judge status: Accepted
from collections import defaultdict

def main():
    d = defaultdict(int)
    n, m = [int(i) for i in input().split()]
    py = {}

    for i in range(m):
        p, y = [int(i) for i in input().split()]
        py[i] = (p, y)

    res = [''] * m
    for v in sorted(py.items(), key=lambda x:x[1]):
        d[v[1][0]] += 1
        res[v[0]] = str(v[1][0]).zfill(6) + str(d[v[1][0]]).zfill(6)
    for r in res:
        print(r)

if __name__ == '__main__':
    main()
# Judge status: Accepted
n = int(input())
a = [int(input()) for _ in range(n)]

s = sum(a)
m = s
if s % 10:
    print(s)
    exit()
for x in a:
    if x % 10:
        m = min(m, x)
else:
    print(s - m)
# Judge status: Wrong Answer
n = int(input())
cnt = 0
cntN = n

for i in range(2,n+1):
  p = i
  while n%p ==0:
    cnt += 1
    cntN /= p
    p *= p
  if cntN+1 <= i:
    break
print(cnt)
# Judge status: Accepted
n = input()
a = [list(map(int,raw_input().split())) for i in range(2)]
print max([sum(a[0][:i+1])+sum(a[1][i:]) for i in range(n)])
# Judge status: Accepted
n = input()
hon = ["2", "4", "5", "7", "9"]
pon = ["0", "1", "6", "8"]
bon = ["3"]
if n[-1] in  hon:
    print("hon")
elif n[-1] in pon:
    print("pon")
else:
    print("bon")
# Judge status: Accepted
N,T=map(int,input().split())
cc=1001
for i in range(N):
  c,t=map(int,input().split())
  if cc>c and T>=t:
    cc=c
if cc==1001:
  print("TLE")
else:
  print(cc)
# Judge status: Wrong Answer
a = input().split()
q = int(a[0]) * 4
h = int(a[1]) * 2
s = int(a[2])
d = int(a[3]) / 2
b = int(input())

if min([q,h,s,d]) != d:
  print(int(b * min([q,h,s])))
else:
  if b % 2 == 0:
    print(int(b * d))
  elif b != 1:
    print(int((b-1) * d + min([q,h,s])))
  else:
    print(int(min([q,h,s])))
# Judge status: Accepted
n=input()
a = list(map(int,input().split()))
suma = sum(a)
r = 0

for i in range(0, len(a) - 1):
  suma -= a[i]
  r += a[i] * suma
print(r % (10 ** 9 + 7))
# Judge status: Accepted
icase=42

if icase==42:
    a=list(map(int,input().split()))
    a.sort()
    if a[0]==5 and a[1]==5 and a[2]==7:
        print("YES")
    else:
        print("NO")
# Judge status: Accepted
n = int(input())
stp = int(n/1.08)
while True:
  cost = int(stp*1.08)
  if cost == n:
    ans = stp
    break
  elif cost > n:
    ans = ':('
    break
  else:
    stp += 1
print(ans)
# Judge status: Accepted
k = int(input())
s=input()

if len(s) <= k:
    print(s)
else:
    print(f'{s[:k]}...')
# Judge status: Accepted
n=int(input())
t=int(n**0.5)+2
ans=10**18

for i in range(1,t):
    if n%i==0:
        if ans>(i-1)+((n//i)-1):
            ans=(i-1)+((n//i)-1)

print(ans)
# Judge status: Wrong Answer
n=int(input())
summ=0
for i in range(1,n):
    if i%3!=0 and i%5!=0:
        summ+=i
print(summ)
# Judge status: Accepted
n,a,b = map(int, input().split())
if n == 1 and abs(a-b) + 1 != n: print(0)
elif a > b: print(0)
else:
  print((b*(n-1)+a) - (a*(n-1)+b) + 1)
# Judge status: Accepted
def resolve():
    x = int(input())
    print(1 if x == 0 else 0)


if __name__ == '__main__':
    resolve()
# Judge status: Wrong Answer
N = int(input())
print(input().count('#.'))
# Judge status: Accepted
x = [int(input()) for _ in range(6)]
if x[4] - x[0] <= x[5]:
    print('Yay!')
else:
    print(':(')
# Judge status: Wrong Answer
from math import floor
N = int(input())

l = [None] * 5

for i in range(5):
    l[i] = int(input())

split = 0 if floor(N/min(l)) <= 1 else floor(N/min(l))
print(5+split)
# Judge status: Accepted
n, m = map(int, input().split())
student = []
for i in range(n):
  student.append(tuple(map(int, input().split())))
point = []
for i in range(m):
  point.append(tuple(map(int, input().split())))
for i in range(n):
  dis = 10 ** 20
  idx = 0
  for j in range(m):
    temp = abs(student[i][0] - point[j][0]) + abs(student[i][1] - point[j][1])
    if temp < dis:
      dis = temp
      idx = j + 1
  print(idx)
# Judge status: Accepted
N = int(input())
A = [list(map(int, input().split())) for x in range(2)]

ans = 0
for i in range(N):
    res = sum(A[0][:i+1]) + sum(A[1][i:])
    if res > ans:
        ans = res
print(ans)
# Judge status: Accepted
import numpy as np

# 入力
N,M = map(int,input().split())

Check_AC = np.zeros(N)
WA_Counter = np.zeros(N)

for i in range(M):
    pi,Si = input().split()
    pi = int(pi)
    # まだ正解していない問題
    if Check_AC[pi-1] == 0:
        if Si == "AC":
            Check_AC[pi-1] = 1
        else:
            WA_Counter[pi-1] += 1
    
print(str(int(sum(Check_AC))) + " " + str(int(np.dot(Check_AC,WA_Counter))))
# Judge status: Accepted
N = int(input())
A=0
for i in range(1,N+1):
    if not ((i%3==0 and i%5==0) or i%3==0 or i%5==0):
      A=A+i
print(A)
# Judge status: Accepted
n=int(input())
lst=map(int, input().split())

lst=sorted(lst, reverse=True)
new=[lst[i]*(1/2)**(i+1) for i in range(n-1)]
print(sum(new)+lst[-1]*(1/2)**(n-1))
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split())) # list()
xsorted = sorted(x)
mannaka=n//2
median_a = xsorted[mannaka-1]#3
median_b = xsorted[mannaka]#4
'''
print(x)
print(xsorted)
print(mannaka)
print(median_a)
print(median_b)
'''
for i in range(n):
    if(x[i]<=median_a):
        print(median_b)
    else:
        print(median_a)
# Judge status: Accepted
MOD=10**9+7
x , y = map(int, input().split())
a=(2*x-y)//3
b=(2*y-x)//3
if 2*a+b!=x:
    print(0)
    exit()

factorial = [1]
inverse = [1]

n=a+b
r=a

for i in range(1, n+2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))

def combi(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % MOD

ans = combi(n,r)
print(ans)
# Judge status: Accepted
def main():
    s = input()
    display = list()

    for i in range(len(s)):
        if s[i] == "B" :
            if len(display) > 0:
                display.pop()
        else:
            display.append(s[i])
    print("".join(map(str,display)))
main()
# Judge status: Wrong Answer
s = input()
n = len(s)
if(s==s[::-1] and s[:(n-1)//2]==s[:(n-1)//2][::-1]): print('Yes')
else: print('No')
# Judge status: Wrong Answer
n = int(input())
as_ = list(map(int, input().strip().split()))

total_length = sum(as_)
current = 0
for a in as_:
    if current + a == total_length // 2:
        print(0)
        exit(0)
    if current + a > total_length / 2:
        candidate1 = current
        candidate2 = current + a
        break

    current += a

ans = min(total_length - candidate1, total_length - candidate2)
print(ans)
# Judge status: Accepted
import math as m
N,M=map(int,input().split())
w=1000000007
if abs(N-M)<2:
    if N==M:
        print((m.factorial(N)**2*2)%w)
    else:
        print((m.factorial(N)*m.factorial(M))%w)
else:
    print(0)
# Judge status: Accepted
#061_B
n,m=map(int,input().split())
ans=[0 for _ in range(n)]
for _ in range(m):
    a,b=map(int,input().split())
    ans[a-1]+=1
    ans[b-1]+=1
print(*ans,sep='\n')
# Judge status: Wrong Answer
a, b, c = map(int, input().split())

print(c-(a-b))
# Judge status: Wrong Answer
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
s=0
s += sum(b)
for i in range(n-1):
    if a[i]==a[i+1]+1:
        s += c[i-1]
print(s)
# Judge status: Wrong Answer
a, b = map(str, input().split())
ab = int(a+b)
flag = False
for i in range(110):
  if i**2 == ab:
    flag = True
if flag:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n, a, b = map(int, input().split())
Total = n
d = a + b

c = n // d
n = n % d

if n <= a:
    print(Total - c*b)
else:
    print(a * c)
# Judge status: Accepted
# A - Product
a,b=list(map(int,input().split()))

if (a*b)%2==0:
    print("Even")
else:
    print("Odd")
# Judge status: Accepted
N = int(input())

iSP = []
for i in range(N):
    S, P = input().split()
    iSP.append([i + 1, S, int(P)])

iSP.sort(key = lambda x: x[2], reverse = True)    
iSP.sort(key = lambda x: x[1])

for x in iSP:
    print(x[0])
# Judge status: Accepted
from math import *
N=int(input())
A=list(map(int,input().split()))
c=A[0]
for i in range(N):
    c=gcd(A[i],c)
print(c)
# Judge status: Accepted
n = int(input())
a, b = map(int, input().split())

ans = 'NG'
for i in range(a, b+1):
    if i % n == 0:
        ans = 'OK'
        break

print(ans)
# Judge status: Accepted
X=input()
if X in '753':
  print('YES')
else:
  print('NO')
# Judge status: Wrong Answer
# -*- coding:utf-8 -*-
import sys
input = sys.stdin.readline
w = input()
w_set = set(w)
for i in w_set:
  if w.count(i)%2==1:
    print("No")
    sys.exit()
  else:
    continue
print("Yes")
# Judge status: Accepted
a, b, c, d = map(int, input().split())
if abs(c-a)<=d:
    print('Yes')
elif abs(b-a)<=d and abs(c-b)<=d:
    print('Yes')
else :
    print('No')
# Judge status: Accepted
n = int(input())
a = [list(map(int, input().split())) for i in range(2)]
print(max(sum(a[0][: i + 1] + a[1][i:]) for i in range(n)))
# Judge status: Accepted
n = int(input())

ans = 0
for a in range(1, n):
    ans += (n - 1) // a
print(ans)