Harryxun/stf_run huggingface dataset:
x = int(input())
print(x^^2)

### FIXED CODE ###

x = int(input())
print(x**2)
S = input()
K = int(input())

c = -1
for s in S:
    if s == "1":
        c += 1
    else:
        break

print(1 if K < c else S[c+1])

### FIXED CODE ###

S = input()
K = int(input())

c = 0
for s in S:
    if s == "1":
        c += 1
    else:
        break

print(1 if K <= c else S[c])
n = int(input())
list_score = list(map(int, input().split()))
ans = []
score = 0

for i in range(n-1):
    if list_score[i] >= list_score[i+1]:
        score += 1
    else:
        ans.append(score)
        score = 0
    if i == n-2:
        ans.append(score)

    #print(score, ans)

print(max(ans))

### FIXED CODE ###

n = int(input())
list_score = list(map(int, input().split()))
ans = []
score = 0
if len(list_score) == 1:
    print(0)
else:
    for i in range(n-1):
        if list_score[i] >= list_score[i+1]:
            score += 1
        else:
            ans.append(score)
            score = 0
        if i == n-2:
            ans.append(score)

        #print(score, ans)

    print(max(ans))
n = int(input())
base = list(map(int,input().split()))
even = [0]*(10**5)
odd = [0]*(10**5)

for i in range(1,n+1):
  sign = i%2
  num = base[i-1]
  
  if sign == 0:
    even[num] += 1
  elif sign == 1:
    odd[num] += 1

ans_e = max(even)
ans_o = max(odd)
even_i = even.index(ans_e)
odd_i = odd.index(ans_o)

if even_i == odd_i:
  even.sort()
  odd.sort()
  if even[10**5 - 2] <= odd[10**5 - 2]:
    ans_o = odd[10**5 - 2]
  else:
    ans_e = even[10**5 - 2]
  
print(n - ans_e - ans_o)

### FIXED CODE ###

n = int(input())
base = list(map(int,input().split()))
even = [0]*(10**5)
odd = [0]*(10**5)

for i in range(1,n+1):
  sign = i%2
  num = base[i-1]
  
  if sign == 0:
    even[num-1] += 1
  elif sign == 1:
    odd[num-1] += 1

ans_e = max(even)
ans_o = max(odd)
even_i = even.index(ans_e)
odd_i = odd.index(ans_o)

if even_i == odd_i:
  even.sort()
  odd.sort()
  if even[10**5 - 2] <= odd[10**5 - 2]:
    ans_o = odd[10**5 - 2]
  else:
    ans_e = even[10**5 - 2]
  
print(n - ans_e - ans_o)
s = input()
dic = {}
for i in range(2019):
  dic[i] = 0
dic[0] = 1
for j in range(1, len(s)+1):
  m = s[:j] % 2019
  dic[m] += 1
ans = 0
for v in dic.values():
  ans += v*(v-1) // 2
print(ans)

### FIXED CODE ###

s = input()
dic = {}
for i in range(2019):
  dic[i] = 0
dic[0] = 1
m = 0
decimal = 1
for j in range(1, len(s)+1):
  m += int(s[-j]) * decimal
  m %= 2019
  dic[m] += 1
  decimal *= 10
  decimal %= 2019

ans = 0
for v in dic.values():
  ans += v*(v-1) // 2
print(ans)
A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())
import numpy as np
import math
#１の位が0以外でより小さい値のものを最後にする
dishes=np.array([A,B,C,D,E])
dishes_1=np.array(list(map(lambda x: x%10, dishes)))
# print(dishes)
# print(dishes_1)
last=0
ans=0
if np.all(dishes_1==0):
  print(A+B+C+D+E)
else:
  dishes=np.stack([dishes, dishes_1], 1)
  dishes=sorted(dishes, key=lambda x: x[1])
  for i in range(len(dishes)):
      if dishes[i][1]!=0:
          last=dishes[i]
          dishes.pop(i)
          break
  for j in range(len(dishes)):
      ans=ans+dishes[j][0]+((10-dishes[j][0]%10)%10)
  print(ans+last[0])


### FIXED CODE ###

import numpy as np
import math

A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

#１の位が0以外でより小さい値のものを最後にする
dishes=np.array([A,B,C,D,E])
dishes_1=np.array(list(map(lambda x: x%10, dishes)))
# print(dishes)
# print(dishes_1)
last=0
ans=0
if np.all(dishes_1==0):
  print(A+B+C+D+E)
else:
  dishes=np.dstack([dishes, dishes_1])
  dishes=dishes[0]
  dishes=sorted(dishes, key=lambda x: x[1])
  for i in range(len(dishes)):
      if dishes[i][1]!=0:
          last=dishes[i]
          dishes=np.delete(dishes, [i], axis=0)
          break
  for j in range(len(dishes)):
      ans=ans+dishes[j][0]+((10-dishes[j][0]%10)%10)
  print(ans+last[0])
n=int(input())
h=list(map(int,input().split()))
h_=list()
cnt=0
for i in range(n-1):
  if h[i]>h[i+1]:
    h_.append(h[i]-1)
  else:
    h_.append(h[i])
for i in range(n-1):
  if h_[i]>h_[i+1]:
    cnt=1
if cnt=0:
  print('Yes')
else:
  print('No')


### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
for i in range(1,n):
  if h[-i]+1==h[-i-1]:
    h[-i-1]-=1
  elif h[-i]+1<h[-i-1]:
    print('No')
    exit()
print('Yes')
n, k = map(int, input().split(" "))

l = map(int, input().split(" "))
l.sort()

sum = 0
for i in range(n-k-1, n-1):
    sum = sum + l[i]

print(sum)


### FIXED CODE ###

n, k = map(int, input().split(" "))

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

sum = 0
for i in range(n-k, n):
    sum = sum + l[i]

print(sum)
K = input()
x = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(x[K-1])


### FIXED CODE ###

K = int(input())
x = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(x[K-1])
from math import sqrt
from math import log10
n=int(input())

i=1
ans=13
j=0

while i<sqrt(n):
    if n%i==0:
        j=n/i
        ans=int(min(ans,max(log10(i)+1,log10(j)+1)))
    i+=1
if j==0:
    ans=int(max(log10(i)+1,log10(j)+1))
print(ans)
    



### FIXED CODE ###

from math import sqrt
from math import log10
n=int(input())

i=1
ans=13
j=0

while i<=sqrt(n):
    if n%i==0:
        j=n//i
        ans=int(min(ans,max(log10(i)+1,log10(j)+1)))
    i+=1
if j==0:
    ans=int(max(log10(i)+1,log10(j)+1))
print(ans)
import numpy as np

R=int(input())

print(2*np.pi*R)

### FIXED CODE ###

import numpy as np

R=int(input())

print(2*np.pi*R)
s = input()
k = int(input())
infinity = 5 * (10 ** 15) - 1

import math

i = 0
while k > 0:
  print(s[i])
  k -= math.floor(infinity * math.log(int(s[i]), 10)) + 1
  i += 1
  print(k)
  
print(s[i-1])


### FIXED CODE ###

s = input()
k = int(input())

for i in map(int, s[:k]):
  if i != 1:
    print(i)
    break
else:
  print(1)
# coding: utf-8


def main():
    n = int(input())
    point = list(map(int, input().split(' ')))    

    max_point = max(point)
    min_point = min(point)
    min_sums = []
    for p in range(min_point, max_point + 1):
        sum_ = 0
        for x in numbers:
            sum_ += (x - p) ** 2
        min_sums.append(sum_)

    print(min(min_sums))

    return 0


if __name__ == '__main__':
    main()

### FIXED CODE ###

# coding: utf-8


def main():
    n = int(input())
    numbers = list(map(int, input().split(' ')))    

    max_number = max(numbers)
    min_number = min(numbers)
    min_sums = []
    for p in range(min_number, max_number + 1):
        sum_ = 0
        for x in numbers:
            sum_ += (x - p) ** 2
        min_sums.append(sum_)

    print(min(min_sums))

    return 0


if __name__ == '__main__':
    main()
N = int(input())
X = list(int,input().split())
m = sum(X)//N
def fun(X,m):
  s = 0
  for i in X:
    s += (i-m)**2
  return s

print(min(fun(X,m),fun(X,m+1)))


### FIXED CODE ###

N = int(input())
X = list(map(int,input().split()))
m = sum(X)//N
def fun(X,m):
  s = 0
  for i in X:
    s += (i-m)**2
  return s

print(min(fun(X,m),fun(X,m+1)))
text = input()
if (text ==  a )
    print('vowel')
elif (text ==  i )
    print('vowel')
elif (text ==  u )
    print('vowel')
elif (text ==  e )
    print('vowel')
elif (text == o )
    print=('vowel')
else:
    print=('consonant')

### FIXED CODE ###

s=input()
if s == "a" or s == "i" or s == "u" or s =="e" or s == "o":
    print("vowel")
else:
    print("consonant")
s = input() # これを繰り返しまくる
t = input() # これを探す

s_set = set(s)
ss = s * len(t)

if all((t_ in s_set) for t_ in t):
    current_index = 0

    for t_ in t:
        current_index = ss.find(t_, current_index) + 1
    print(current_index)
else:
    print(-1)


### FIXED CODE ###

s = input() # これを繰り返しまくる
t = input() # これを探す

# 判定
s_set = set(s)
s_len = len(s)

if all((t_ in s_set) for t_ in t):
    ans = 0
    ss = s + s
    found_index_old = -1

    for t_ in t:
        found_index = ss.find(t_, found_index_old + 1)
        # print(ss, found_index_old + 1, found_index, found_index + 1 - (found_index_old + 1))
        ans += found_index - found_index_old # found_index + 1 - (found_index_old + 1)
        found_index_old = found_index % s_len
    print(ans)
else:
    print(-1)
r4 = range(4)
r13 = range(13)
cards = [[0 for i in r13] for j in r4]
while True:
    n = inpur()
    for i in range(n):
        s1, s2 = raw_input().split()
        s1 = 'SHCD'.index(s1)
        s2 = int(s2)-1
        cards[s1][s2] = 1

for j in r4:
    for i in r13:
        if cards[j][i]==0: print 'SHCD'[j],i+1

### FIXED CODE ###

r4 = range(4)
r13 = range(13)
cards = [[0 for i in r13] for j in r4]

n = input()
for i in range(n):
    s1, s2 = raw_input().split()
    s1 = 'SHCD'.index(s1)
    s2 = int(s2)-1
    cards[s1][s2] = 1

for j in r4:
    for i in r13:
        if cards[j][i]==0:
            print 'SHCD'[j],i+1
a=int(input())
#b=int(input())
#c=int(input())
#d=int(input())
x=(a-2)/2
if int(x) ==x:
    print(x)
elif:
    print(x+1) 

### FIXED CODE ###

a=int(input())
 
x=(a-2)/2
if int(x) ==x:
    print(int(x))
else:
    print(int(x+1))
n=int(input())
l=list(map(int,input().split()))
l.sort()
s=0
i=0
while s==0:
  if l[i]==l[i+1]:
    l.remove(l[i])
  else:
    i+=1
    if len(l)-1==i:
      s+=1
a=len(l)
print((a*(a-1)*(a-2)/6)

### FIXED CODE ###

n=int(input())
l=list(map(int,input().split()))
l.sort()
a=0
b=0
c=0
ans=0
for i in range(n-2):
  a=l[i]
  for j in range(i+1,n-1):
    if l[j]!=a:
      b=l[j]
      for k in range(j+1,n):
        if l[k]!=b:
          c=l[k]
          if a+b>c:
            ans+=1
print(ans)
A, B = input().split()
A = int(A)
B = float(B)
ans = int(A * B)
print(ans)
A, B = input().split()
A = int(A)
B = float(B)
ans = int(A * B)
print(ans)


### FIXED CODE ###

A, B = input().split()
A = int(A)
B = int(B.replace('.', ''))
ans = A * B // 100
print(ans)
# -*- coding:utf-8 -*-
H,W=map(int,input().split())
nx=[1,0,-1,0]
ny=[0,1,0,-1]

field=[]
for i in range(H):
  field.append(list(input()))

for n in range(W):
  for m in range(H):
    if field[n][m]=='.':
      continue
    
    hope=0
    for j in range(4):
      x=n+nx[j]
      y=m+ny[j]
      
      if x<0 or W<=x or y<0 or H<=y:
        continue

      if field[x][y]=='#':
        hope=1
      
    if hope==0:
      print('No')
      exit()

print('Yes')

### FIXED CODE ###

H,W=map(int, input().split())
S=["."+input()+"." for _ in range(H)]
S=["."*(W+2)]+S+["."*(W+2)]
ans="Yes"
for i in range(H):
  for j in range(W):
    if S[i][j]=="#" and S[i-1][j]=="." and S[i+1][j]=="." and S[i][j-1]=="." and S[i][j+1]==".":
      ans="No"
print(ans)
from sys import stdin

S = stdin.readline().rstrip()
K = int(stdin.readline().rstrip())

for x in range(10 ** 2):
    if int(S[x]) > 1:
        print(S[x])
        break


### FIXED CODE ###

from sys import stdin

S = stdin.readline().rstrip()
K = int(stdin.readline().rstrip())

for x in range(len(S)):
    if int(S[x]) > 1:
        print(S[x])
        break
    if K == x + 1:
        print('1')
        break
from math import ceil
n, k = map(int,input().split())
array = [n]
p = ceil(max(n/k,k/n))+1
n_r = 10**18
if k == 1:
    array.append(0)
else:
    for i in range(p):
        n_r = n
        n = abs(n-k)
        array.append(n)
        if n > n_r:
            break
min_n = min(array)
print(min_n)

### FIXED CODE ###

n, k = map(int, input().split())
print(min(n%k, k-n%k))
N = int(input())
S = input()
a = [A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z]
ans = ''
for i in range(len(S)):
  ans += a[(ord(S[i])-ord('A')+N)%26]
print(ans)

### FIXED CODE ###

N = int(input())
S = input()
ans = ''
for i in range(len(S)):
  temp = ord(S[i]) - ord('A') + N
  ans += chr(ord("A") + temp%26 )
print(ans)
N = int(input())
lim = int(N ** 0.5) + 1
ans = 0
for i in range(1, lim + 1):
    m = N // i
    quotient = N // m
    while m != 0:
        remainder = N % m
        if N // m != quotient or remainder > i:
            break
        if quotient == remainder:
            ans += m
            break
        m -= 1
print(ans)


### FIXED CODE ###

N = int(input())
lim = int(N ** 0.5)
ans = 0
for i in range(1, lim + 1):
    m = N // i
    quotient = N // m
    while m != 0:
        remainder = N % m
        if N // m != quotient or remainder > i:
            break
        if quotient == remainder:
            ans += m
            break
        m -= 1
print(ans)
n,m = map(int,input().split())
x = list(map(int,input().split()))
x = sorted(x)

if m == 1:
	print(0)
elif n == 1:
	print(abs(max(x)-min(x)))
else:
	# print(diff)
	diff = []
	for it in range(m-1):
		diff.append(x[it+1]-x[it])
	for it in range(n-1):
		max_d = max(diff)
		idx = diff.index(max_d)
		diff = diff[:idx] + diff[idx+1:]
	print(sum(diff))


### FIXED CODE ###

n,m = map(int,input().split())
x = list(map(int,input().split()))
x = sorted(x)

if m <= n:
	print(0)
elif n == 1:
	print(abs(x[-1]-x[0]))
else:
	diff = [0]*(m-1)
	for it in range(m-1):
		diff[it] = x[it+1]-x[it]
	diff = sorted(diff)
	diff = diff[:m-n]
	# print(diff)
	print(sum(diff))
import heapq

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

sub1 = 0
li = []

for i in range(n):
    if a[i] > b[i]:
        sub1 += a[i] - b[i]
    else:
        heapq.heappush(li, a[i] - b[i])

for i in range(sub1):
    x = -heapq.heappop(li)
    if x >= 2:
        heapq.heappush(li, 2-x)
    else:
        print('No')
        exit()

print('Yes')


### FIXED CODE ###

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

sub1 = 0
sub2 = 0

for i in range(n):
    if a[i] > b[i]:
        sub1 += a[i] - b[i]
    else:
        sub2 += (b[i] - a[i]) // 2

if sub1 <= sub2:
    print('Yes')
else:
    print('No')
def lcs_size():
  X = raw_input()
  Y = raw_input()
  
  a = len(X)
  b = len(Y)
  
  z2 = [0 for in range(b+1)]
  for i in range(a):
    z1 = z2 + []
    for j in range(b):
      if X[i] == Y[j]:
        z2[j+1] = z1[j] + 1
      else:
        z2[j+1] = z2[j]
  
  return z2[-1]

q = input()

for i in range(q):
  print lcs_siz()

### FIXED CODE ###

def lcs_size():
  X = raw_input()
  Y = raw_input()
  a = len(X)
  b = len(Y)
  z2 = [0 for i in range(b+1)]

  for i in range(a):
    ch = X[i]
    z1 = z2 + []
    for j in range(b):
      if ch == Y[j]:
        z2[j+1] = z1[j] + 1
      elif z2[j+1] < z2[j]:
        z2[j+1] = z2[j]

  return z2[-1]

q = input()
for k in range(q):
  print lcs_size()
a=input()
n=len(a)
count=0
for i in range (n)
	 if a[i]!=a[n+1-i]:
	 	a[i]=a[n+1-i]
	 	count+=1
print(count)

### FIXED CODE ###

a=list(input())
n=len(a)
count=0
for i in range(n):
	 if a[i]!=a[n-1-i]:
	 	a[i]=a[n-1-i]
	 	count+=1
print(count)
n=input()
print len(0 for k in range(1,n+1,2) if sum(1 for v in range(1,k+1) if k%v==0)==8)

### FIXED CODE ###

n=input()
print sum(1 for k in range(1,n+1,2) if sum(1 for v in range(1,k+1) if k%v==0)==8)
n = int(input())
l = [int(input()) for i in range(n)]
total = sum(l)
i = 0
while total % 10 == 0:
    if i = n:
        break
    total = total - l[i]
    i += 1
print(total)


### FIXED CODE ###

a, b = map(int, input().split())
print(a + b) if (a + b) < 10 else print("error")
N, M = map(int, input().split())
    s_list = list()
    c_list = list()
    for _ in range(M):
        s, c = input().split()
        s_list.append(s)
        c_list.append(c)

    out = '-1'
    exists = True

    num = 'd' * N

    for index in range(len(s_list)):
        if num[int(s_list[index]) - 1] == 'd' or num[int(s_list[index]) - 1] == c_list[index]:
            # num[int(s_list[index])] = c_list[index]
            num_tmp = num[:int(s_list[index]) - 1]
            num_tmp += c_list[index] + num[int(s_list[index]):]
            num = num_tmp

        else:
            exists = False
            break

    if exists:
        out = num.replace('d', '0')
        if out[0] == '0' and N > 1:
            out = '-1'

    print(out)

### FIXED CODE ###

N, M = map(int, input().split())
s_list = list()
c_list = list()
for _ in range(M):
    s, c = input().split()
    s_list.append(s)
    c_list.append(c)

out = '-1'
exists = True

num = 'd' * N

for index in range(len(s_list)):
    if num[int(s_list[index]) - 1] == 'd' or num[int(s_list[index]) - 1] == c_list[index]:
        # num[int(s_list[index])] = c_list[index]
        num_tmp = num[:int(s_list[index]) - 1]
        num_tmp += c_list[index] + num[int(s_list[index]):]
        num = num_tmp

    else:
        exists = False
        break

if num[0] == '0' and N > 1:  # 0から始まる2桁以上を排除
    exists = False

if exists:
    out = num.replace('d', '0')
    if out[0] == '0' and N > 1:  # '00'→'10'等
        out = '1' + out[1:]

print(out)
list_str2 = [0 for i in range(26)]

while(1):
	list_str1 = list(input())
	print(list_str1)
	if list_str1 == []:
		break
	for i in range(len(list_str1)):
		if 97 <= ord(list_str1[i].lower()) <= 122:
			list_str2[ord(list_str1[i].lower())-97] += 1

for i in range(26):
	print(chr(97+i)+' : '+str(list_str2[i]))

### FIXED CODE ###

list_str2 = [0 for i in range(26)]

while(1):
	try:
		list_str1 = list(input())
		#print(list_str1)
	except:
		break
	for i in range(len(list_str1)):
		if 97 <= ord(list_str1[i].lower()) <= 122:
			list_str2[ord(list_str1[i].lower())-97] += 1

for i in range(26):
	print(chr(97+i)+' : '+str(list_str2[i]))
a,b=map(int(),input().split())
print("Even" if a*b%2==0 else"Odd")

### FIXED CODE ###

a, b = map(int, input().split())
if (a*b) % 2:
    print("Odd")
else:
    print("Even")
import numpy as np
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
HH=np.zeros((N,N))
for i in range(M):
  A,B=list(map(int,input().split()))
  HH[A-1][B-1]=1
HH=HH+HH.T
count=0
for i in range(N):
  ma=0
  for j in np.where(HH[i]==1)[0]:
    if(H[i]<=H[j] and i!=j):
      count+=1
      break
print(N-count)        

### FIXED CODE ###

import numpy as np
N,M=list(map(int,input().split()))
H=list(map(int,input().split()))
F=[0]*len(H)
for i in range(M):
  A,B=list(map(int,input().split()))
  if(H[A-1]<H[B-1]):
    F[A-1]=1
  elif(H[A-1]>H[B-1]):
    F[B-1]=1
  else:
    F[B-1]=1
    F[A-1]=1
print(F.count(0))
nums = map(int, input().split())
if nums.count(5) == 2 and nums.count(7) == 1:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

nums = list(map(int, input().split()))
if nums.count(5) == 2 and nums.count(7) == 1:
    print("YES")
else:
    print("NO")
n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n//2+1):
    if a[2*i] % 2 == 1:
        ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))

ans = 0
for i in range(n):
    if (i + 1)%2 == 1 and a[i] % 2 == 1:
        ans += 1
print(ans)
import math
n, k = map(int, input().split())

t = []
d = k
while(True):
  d = d / 2
  t.append(d)
  if d <= 1:
    break
# print(t)

t2 = []
nn = 1+n if n < k else k
for i in range(1, nn):
  for j in range(len(t)):
    if i >= t[j]:
      t2.append(j+1)
      break
# print(t2)

t3 = [0.5]
for i in range(1, math.ceil(math.log2(k))):
  t3.append(t3[i-1]*0.5)
# print(t3)

r = 0
for t in t2:
  r += t3[t-1]
r /= n
if n >= k:
  r += (n-k+1) / n
print(r)

### FIXED CODE ###

n, k = map(int, input().split())

r = 0
for i in range(1, 1+n):
  t = i
  p = 1.0
  while(True):
    if t >= k:
      r += p
      break
    t *= 2
    p *= 0.5
print(r/n)
# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools

DIV_NUM = 1000000007


N,K = map(int, input().split())
A = [int(x) for x in input().split()]

# https://atcoder.jp/contests/chokudai_S001/submissions/5684678
data = [0]*(N+1)
def add(i, x):
    while i <= N:
        data[i] += x
        i += i & -i
def get(i):
    s = 0
    while i:
        s += data[i]
        i -= i & -i
    return s
def su(i,j):
    return get(j)-get(i)
ans = 0
for i,a in enumerate(A):
    add(a, 1)
 
    ans += a-get(a)
answer = ans

B = sorted(A)

q=0
p=B[0]
r=0
for i in range(1,N):
    if B[i]>p:
        p=B[i]
        r=i
    q += r

answer = (K * answer) + q * K * (K-1) // 2
answer = answer % DIV_NUM
print(answer)



### FIXED CODE ###

# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
import numpy as np

DIV_NUM = 1000000000 + 7

INPUT_NUMS = list(map(int, input().split()))
N=int(INPUT_NUMS[0])
K=int(INPUT_NUMS[1])

A = [int(x) for x in input().split()]
AA = np.array(A)
if N==1:
    print(0)
    exit()

# https://kira000.hatenadiary.jp/entry/2019/02/23/053917
def bubble_sort(A):
    cnt = 0
    for i in range(len(A)):
        for j in range(len(A)-1, i, -1):
            if A[j] < A[j-1]:
                A[j], A[j-1] = A[j-1], A[j]
                cnt += 1
    return cnt

answer = bubble_sort(AA)

B = sorted(A)
q=0
p=B[0]
r=0
for i in range(1,N):
    if B[i]>p:
        p=B[i]
        r=i
    q += r

# print(answer,K)
answer = answer % DIV_NUM
answer = int(answer)
answer = (answer * K) % DIV_NUM
q = q % DIV_NUM
answer = answer + q * K * (K-1) // 2
answer = answer % DIV_NUM
print(answer)
a,b=map(int,input().split())
import math
ans=a*b//math.gcd(a,b)
print(ans)


### FIXED CODE ###

import fractions
a,b=map(int,input().split())
g=fractions.gcd(a,b)
print(a*b//g)
a = input() b = input()
print a*b 2*a+2*b

### FIXED CODE ###

a, b = map(int, raw_input().split())
print a*b,
print 2*a + 2*b
n=int(input())
p=list(map(int,input().split()))
count=0
for i in range(1,n):
    if p[i-1]<p[i] and p[i]<p[i+1]:
        count+=1
for i in range(1,n-1):     
    if p[i-1]>p[i] and p[i]>p[i+1]:
        count+=1
print(count)

### FIXED CODE ###


n=int(input())
p=list(map(int,input().split()))
count=0
for i in range(1,n-1):
    if (p[i-1]<p[i] and p[i]<p[i+1]) or (p[i-1]>p[i] and p[i]>p[i+1]):
        count+=1
    else:
        continue
print(count)
s = str(input())

l = list(s)

info = [0]

for i in range(1,len(l)):
    if l[i] == l[i-1]:
        info[-1] += 1
    else:
        info.append(1)

ans = 0
for j in range(0,len(info)):
    if info[j] % 3 == 0:
        ans += 2*(info[j]//3)
    elif info[j] % 3 == 1:
        ans += 2*(info[j]//3) + 1
    else:
        if j < len(info):
            ans += 2*(info[j]//3) + 2
            info[j+1] -= 1
        else:
            ans += 2*(info[j]//3) + 1

print(ans)

### FIXED CODE ###

s = str(input())

l = list(s)

info = [1]

for i in range(1,len(l)):
    if l[i] == l[i-1]:
        info[-1] += 1
    else:
        info.append(1)

ans = 0
for j in range(0,len(info)):
    if info[j] % 3 == 0:
        ans += 2*(info[j]//3)
    elif info[j] % 3 == 1:
        ans += 2*(info[j]//3) + 1
    else:
        if j < len(info)-1:
            ans += 2*(info[j]//3) + 2
            info[j+1] -= 1
        else:
            ans += 2*(info[j]//3) + 1

print(ans)
def inp():
    ls=list(map(int,input().split()))
    return ls
x,n=map(int,input().split())
ls=inp()
ls.sort()
if n==0:
    print(x)
    exit(0)
else:
    ans=0
    d=1000000000
    for i in range(1,101):
        if i in ls:
            continue
        tmp=abs(x-i)
        if tmp<d:
            d=tmp
            ans=i
    print(ans)

### FIXED CODE ###

x,y=map(int,input().split())
if x==1 and x*4>=y and y%2==0 and x*2<=y:
  print('Yes')
elif x*4>= y and y%2==0 and x*2<=y:
    print('Yes')
else:
  print('No')
N, K = map(int,input().split())
S = input()
S = list(S)
S[K-1] = S[K-1].lower()
print(''.join(S)

### FIXED CODE ###

N, K = map(int,input().split())
S = input()
S = list(S)
S[K-1] = S[K-1].lower()
print(''.join(S))
N, A, B, C, D = map(int, input().split())
S = str(input())

new_D = [S_new[1: D], '#', S_new[D + 1: N]]
_ = ''.join(new_D)

import re
regex = r'##+'
matchobj = re.match(regex, _)
regex_dot = r'..+'
match_dot = re.match(regex_dot, _[D:])
if matchobj is not None and match_dot is None:
    print('No')
else:
    print('Yes')

### FIXED CODE ###

#これが一番できたやつ

import sys
N, A, B, C, D = map(int, input().split())
S = str(input())

if D > C:
    if '##' in S[B:D] or '##' in S[A:C]:
        print('No')
    else:
        print('Yes')
elif C > D:
    if '...' in S[B - 2: D + 1] and '##' not in S[A: C]:
        print('Yes')
    else:
        print('No')
print((lambda x:((x[2]-1) if x[4] == x[0] else x[2]),((x[3]-1) if x[4] == x[1] else x[3]) )(input().split()+list(map(int,input().split()))+input()))

### FIXED CODE ###

print(' '.join((lambda x:[str((x[2]-1)) if x[4] == x[0] else str(x[2]),str((x[3]-1)) if x[4] == x[1] else str(x[3])])(input().split()+list(map(int,input().split()))+[input()])))