peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import numpy as np
from itertools import combinations
n,K = map(int,input().split())
num_ls = [i for i in range(n+1)]
csum_num_ls = list(np.cumsum(num_ls))
mod = 1000000007

ans = 0
for k in range(K,n+1):
    smallest = csum_num_ls[k-1]
    biggest = csum_num_ls[-1] - csum_num_ls[-k-1]
    ans_k = biggest - smallest + 1
    ans += ans_k
    ans %= mod
ans += 1
print(ans)
# Judge status: Wrong Answer
N = int(input())
L = list(map(int, input().split()))
L.sort()
from itertools import combinations

ans = 0
for a, b, c in combinations(L, r=3):
    ans += a + b < c
print(ans)
# Judge status: Accepted
A,B,C=list(map(int,input().split()))
if A == B == C:
    if A%2==1 or B%2==1 or C%2==1:
        print(0)
        exit()
    else:
        print(-1)
        exit()
for i in range(10**9):
    if A%2==1 or B%2==1 or C%2==1:
        print(i)
        exit()
    A,B,C=(B+C)//2,(A+C)//2,(A+B)//2
# Judge status: Accepted
n, x = map(int, input().split())
a = list(map(int, input().split()))
c = 0
a_sorted = sorted(a)

for i in range(n):
    x -= a_sorted[i]
    if x > 0 and i <= n-2:
        c += 1
    elif x == 0:
        c += 1
    else:
        break

print(c)
# Judge status: Wrong Answer
from math import gcd
k = int(input())
ans = 0
for i in range(1, k+1):
    for j in range(1, k+1):
        for l in range(1, k+1):
            ans += gcd(gcd(i, j), l)
print(ans)
# Judge status: Accepted
n, a, b = map(int, input().split())
ans = 0

def calculate_digit_sum(n):
    digit_sum = 0
    for digit in str(n):
        digit_sum += int(digit)
    return digit_sum

for num in range(1, n + 1):
    
    if a <= calculate_digit_sum(num) and calculate_digit_sum(num) <= b:
        ans += num
print(ans)
# Judge status: Accepted
A,V = map(int, input().split())
B,W = map(int, input().split())
T = int(input())

if A <= B:
    B += W*T
    A += V*T
    if A >= B:
        ans = "YES"
    else:
        ans = "NO"
else:
    B -= W*T
    A -= V*T
    if A <= B:
        ans = "YES"
    else:
        ans = "NO"
print(ans)
# Judge status: Wrong Answer
N, M = map(int,input().split())
X = list(map(int,input().split()))
if len(X)<2:
    print(0)
else:    
    X.sort()

    diffs = []
    for i in range(M-1):
        diffs.append(abs(X[i+1]-X[i]))
    diffs.sort(reverse=True)
    print(X[M-1]-X[0]-sum(diffs[:N]))
# Judge status: Accepted
AB, BC, CA = map(int,input().split())

print(AB*BC//2)
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(4100000)
import math




N = int(input())


import fractions
a = list(map(int, input().split()))
koubai = a[0]
for i in range(1, N):
    koubai = koubai * a[i] // fractions.gcd(koubai, a[i])
    if(koubai >=1000000000000007):
        break

ans = int(0)
for i in range(N):
    ans += koubai // a[i]
    
ans %= 1000000007

print(ans)
# Judge status: Accepted
N=int(input())
S=input()
ans=0
for i in range(1,N):
  temp=0
  check1=set(S[:i])
  check2=set(S[i:])
  for s in check1:
    if s in check2:
      temp+=1
  ans=max(ans,temp)
print(ans)
# Judge status: Wrong Answer
from itertools import accumulate, permutations, combinations, product, combinations_with_replacement
from math import floor, ceil, sqrt, factorial, log
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict
from heapq import heappop, heappush, heappushpop
from itertools import product
import sys
stdin = sys.stdin
mod = 10**9 + 7


def ns(): return stdin.readline().rstrip()


def ni(): return int(ns())


def na(): return list(map(int, stdin.readline().split()))


a, b, k = na()
takahashi = a - min((k + 1) // 2, a)
aoki = b - min(k // 2, b)
print(takahashi, aoki)
# Judge status: Accepted
x = int(input())

for i in range(-130, 130):
    for j in range(-130, 130):
        if i**5 - j**5 == x:
            print(i, j)
            exit()
# Judge status: Wrong Answer
k = int(input())

if k%2 == 0:
  print(k*k/4)
else:
  print(k**2/4-1/4)
# Judge status: Accepted
N, K = map(int, input().split())
ans_list = [int(N % K), K - int(N % K)]
print(min(ans_list))
# Judge status: Wrong Answer
def main():
    n,k=map(int,input().split())
    d=set(map(int,input().split()))
    ln=[int(i) for i in list(str(n))]
    l=len(ln)
    
    flag=True
    x=min(set(range(10))-d)
    for i in range(l):
        if flag:
            while ln[i] in d:
                ln[i]+=1
                flag=False

        else:
            ln[i]=x
    
    print(''.join([str(i) for i in ln]))
if __name__=='__main__':
    main()
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
print('Yes' if a <= c <= b or a >= b >= c else 'No')
# Judge status: Accepted
N = int(input())
A = [int(x) for x in input().split()]

d = {}
for a in A:
	if a not in d:
		d[a] = 1
	else:
		d[a] += 1

ans = 0
for i in d:
	if i<=d[i]:
		ans += d[i]-i
	else:
		ans += d[i]
print(ans)
# Judge status: Wrong Answer
n = int(input())
v = list(map(int,input().split()))
asa = 0
for i in range(1,n):
     v[n-i-1] = (v[n-i-1] + v[n-i])/2
print(v[0])
# Judge status: Wrong Answer
T = [int(input()) for _ in range(5)]

lst1 = []
lst2 = []
for i in range(5):
    if T[i]%10 == 0:
        lst1.append([0,T[i]])
    else:
        lst2.append([T[i]%10,T[i]])

lst2 = sorted(lst2, reverse=True)
lst = lst1 + lst2
print(lst)

ans = 0
for i in range(5):
    ans += lst[i][1]
    if lst[i][0] == 0:
        pass
    else:
        ans += 10 - lst[i][0]

ans -= 10 - lst[i][0]

print(ans)
# Judge status: Wrong Answer
import math
a, b, n = map(int,input().split())
# N = int(input())
# al = list(map(int,input().split()))

lst = []
if b >= n:
    x = n
else:
    if b != 1:
        x = b-1
    else:
        x = 1

ans =  math.floor(a * x / b) - a * math.floor(x / b)
print(ans)
# Judge status: Wrong Answer
a,b,c=input().split()
print("Yes" if c>=a and c<=b else "No")
# Judge status: Accepted
from math import floor
N = int(input())
ans = 0
for A  in range(1, N+1):
    if N % A == 0:
        ans += N//A-1
    else:
        ans += N//A
print(ans)
# Judge status: Accepted
from collections import deque

N,M=map(int,input().split())
G=[[] for _ in range(N+1)]
for i in range(M):
  a,b=map(int,input().split())
  G[a].append(b)
  G[b].append(a)

ans=[0]*(N+1)
d=deque([1])
while d:
  c=d.popleft()
  for g in G[c]:
    if not ans[g]:
      d.append(g)
      ans[g]=c

print('Yes')
for i in range(2, N+1):
  print(ans[i])
# Judge status: Accepted
# https://atcoder.jp/contests/abc134/tasks/abc134_e

import bisect

N = int(input())
A = []
for _ in range(N):
    a = int(input())
    A.append(a)

A.reverse()
INF = float('inf')
dp = [INF for _ in range(N)]

for a in A:
    target_index = bisect.bisect_right(dp, a)
    # print(a, target_index)
    dp[target_index] = a

# print(dp)
print(bisect.bisect_left(dp, INF))
# Judge status: Wrong Answer
n = int(input())
a = [int(input()) for x in range(n)]
x = max(a)

import copy

for i in range(n):
   if(a[i] < x):
      print(x)
   else:
      b = sorted(list(set(a)), reverse=True)
      if(len(b) == 1):
         print(x)
      else:
         print(b[1])
# Judge status: Wrong Answer
S=list(input().split())
N=len(S)

for i in range(0,N-1,2):
    if S[i]=="L" or S[i+1]=="R":
        print("No")
    else:
        print("Yes")
# Judge status: Accepted
N,K=map(int,input().split())
P=list(map(int,input().split()))
P=sorted(P)
ans=0
for i in range(K):
    ans+=P[i]
print(ans)
# Judge status: Accepted
K, X = map(int, input().split())
if X <= K*500:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
#template
def inputlist(): return [int(j) for j in input().split()]
#template
#issueから始める
N = int(input())
def wa(N) : #kakuketanowa
    S = str(N)
    array = list(map(int,S))
    return sum(array)
ans = 10**9+7
for i in range(1,N):
    l = i
    r = N-i
    suma = wa(l) + wa(r)
    ans = min(ans,suma)
print(ans)
# Judge status: Wrong Answer
w,h,n = map(int, input().split())

x1,x2,y1,y2 = 0,0,0,0
for _ in range(n):
  x,y,a = map(int, input().split())
  if a == 1: x1 = max(x1, x)
  if a == 2: x2 = max(x2, w-x)
  if a == 3: y1 = max(y1, y)
  if a == 4: y2 = max(y2, h-y)

w -= x1+x2
h -= y1+y2
if w*h <= 0: print(0)
else: print(w*h)
# Judge status: Accepted
a = int(input())


print(a+a**2+a**3)
# Judge status: Wrong Answer
n, m = [int(i) for i in input().split()]

if n >= 2 * m:
    print(round(m / 2))
else:
    print(n + round((m - 2 * n) / 4))
# Judge status: Wrong Answer

s = input()
is_mul = sum([int(i) for i in s])%9
if is_mul:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
def main():
	N = int(input())
	S = input()
	brackets = [0, 0]
	for i in range(len(S)):
		if S[i] == ")":
			if brackets[0] > 0:
				brackets[0] -= 1
			else:
				brackets[1] += 1
		elif S[i] == "(":
			brackets[0] += 1
	print(brackets[1] * "(" + S + brackets[0] * ")")

main()
# Judge status: Accepted
import copy
N = int(input())
A = list(map(int, input().split()))

a_types = set(A)

count_dict = [0] * N
for each in A:
    count_dict[each - 1] += 1

all_types = 0
for value in count_dict:
    all_types += value * (value - 1) // 2

# result_dict = {}
# for each in a_types:
#     result_dict[each] = all_types - count_dict[each] + 1

for a in A:
    print(all_types - count_dict[a - 1] + 1)
# Judge status: Wrong Answer
a = int(input())
b = int(input())
h = int(input())
print((a+b)*(h/2))
# Judge status: Accepted
n, r = map(int, input().split())

if (n >= 10):
  print(r)
else:
  print(r+100*(10-n))
# Judge status: Wrong Answer
N = int(input())
L0 = 2
L1 = 1
if N == 1:
    print(L1)
else:
    for i in range(N-1):
        L1, L0 = L1 + L0, L1
print(L1)
# Judge status: Accepted
# ペンキの種類を求めよ

abc = input()

ls_abc = abc.split()
len_abc = len(ls_abc)

for i in range(len_abc):
    ls_abc[i] = int(ls_abc[i])

# print(ls_abc)

counter = {}
# この状態では，カウンターがからッぽ．０にするためには１８．１９行目
for i in range(len_abc):
    x = ls_abc[i]

    if not x in counter:
        counter[x] = 0

    counter[x] = counter[x] + 1

print(len(counter))
# Judge status: Wrong Answer
N = int(input())
A = N//500
B = (N-A)//5
print(A*1000+B*5)
# Judge status: Accepted
N = int(input())
A = list(map(int, input().split()))
A.sort(reverse=False)
ans = 0
for i in range(N):
    if i % 2 == 0:
        ans += A[i]
    else:
        ans -= A[i]

print(abs(ans))
# Judge status: Accepted
a=input()
if a[0]==a[1]==a[2] or a[1]==a[2]==a[3]:print("Yes")
else:print("No")
# Judge status: Accepted
n,m=(int(i) for i in input().split())
l=[None,None,None]
answer='unknown'
for i in range(m):
  a,b=(int(i) for i in input().split())
  if l[n-a]==None:
    l[n-a]=b
  elif l[n-a]!=b:
    answer='-1'
    break
if l[0]==None:
  l[0]=0
for i in range(3):
  if l[i]==None:
    if i!=n-1:
      l[i]=0
    else:
      l[i]=1
r=l[2]*10**2+l[1]*10+l[0]
if len(str(r))!=n:
  answer='-1'
if answer=='-1':
  print('-1')
else:
  print(r)
# Judge status: Accepted
n,m = map(int,input().split())
a = [input().split() for i in range(n)]
b = [input().split() for i in range(m)]

for i in range(n):
    distance = 10000000000
    for j in range(m):
        temp = abs(int(a[i][0]) - int(b[j][0])) + abs(int(a[i][1]) - int(b[j][1]))
        if distance > temp:
            ans = j + 1
        distance = min(temp,distance)
    print(ans)
# Judge status: Wrong Answer
N, M = map(int, input().split())
PS = [list(map(str, input().split())) for _ in range(M)]
ac_cnt, wa_cnt = 0, 0
n_and_ac = {}
for n in range(N):
  n_and_ac[str(n + 1)] = 0
for ps in PS:
  if ps[1] == "AC" and n_and_ac[ps[0]] == 0:  
    n_and_ac[ps[0]] += 1
    ac_cnt += 1
  if ps[1] == "WA" and n_and_ac[ps[0]] == 0:
    wa_cnt += 1
print(str(ac_cnt) + " " + str(wa_cnt))
# Judge status: Wrong Answer
N = int(input())
Dic = {}
for _ in range(N):
  st = input()
  st=''.join(sorted(st))
  if st not in Dic:
    Dic[st]=0
  else:
    Dic[st]+=Dic[st]+1
print(sum(Dic.values()))
# Judge status: Accepted
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():

    N = int(input())
    S = str(input())
    stack_rem = 0

    need_left = 0

    for i in range(N):
        if S[i] == '(':
            stack_rem += 1
        elif stack_rem > 0:
            stack_rem -= 1
        else:
            need_left += 1
    need_right = stack_rem
    print('('*need_left+S+')'*need_right)

resolve()
# Judge status: Accepted
num = 0
n,l = map(int, input().split())
if l <= 0 < l+n-1:
    for i in range(1,n+1):
        num += (l+i-1)
elif l > 0:
    for i in range(2,n+1):
        num += (l+i-1)
else:
    for i in range(1,n):
        num += (l+i-1)
print(num)
# Judge status: Wrong Answer
S=input()
T=input()

def count_letter(A,B):
  score=0
  for i in range(len(A)):
    if A[i]==B[i]:
      score+=1
  return score

count_max=0
for i in range(len(S)-len(T)):
  count_max=max(count_max,count_letter(S[i:i+len(T)],T))
print(len(T)-count_max)
# Judge status: Accepted
A, B, C = map(int, input().split())
b = False
for a in range(1, B):
    if A*a-C >= 0:
        if (A*a-C)%B == 0:
            b = True
print("YNEOS"[not(b)::2])
# Judge status: Accepted
l,r,d= list(map(int, input().strip().split()))
if r%d==0:
    s=r//d
else:
    s=r//d
if l%d==0:
    t=l//d
else:
    t=l//d+1
    
print(s-t+1)
# Judge status: Accepted
N = int(input())
B = [int(i) for i in input().split()]
S = [0]*N
cnt = 0
for i in range(N-1, -1, -1):
  A = S[i::i+1]
  if sum(A)%2 == B[i]:
    continue
  elif sum(A)%2 == 0 and B[i] == 1:
    S[i] += 1
    cnt += 1
  elif sum(A)%2 == 1 and B[i] == 0:
    S[i] += 1
    cnt += 1
print(cnt)
l = []
for i in range(N):
  if S[i] == 1:
    l.append(i+1)
print(" ".join(map(str,l)))
# Judge status: Wrong Answer
s=input()
t=s[::-1]
num=0
for i in range(len(s)):
    if s[i]!=t[i]:
        num+=1
print(num)
# Judge status: Accepted
x = int(input())
dp = [0]*(x + 105 + 1)
dp[100] = 1 
dp[101] = 1
dp[102] = 1
dp[103] = 1
dp[104] = 1
dp[105] = 1

for i in range(100,x-105+25):
    for j in range(100,106):
        dp[i+j] = max(dp[i] , dp[i+j])

print(dp[x])
# Judge status: Accepted
A, B = map(int, input().split())
S = input()

if S[0:A].isdecimal() and S[A+1:A+1+B].isdecimal() and S[A] == '-':
    print('Yes')
else:
    print('No')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

cnt = [0] * ((10 ** 6) + 1)

for elem in a:
    cnt[elem] += 1

unique = []

for i in range((10 ** 6) + 1):
    if cnt[i] == 1:
        unique.append(i)

cnt = [0] * ((10 ** 6) + 1)

a = list(set(a))

for elem in a:
    for m in range(elem * 2, (10 ** 6) + 1, elem):
        cnt[m] = 1

ans = 0

for elem in unique:
    if cnt[elem] == 0:
        ans += 1

print(ans)
# Judge status: Accepted
S = input()

T = ["dream", "dreamer", "erase", "eraser"]

S = S[::-1]
for i in range(4):
    T[i] = T[i][::-1]

can = True
i = 0
while i < len(S):
    can2 = False
    for t in T:
        if S[i:i + len(t)] == t:
            can2 = True
            i += len(t) - 1
    if can2 == False:
        can = False
        break
    i += 1

if can:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
#B
#入力
A,B,M=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
d=[list(map(int,input().split())) for i in range(M)]

#処理
x=min(a)+min(b)

for i in d:
    t=a[i[0]-1]+b[i[1]-1]-i[2]
    if t<x:
        x=t
print(x)
# Judge status: Accepted
N = int(input())
pt, px, py = 0, 0, 0
can = True
for i in range(N):
    t, x, y = map(int, input().split())
    T, X, Y = t - pt, abs(x - px), abs(y - py)
    if T < X + Y or T % 2 != (X + Y) % 2:
        can = False
    pt, px, py = t, x, y
print('Yes' if can else 'No')
# Judge status: Wrong Answer
b=int(input())
a=input()
c=[]
for i in range(b):
    c.append(a[i])
#a = list(map(int,input().split()))
#b = list(map(int,input().split()))
d = b/2-1
e = b/2
if b==1:
    print("No")
elif c[:3]==c[3:]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x = [int(input()) for _ in range(5)]

res = []
diff = []
for i in range(5):
    tmp = 0
    if(x[i] % 10 == 0):
        tmp = (x[i] // 10) * 10
    else:
        tmp = (x[i] // 10 + 1) * 10
    res.append(tmp)
    diff.append(tmp - x[i])

print(sum(res) - max(diff))
# Judge status: Accepted
N = int(input())
ans = 1

for i in range(1, N+1):
    ans = i * ans % (10**9+7)

print(ans)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**7)
def input(): return sys.stdin.readline().rstrip()

def main():
    N, X, T = map(int, input().split())
    c = 0
    t = 0
    while c < N:
        c += X
        t += T

    print(t)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
N,A,B,C,D = map(int, input().split())
S = input()

if "##" in S:
    print("No")
elif D < C and ("..." not in S[B-2:]):
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
ans = sum(a) ** 2
for i in a:
    ans -= i ** 2
print((ans // 2) % (10 ** 9 + 7))
# Judge status: Wrong Answer
x, y = (int(x) for x in input().split())
from numpy import log2
ans = int(log2(y/x)) + 1
print(ans)
# Judge status: Wrong Answer
n=int(input())
answer = 0
if n%2 == 0:
  answer = 1/(n//2)
else:
  answer = 1/(n//2+1)
print(answer)
# Judge status: Accepted
import sys, math
from functools import lru_cache
from itertools import accumulate
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

N, A, B, C, D = mi()
S = input()
f = (not '##' in S[A-1:C]) and (not '##' in S[B-1:D])
if C > D:
    f = f and ('...' in S[B-2:D+1])

print('Yes' if f else 'No')
# Judge status: Accepted
A, B = map(int, input().split())
 
# A*x-(x-1) >= B
# (A-1)*x >= B-1
# x >= ceil((B-1)/(A-1))
print(-(-(B-1)//(A-1)))
# Judge status: Wrong Answer
import heapq

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(); q.sort(); r.sort();
p.reverse(); q.reverse(); r.reverse();
ans = [sum(p[:X]) + sum(q[:Y])]
que = []
for pi in p:
    heapq.heappush(que, pi)
for qi in q:
    heapq.heappush(que, qi)

for i in range(min(C, X + Y + 1)):
    minimum = heapq.heappop(que)
    ans.append(ans[-1] - minimum + r[i])

print(max(ans))
# Judge status: Accepted
s = input()

odd = ["R", "U", "D"]
even = ["L", "U", "D"]

isYes = True

for i in range(len(s)):
    if i % 2 == 0:
        if s[i] not in odd:
            isYes = False
            break
    elif i % 2 != 0:
        if s[i] not in even:
            isYes = False
            break

if isYes:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
x = int(input())
 
for val in range(x, x**1000) :
	if x ==2 :
		print(x)
		break
	elif ((2** val) % val) == 2 :
		print (val)
		break
	else :
		continue
# Judge status: Wrong Answer
import math
n=int(input())
for i in range(n):
    if math.floor(i*1.08)==n:
        print(i)
        break
    elif math.floor(i*1.08)>n:
        print(":(")
        break
# Judge status: Accepted
s = input()
K = int(input())
alpha = "abcdefghijklmnopqrstuvwxyz"
inv_alpha = "azyxwvutsrqponmlkjihgfedcb"
D = {inv_alpha[i]: i for i in range(26)}
n = len(s)
for i in range(n):
  if i == n - 1:
    x = K % 26
    print(alpha[(26-D[s[i]]+x)%26], end = '')
  else:
    if K >= D[s[i]]:
      K -= D[s[i]]
      print('a', end = '')
    else:
      print(s[i], end = '')
print()
# Judge status: Wrong Answer
n = int(input())
s = input()
cnt = [0]*n
for i in range(n):
    cnt[i] = s[0:i].count("w") + s[i+1:n].count("e")
print(min(cnt))
# Judge status: Wrong Answer
X=int(input('X='))
if X>=30:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n=int(input())
c=list(input())
f=0
f2=0
wcnt=0
wcnt2=0
rcnt=0
cnt=0
for i in range(n):
    if f and c[i]=="R":
        cnt+=1
    if c[i]=="R":
        f=1
        rcnt+=1
    if c[i]=="W":
        wcnt2+=1
    if f==0 and c[i]=="W":
        wcnt+=1
ans=[rcnt,wcnt2]
if cnt>=wcnt:
    ans.append(cnt)
print(min(ans))
# Judge status: Accepted
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush,heapify
import sys,bisect,math,itertools,fractions
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 = n//11
b = n%11
res = 0
if b > 6:
    res = 2
elif b > 0:
    res = 1
else:
    res = 0
print(a*2 + res)
# Judge status: Accepted
N, L = map(int, input().split(' '))
ls = [i + L for i in range(N)]
if 0 in ls:
    print(sum(ls))
elif sum(ls) < 0:
    print(sum(ls) - max(ls))
else:
    print(sum(ls) - min(ls))
# Judge status: Wrong Answer
n, d = map(int,input().split())

ans = 0
for i in range(n):
    x, y = map(int,input().split())
    if (x**2 + y**2)**(0.5) >= d:
        ans += 1 

print(ans)
# Judge status: Wrong Answer
#デフォルト
import itertools
from collections import defaultdict
import collections
import math
import sys
sys.setrecursionlimit(200000)
mod = 1000000007

a, v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())

if a == b:
    print("YES")
elif v > w:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n = int(input())
r = 0
for i in range(1, 10**6):
    r += n//i
    if n%i == 0:
        r -= 1
print(r)
# Judge status: Wrong Answer
K, S = map(int,input().split())


ans_ls = [0 for _ in range(K*3+1)]

for n in range(K+1):
  if n <= K:
    ans_ls[n] = (n+1)*(n+2)//2
    ans_ls[-1*n-1] = (n+1)*(n+2)//2

sum_ans = sum(ans_ls)

if K%2 == 0:
  ans_ls[(K//2)*3] = (K+1)**3-sum_ans
else:
  ans_ls[(K*3//2)] = ((K+1)**3-sum_ans)//2
  ans_ls[(K*3//2)+1] = ((K+1)**3-sum_ans)//2

print(ans_ls[S])
# Judge status: Accepted
a,b,c=map(int,input().split())
if a+b >= c:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n=int(input())
a=[int(input())  for i in range(n)]
ans=0
for i in range(n)[::-1]:
    if i<n-1:
        x=min(a[i+1],a[i])
        ans+=x
        a[i]-=x
    ans+=a[i]//2
    a[i]-=2*(a[i]//2)
print(ans)
# Judge status: Wrong Answer
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

s = rr()
print(s.replace('8', '7', 1))
# Judge status: Accepted
n, m = [int(i) for i in input().split()]
s, c = [], []
for _ in range(m):
    a, b = [int(i) for i in input().split()]
    a -= 1
    s.append(a)
    c.append(b)

for ans in range(1000):
    st = str(ans)
    if len(st) != n:
        continue

    ok = True
    for i in range(m):
        if st[s[i]] != str(c[i]):
            ok = False
    if ok:
        print(st)
        exit()

print(-1)
# Judge status: Accepted
from collections import deque

N, M = map(int, input().split())
graph = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    a, b = a-1, b-1
    graph[a].append(b)
    graph[b].append(a)
    
dist = [-1] * N
dist[0] = 0
    
queue = deque([0])

while queue:
    v = queue.popleft()
    for nv in graph[v]:
        if (dist[nv] != -1):
            continue
        dist[nv] = v
        queue.append(nv)

print("Yes")
for i in dist[1:]:
    print(i+1)
# Judge status: Wrong Answer
list1 = [chr(i) for i in range(97, 97+26)]
i = input()
print(list1[list1.index('i')+1])
# Judge status: Accepted
a,b,c = map(int,input().split())

print(int(a*b/2))
# Judge status: Wrong Answer
N, A, B, C, D = map(int, input().split())
S = ["#"] + list(input())

for i in range(A, D):
    if S[i] == "#" and S[i + 1] == "#":
        print("No")
        break
else:
    if C < D:
        print("Yes")
    else:
        for i in range(B - 1, D):
            if S[i - 1] == "." and S[i] == "." and S[i + 1] == ".":
                print("Yes")
                break
        else:
            print("No")
# Judge status: Accepted
S=input()
ans="Yes"
for i in range(len(S)):
    if (i+1)%2==0:
        if S[i]=='R':
            ans='No'
            break
    else:
        if S[i]=='L':
            ans='No'
            break
print(ans)
# Judge status: Wrong Answer
n,k=map(int,input().split())
p=input().split()
p1=sorted(p)
c = 0
for i in range(k-1):
  c += int(p1[i])
print(c)