peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
import sys


def main():
    h = int(sys.stdin.readline().strip())

    def solve(point):
        if point == 1:
            return 1
        return 1 + 2 * solve(point // 2)

    print(solve(h))


if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
x = int(input())
n = x//11
n = 2*n
m = x%11
if m<=6:
    n += 1
else:
    n += 2
print(n)
# Judge status: Accepted
def LI():
  return [int(s) for s in input().split()]

N = int(input())
W = LI()

S1 = W[0]
S2 = sum(W[1:])

min_sum = abs(S1-S2)

for i in range(1,N):
  S1+=W[i]
  S2-=W[i]
  if min_sum > abs(S1-S2):
    min_sum = abs(S1-S2)
    
print(min_sum)
# Judge status: Accepted
h, n = map(int, input().split())

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

print("Yes" if sum(move) >= h else "No")
# Judge status: Accepted
# coding: utf-8
N = int(input())
# print(N)
if N >= 1000:
    print('ABD')
else:
    print('ABC')
# Judge status: Wrong Answer
s = int(input())

def function(n):
    if n % 2 == 0:
        return int(n/2)
    else:
        return int(n*3+1)
i = 0
count = 0
a = []
a.append(s)
while count < 2:
    a.append(function(a[i]))
    if a[i+1] == 4:
        count += 1
    i += 1
print(i+1)
# Judge status: Accepted
import math
import numpy as np
from fractions import gcd
import fractions
import statistics
import collections
from functools import reduce
import itertools
from collections import defaultdict

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

cnt = 0
cnt0 = 0
for i in range(N):
    if (A[i] == 0):
        cnt0 +=1
    if (A[i] < 0):
        cnt +=1

if (cnt%2 == 0 or cnt0>=1):
    print(sum(np.abs(np.array(A))))
else:
    print(sum(np.abs(np.array(A)))-min(np.abs(np.array(A)))*2)
# Judge status: Accepted
a, b, c = map(int, input().split())
ans = "NO"
for num in range(1, 5051):
    if num % a == 0:
        if num % b == c:
            ans = "YES"
            break

print(ans)
# Judge status: Accepted
n = int(input())
L = [int(x) for x in input().split()]
L.sort()
ans = 0

for i in range(n):
    for j in range(i + 1, n):
        for k in range(j + 1, n):
            if L[i] != L[j] != L[k]:
                if L[i] + L[j] > L[k]:
                    ans += 1

print(ans)
# Judge status: Accepted
n = int(input())
a =[int(x) for x in input().split()]

s = 0
for i in range(n):
	s = s ^ a[i]
	
for i in range(n):
	x = s ^ a[i]
	print(x, end='')
	if i == n - 1:
		print('')
	else:
		print(' ', end='')
# Judge status: Wrong Answer
n,m = list(map(int,input().split()))
x = n//2
gap = 1
for i in range(1,m+1):
	print(x,x+gap)
	gap += 2
# Judge status: Accepted
K,X=map(int,input().split())
if K==1:print(X)
else:print(*list(range(X-K+1,X+K)))
# Judge status: Accepted
S={char:list(input()) for char in "abc"}
turn="a"
while S[turn]:
    turn=S[turn].pop(0)
print(turn.upper())
# Judge status: Wrong Answer
N,L=map(int,input().split())
a = []
for i in range(N):
  a.append(L+i)

ans=10*6
s = sum(a)
for j in range(N):
  t = s - a[j]
  if abs(t-s) < abs(ans -s):
    ans = t
print(t)
# Judge status: Accepted
a,b,c=[int(i) for i in input().split()]
print((a*b)//2)
# Judge status: Accepted
def main():
    s = input()

    st = [s]
    while st:
        x = st.pop()
        if x == '':
            print('YES')
            return

        for w in ('dream', 'dreamer', 'erase', 'eraser'):
            if x.endswith(w):
                st.append(x[:-len(w)])

    print('NO')


if __name__ == '__main__':
    main()
# Judge status: Accepted
# coding: utf-8


def solve(*args: str) -> str:
    x = int(args[0])
    k = 1
    y = x
    while y % 360 != 0:
        y = y+x
        k += 1
    return str(k)


if __name__ == "__main__":
    print(solve(*(open(0).read().splitlines())))
# Judge status: Accepted
import sys
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS)
MII = lambda: list(map(int, IS.split()))

def main():
    s = IS()
    d = '2019/04/30'
    if s <= d: print('Heisei')
    else: print('TBD')

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
D = int(input())
c = list(map(int,input().split()))
last_di = [0] * 26
for d in range(D):
    s = list(map(int,input().split()))
    s_max = s.index(max(s))
    print(s_max)
# Judge status: Wrong Answer
import bisect
N = int(input())
if len(str(N)) == 1:
    print(N)
    exit()
L = len(list(str(N)))-1
A = [10**(L)*i+10**(L)-1 for i in range(10)]  
n = bisect.bisect_left(A,N)-1
if N in A:
    n += 1
ans = [int(list(str(A[n]))[i]) for i in range(len(list(str(A[n]))))]
print(sum(ans))
print(A)
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))

c=0

for i in range(n):
    if a[i]<b[i]:
        c+=min(a[i]+a[i+1],b[i])
        a[i+1]=max(a[i+1]+a[i]-b[i],0)        
    else:
        c+=b[i]

print(c)
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[14]:


N,M = map(int, input().split())
A = list(map(int, input().split()))
BC = []
for _ in range(M):
    BC.append(list(map(int, input().split())))


# In[15]:


bc_sorted = sorted(BC, key=lambda x:x[1], reverse=True)
mylist = [a for a in A]
for i in range(M):
    mylist += [bc_sorted[i][1]]*bc_sorted[i][0]
    if len(mylist) > N*2:
        break
ans = sorted(mylist, reverse=True)[:N]
print(sum(ans))


# In[ ]:
# Judge status: Accepted
s = input()[::-1]

sum_of_digits = 0

cnts = [0] * 2019

cnts[0] = 1

d = 1

for c in s:
    sum_of_digits += int(c) * d
    sum_of_digits %= 2019
    d *= 10
    d %= 2019
    cnts[sum_of_digits] += 1

ans = 0
    
for cnt in cnts:
    ans += cnt * (cnt - 1) // 2

print(ans)
# Judge status: Wrong Answer
n = int(input())
k = int(input())
x = int(input())
y = int(input())

if  n - k <0:
  print(int(n * x))
else:
  print(int((k * y) + (n - k) * y))
# Judge status: Accepted
num = int(input())

data = list()

for i in range(1,10):
    for j in range(1, 10):
        data.append(i*j)

if num in data:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A, B, C = map(int, input().split())
print(min(C, B//A))
# Judge status: Wrong Answer
N=int(input())
A=list(map(int, input().split()))
arai=sum(A)
ans=10**19
sunuke=0
for a in A:
  sunuke+=a
  arai-=a
  if ans>abs(arai-sunuke):
    ans=abs(arai-sunuke)
print(ans)
# Judge status: Accepted
H, N = map(int, input().split())
AB = [list(map(int, input().split())) for i in range(N)]

dp = [2e9] * (H+1)
dp[0] = 0

for i in range(N):
  for h in range(H+AB[i][0]):
    if h - AB[i][0] < 0:
      continue
    else:
      dp[min(h, H)] = min(dp[min(h, H)], dp[h-AB[i][0]] + AB[i][1])

print(dp[H])
# Judge status: Accepted
import numpy as np


N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
X = np.array(X)

cnt = 0
for i in range(N):
    for j in range(i+1, N):
        tmp = ((abs(X[i] - X[j]))**2).sum()
        tmp = np.sqrt(tmp)
        if tmp.is_integer():
            cnt += 1
print(cnt)
# Judge status: Accepted
n,m=map(int,input().split())
if 2*n>=m:
    print(m//2)
else:
    print(n+(m-2*n)//4)
# Judge status: Wrong Answer
#AtCoder
from collections import defaultdict

N, M = map(int, input().split())
a = [list(map(int, input().split())) for i in range(M)]

d = defaultdict(list)

for e in a:
    d[e[0]].append(e[1])

sec = []
for key in d.items():
    if key[0] == 1:
        sec.append(key[1])

for key in d.items():
    if key[0] in sec[0]:
        if key[1][0] == N:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')
# Judge status: Accepted
# E - Crested Ibis vs Monster
def main():
    INF = 1 << 30

    H, N, *AB = map(int, open(0).read().split())
    dp = [INF] * (H + 10001)  # dp[i] := min magic points to decrease monster's health by i
    dp[0] = 0
    for i in range(H):
        for a, b in zip(*[iter(AB)] * 2):
            dp[i + a] = min(dp[i + a], dp[i] + b)
    print(min(dp[H:]))


if __name__ == "__main__":
    main()
# Judge status: Accepted
s=input()
if (s[2]==s[3] and s[4]==s[5]):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
from collections import deque
N,M=map(int,input().split())
to=[[] for _ in range(N)]
for _ in range(M):
  a,b=map(int,input().split())
  to[a-1].append(b-1)
  to[b-1].append(a-1)

q=deque([0])
r=[None]*N
r[0]=0
while q:
  x=q.popleft()
  for i in to[x]:
    if r[i] is None:
      q.append(i)
      r[i]=x+1
      
print('Yes')
for i in range(N):
  if r[i]!=0:
    print(r[i])
# Judge status: Wrong Answer
s = input()

print("A"+s[0]+"C")
# Judge status: Wrong Answer
N = int(input())
MAX_list = []
ans = 0
A = -10**9-2

for _ in range(N):
    X, L = map(int, input().split())
    MAX_list.append(((X + L - 1), (X - L + 1)))
MAX_list = sorted(MAX_list)

for m, l in MAX_list:
    if l > A:
        ans += 1
        A = m

print(ans)
# Judge status: Wrong Answer
from fractions import gcd

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

gcd=gcd(a,b)
ab_gcd=gcd

f=[]
for i in range(2,int(ab_gcd**0.5)+2):
    while gcd%i==0:
        gcd=gcd//i
        f.append(i)

print(len(set(f))+1)
# Judge status: Accepted
s = list(input())

ans = 'AC'
if s[0] != 'A':
    ans = 'WA'  

if s[2:-1].count('C') != 1:
    ans = 'WA'

cnt = 0
for i in s:
    
    if 'A' <= i <= 'Z':
        cnt += 1

if cnt != 2:
    ans = 'WA'

print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3
import sys
import collections as cl
import math

def II(): return int(sys.stdin.readline())


def MI(): return map(int, sys.stdin.readline().split())


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


def main():
    A,B = MI()
    for i in range(101):
        if math.floor( i * 0.08 ) == A and math.floor(i * 0.1) == B:
            print(i)
            exit()

    print(-1)


main()
# Judge status: Accepted
N = int(input())
L = list(map(int, input().split()))
M = max(L)
ind = L.index(M)
del L[ind]

s = sum(L)

if M < s: print('Yes')
else: print('No')
# Judge status: Accepted
N,M=map(int,input().split())
A=list(map(int,input().split()))
x=sum(A)/(4*M)
A.sort(reverse=True)
for a in A[:M]:
    if a<x:
        print("No")
        exit()
print("Yes")
# Judge status: Wrong Answer
a,b,c=map(int, input().split())
print(a*b/2)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
MOD = 10 ** 9 + 7

ans = 0
m = 1

for i in range(60):
    #mbit目に情報を持つものをすべて足し合わせる。
    #m = 1: 1bit目（2^0の位）、m=10: 2bit目（2^1の位）
    #sum = sigma(1の数 * 2^(m-1))
    one = sum(a_e & m for a_e in a)
    one //= m
    zero = n - one
    ans += one * zero * m
    ans %= MOD
    
    m <<= 1

print(ans)
# Judge status: Wrong Answer
s=input().split()[1]
print("A"+s+"C")
# Judge status: Accepted
X = list(map(int, input().split()))

for i in range(len(X)):
    if X[i] == 0:
        print(i+1)
        exit(0)
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

A.sort(reverse = True)
a=0
b=0
cnt = 1
for i in range(1,len(A)):
    if A[i]==A[i-1]:
        cnt+=1
    else:
        cnt=1
        
    if cnt==2:
        if a==0:
            a=A[i]
        elif b==0:
            b=A[i]
        cnt=0
        
        if a*b!=0:
            break

print(a*b)
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
min_val = None
stacks = 0

for i in range(-100, 101):
    cost_stack = 0
    for j in range(len(a)):
        cost_stack += (a[j] - i) ** 2
        
    if min_val == None:
        min_val = cost_stack
    elif cost_stack < min_val:
        min_val = cost_stack

print(min_val)
# Judge status: Accepted
N = int(input())

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

A = sorted([[A[i], i+1] for i in range(N)])
Entr = [str(i[1]) for i in A]
Comp = " ".join(Entr)
print(Comp)
# Judge status: Accepted
# ABC 070: B – Two Switches
a, b, c, d = map(int, input().split())
print(min(b, d) - max(a, c) if min(b, d) >= max(a, c) else 0)
# Judge status: Accepted
x = input()
if x.isupper():
  print('A')
else:
  print('a')
# Judge status: Accepted
n = int(input())
a = [int(x) for x in input().split()]
if 1 not in a: print(-1)
else:
    ans, num = 0, 0
    for i in range(n):
        if a[i] == num + 1:
            num += 1
        else: ans += 1
    print(ans)
# Judge status: Accepted
n,a,b=map(int,input().split())
mod=int(1e9+7)
def nCr(a,b):
  global mod
  res = 1
  for i in range(1,b+1):
    res = res * (n-i+1) % mod * pow(i,mod-2,mod) % mod
  return res%mod
print((pow(2,n,mod) - 1 - nCr(n,a) - nCr(n,b) + 2*mod ) % mod)
# Judge status: Wrong Answer
n = int(input())
s = input()
t = ""
for i in s:
  a = ord(i) + n
  if a > ord("Z"):
    a = a - 26
  t += chr(a)
# Judge status: Accepted
n,m = map( int,input().split() )
a = [ list(map(int,input().split())) for _ in range(n)]

a.sort()

c = 0
for i in range(n):
  x = min(m,a[i][1])
  c += x * a[i][0]
  m -= x
  if m == 0 :
    break

print(c)
# Judge status: Wrong Answer
n = int(input())
l9 = [9**i for i in range(0,6)]
l6 = [6**i for i in range(0,6)]
l = sorted(l9+l6,reverse=True)

i = 0
ans = 0
while(n>0):
  if n - l[i] < 0:
    i += 1
    n = n
  else:
    ans+=1
    #print(n,"-",l[i],"=",n-l[i],"ans=",ans)
    n = n - l[i]
    
print(ans)
# Judge status: Accepted
# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
A.sort()
ans = float("inf")
for i in range(A[0], A[-1]+1):
    med = i
    tmp = 0
    for j in range(N):
        tmp += (A[j] - med)**2
    ans = min(ans, tmp)
print(ans)
# Judge status: Accepted
w,h,x,y=map(int,input().split())
print(w*h/2,int(x==w/2 and y==h/2))
# Judge status: Accepted
import numpy as np

N = int(input())

A1 = list(map(int, input().split()))
A2 = list(map(int, input().split()))

A1_sum = [np.sum(A1[:N-i]) for i in range(N)]
A2_sum = [np.sum(A2[N-1-i:]) for i in range(N)]

A_sum = [A1_sum[i]+A2_sum[i] for i in range(N)]
print(np.max(A_sum))
# Judge status: Accepted
import math
N = int(input())
X = [int(input()) for i in range(5)]
mc = min(X)
mci = X.index(mc)
print(4 + math.ceil(N/mc))
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N >= K:
    price = (K * X) + ((N - K) * Y)
else:
    price = N * X
print(price)
# Judge status: Wrong Answer
import itertools
x =(input()).split(" ")
N = int(x[0])+1
K = int(x[1])
l = []
p =0
for i in range(N):
	l.append(p)
	p+=1
p = 0
while K<=N:
	c_list = list(itertools.combinations(l, K))
	K+=1
	p+=len(c_list)
print(p)
# Judge status: Accepted
import sys
input = lambda: sys.stdin.readline().rstrip()
input_nums = lambda: list(map(int, input().split()))

def main():
    X, Y, A, B, C = input_nums()
    P = input_nums()
    Q = input_nums()
    R = input_nums()
    P.sort(reverse=True)
    Q.sort(reverse=True)
    R.sort()

    P = sorted(P[:X])
    Q = sorted(Q[:Y])
    res = []
    res = P + Q + R
    res.sort(reverse=True)
    print(sum(res[:X+Y]))
if __name__ == '__main__':
    main()
# Judge status: Accepted
K = int(input())

x = 7 % K
for i in range(K):
    if x == 0:
        print(i + 1)
        break
    x = x * 10 + 7
    x = x % K
else:
    print(-1)
# Judge status: Accepted
a,v = map(int, input().split())
b,w = map(int, input().split())
t = int(input())

if (v - w) * t - abs(b - a) >= 0:
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n,r=map(int,input().split())
ans = r
if n<10:
  ans = r+100*(10-n)
print(ans)
# Judge status: Wrong Answer
Q,H,S,D=map(int,input().split())
N=int(input())
dict={}
dict['Q']=Q*8
dict['H']=H*4
dict['S']=S*2
dict['D']=D
#print(dict)
dict2=sorted(dict.items(),key=lambda x:x[1])
#print(dict2)
dict3={}
dict3['Q']=0.25
dict3['H']=0.5
dict3['S']=1
dict3['D']=2
dict4={}
dict4['Q']=Q
dict4['H']=H
dict4['S']=S
dict4['D']=D
ans=0
for i in range(4):
  A=N//dict3[dict2[i][0]]
  ans+=A*dict4[dict2[i][0]]
  N-=A*dict3[dict2[i][0]]
  if N<0:
    break
print(int(ans))
# Judge status: Accepted
a, b, c = map(int,input().split())
 
print("Yes") if a <= c <= b else print("No")
# Judge status: Accepted
N = int(input())
S = input()
B = [0 for _ in range(N+1)]
W = [0 for _ in range(N+1)]
for i in range(N):
    B[i+1] = B[i] + (S[i] == '#')
for i in range(N, 0, -1):
    W[i-1] = W[i] + (S[i-1] == '.')
print(min(B[i]+W[i] for i in range(N+1)))
# Judge status: Accepted
N, A, B = map(int, input().split())
ans = N // (A + B) * A
rem = N % (A + B)
ans += min(rem, A)
print(ans)
# Judge status: Accepted
from collections import Counter

W = str(input())
ans = "Yes"
CW = Counter(W)
for k,v in CW.items():
  if v%2 != 0:
    ans = "No"
    break

print(ans)
# Judge status: Accepted
"""
References
----------
https://atcoder.jp/contests/abc149/submissions/9219652
"""
def solve(n, k, r, s, p, t):
    score = 0
    mapping = {"r": p, "s": r, "p": s}
    t = list(t)
    for i in range(k):
        score += mapping[t[i]]
    for i in range(k, n):
        if t[i] == t[i-k]:
            t[i] = "x"
        else:
            score += mapping[t[i]]
    return score

n, k = map(int, input().split())
r, s, p = map(int, input().split())
t = input()
print(solve(n, k, r, s, p, t))
# Judge status: Wrong Answer
n,m=map(int,input().split())
m_root=int(m**0.5)
ans=0

if m%n==0:
	ans=m//n
for i in range(1,m_root +1):
	if m%i == 0 and m/i >= n:
		ans = max(ans, i)
print(ans)
# Judge status: Accepted
l = list(map(int, input().split()))

print('Yes') if len(set(l))==2 else print('No')
# Judge status: Accepted
n=int(input())
l=sorted(map(int,input().split()))[::-1]
print(sum(l[::2])-sum(l[1::2]))
# Judge status: Accepted
W, a, b = map(int, input().split())
d = min(abs(b - (a+W)), abs(b+W-a))
if a <= b <= a+W or a <= b+W <= a+W:
    print(0)
else:
    print(d)
# Judge status: Accepted
K, N = map(int, input().split())
A_list = list(map(int, input().split()))
max1 = -1
for i in range(N):
    if i!=N-1:
        dis = abs(A_list[i]-A_list[i+1])
    else:
        if A_list[0]!=0:
            dis = abs(K-A_list[-1])+A_list[0]
        else:
            dis = abs(K-A_list[-1])
    if dis > max1:
        max1 = dis
print(K-max1)
# Judge status: Accepted
N = int(input())
hhh = list(map(int, input().split()))
for i in range(N - 2, -1, -1):
    if hhh[i] <= hhh[i + 1]:
        pass
    elif hhh[i] - hhh[i + 1] == 1:
        hhh[i] -= 1
    else:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
import sys
import copy
import math
import bisect
import pprint
import bisect
from functools import reduce
from copy import deepcopy
from collections import deque

if __name__ == '__main__':
    b, c = map(int, input().split())

    if b <10 and c <10:
        print(b*c)
    else:
        print(-1)
# Judge status: Accepted
X, Y = map(int, input().split())
for a in range(X+1):
  if 2*a + 4*(X-a) == Y:
    print("Yes")
    exit()
print("No")
# Judge status: Accepted
def main(a,b):
    a1 = a / 0.08
    a2 = (a+1) / 0.08
    b1 = b / 0.1
    b2 = (b+1) / 0.1
    x = max(a1,b1)
    y = min(a2,b2)
    if (y <= x):
        return -1
    else:
        if(x//1 == x):
            return x
        elif(y > (x//1)+1):
            return x+1
    return -1


a,b = list(map(int,input().split()))
print(int(main(a,b)))
# Judge status: Accepted
n=int(input())
a=[111,222,333,444,555,666,777,888,999]
p=0
while a[p]<n:
    p+=1
print(a[p])
# Judge status: Accepted
a11,a12,a13=map(int,input().split())
a21,a22,a23=map(int,input().split())
a31,a32,a33=map(int,input().split())

if a22!=a21+a12-a11:
    print('No')
elif a23!=a21+a13-a11:
    print('No')
elif a32!=a31+a12-a11:
    print('No')
elif a33!=a31+a13-a11:
    print('No')
else:
    print('Yes')
# Judge status: Wrong Answer
n = int(input())
s = input()

flg = False
countw = 0
countb = 0
tmpb = 0
for l in s:
    if l=="#":
        flg = True
        tmpb+=1
    else:
        if flg:
            countw+=1
            countb+=tmpb
            tmpb=0

print(min(countw,countb))
# Judge status: Accepted
N = int(input())

if 1 <= N < 10:
    print(N)
elif 10 <= N < 100:
    print(9)
elif 100 <= N < 1000:
    print((N-100+1)+9)
elif 1000 <= N < 10000:
    print(9+900)
elif 10000 <= N < 100000:
    print((N-10000+1)+900+9)
else:
    print(90000+900+9)
# Judge status: Accepted
N, K = map(int, input().split())
AList = list(map(int, input().split()))

l = 0
r = 10**9
while r-l > 1:
  x = (l + r)//2
  now = 0
  for a in AList:
    now += (a-1)//x
  f = lambda now : True if now <= K else False
  if f(now):
    r = x
  else:
    l = x
print(r)
# Judge status: Wrong Answer
N, D = map(int, input().split())

X = [list(map(int, input().split())) for i in range(N)]

sq = set()
for i in range(1, 40):
  sq.add(i**2)

def foo(x,y):
  t = 0
  for i, j in zip(X[x], X[y]):
    t += (i - j) * (i - j)
  if t in sq:
    return 1
  else:
    return 0
    
ans = 0

for i in range(N):
  for j in range(i+1, N):
    ans += foo(i, j)

print(ans)
# Judge status: Accepted
N, M = (int(_) for _ in input().split())

if N % 2 == 0:
    s = (N - 1) // 4 + 1
    ret = []
    for i in range(1, s):
        ret.append((i, N - i))
    for i in range(s, N // 2):
        ret.append((i, N - i - 1))
else:
    ret = []
    for i in range(1, (N // 2) + 1):
        ret.append((i, N - i))


for r0, r1 in ret[:M]:
    print(r0, r1)
# Judge status: Accepted
n = int(input())
b = list(map(int,input().split()))
ans = b[0] + b[-1]
for i in range(n-2):
  ans+=min(b[i],b[i+1])
print(ans)
# Judge status: Accepted
n , k = map(int, input().split())
x=[]
j=0
c=0
for i in range(n):
    a , b = map(int, input().split())
    x.append([a,b])
x.sort(key = lambda x :x[0])
while True:
    c+=x[j][1]
    if c>=k:
        print(x[j][0])
        break
    j+=1
# Judge status: Accepted
N, M = map(int, input().split())
C = []
for _ in range(N):
    A, B = map(int, input().split())
    C.append((A,B))
C.sort()
cnt = 0
res = 0
for i in range(N):
    if cnt+C[i][1]<=M:
        res += C[i][1]*C[i][0]
        cnt += C[i][1]
    else:
        break
print((M-cnt)*C[i][0] + res)
# Judge status: Wrong Answer
N=(input())

if N[0]==N[1] and N[1]==N[2] or N[1]==N[2] and N[2]==[3]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
A = list(map(int, input().split()))
if len(set(A)) == 2:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N, A, B = list(map(int, input().split()))

def get_sum(n):
    ans = 0
    while True:
        ans += n % 10
        if n // 10 > 0:
            n = n // 10
        else:
            break
    return ans

total = 0
for i in range(1, N + 1):
    ans = get_sum(i)
    if A <= ans <= B:
        total += i
print(total)
# Judge status: Accepted
from fractions import gcd
n1, n2  = [int(i) for i in input().split()]

n3 = (n1 * n2) //gcd(n1, n2)

print(n3)
# Judge status: Accepted
from operator import mul
from functools import reduce
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under

from collections import Counter
n = int(input())
list_N = []
ans = 0

for _ in range(n):
    s = sorted(input())
    list_N.append("".join(s))

list_M = list(Counter(list_N).values())

for i in list_M:
    if i != 1:
        ans += cmb(i, 2)
print(ans)
# Judge status: Accepted
N=int(input())
l=N-1

a=0
for c in range(1,N):
    a+=(N-1)//c
print(a)
# Judge status: Accepted
s = input()
a = ['a', 'i', 'u', 'e', 'o']
for i in a:
  if s == i:
    print('vowel')
    exit()
    
print('consonant')
# Judge status: Accepted
D = int(input())
ans = ""
if D == 25:
  ans = "Christmas"
elif D == 24:
  ans = "Christmas Eve"
elif D == 23:
  ans = "Christmas Eve Eve"
elif D == 22:
  ans = "Christmas Eve Eve Eve"
print(ans)
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))
x = [0 for _ in range(31)]
for ai in a:
  i = 0
  while ai > 0:
    if ai%2 == 1:
      x[i] += 1
    ai = ai//2
    i += 1
for i in range(17):
  x[i] = x[i]%2
for ai in a:
  s = 0
  i = 0
  while ai > 0:
    if ai%2 == 1:
      if x[i] == 0:
        s += 2**i
    else:
      if x[i] == 1:
        s += 2**i
    ai = ai//2
    i += 1
  print(s)
# Judge status: Accepted
print('Yes' if "9" in input() else 'No')
# Judge status: Accepted
a,b, c = map(int, input().split())

A = a*100
B = b*10
C = A + B + c

if C % 4 == 0:
    print("YES")
else:
    print("NO")
# Judge status: Accepted
n,a,b=map(int,input().split())

def modinv(a, mod=10**9+7):
    return pow(a, mod-2, mod)

def mod_comb_count(n, r, mod):
    r = min(r, n-r)
    res = 1
    for i in range(r):
        res = res * (n - i) * modinv(i+1, mod) % mod
    return res

mod=10**9+7
print((2*mod+(pow(2,n,mod)-1)-mod_comb_count(n,a,mod)-mod_comb_count(n,b,mod))%mod)