Harryxun/stf_run huggingface dataset:
import sys
sys.setrecursionlimit(10000)
H, W = map(int, input().split())
S = []
white = 0
for i in range(H):
  s = str(input())
  S.append(s)
  white += s.count('.')
  
def main(h, w):
  global H
  global W
  global S
  global l
  tmp = []
  if h < H-1:
    if (S[h+1][w]=='.') and ([h+1, w] not in l):
      tmp.append([h+1, w])
  if w < W-1:
    if (S[h][w+1]=='.') and ([h, w+1] not in l):
      tmp.append([h, w+1])
  if 0 < h:
    if (S[h-1][w]=='.') and ([h-1, w] not in l):
      tmp.append([h-1, w])
  if 0 < w:
    if (S[h][w-1]=='.') and ([h, w-1] not in l):
      tmp.append([h, w-1])
  return tmp
    
cnt = 0
l = [[0, 0]]
tmp = [[0, 0]]
for i in range(10000):
  t = []
  for n in tmp:
    u = main(n[0], n[1])
    l += u
    t += u
  if [H-1, W-1] in t:
    ans = i+2
    break
  else:
    tmp = t
print(white-ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10000)
H, W = map(int, input().split())
S = []
white = 0
for i in range(H):
  s = str(input())
  S.append(s)
  white += s.count('.')
  
def main(h, w):
  global H
  global W
  global S
  global l
  tmp = []
  if h < H-1:
    if (S[h+1][w]=='.') and ([h+1, w] not in l):
      tmp.append([h+1, w])
  if w < W-1:
    if (S[h][w+1]=='.') and ([h, w+1] not in l):
      tmp.append([h, w+1])
  if 0 < h:
    if (S[h-1][w]=='.') and ([h-1, w] not in l):
      tmp.append([h-1, w])
  if 0 < w:
    if (S[h][w-1]=='.') and ([h, w-1] not in l):
      tmp.append([h, w-1])
  return tmp
    
cnt = 0
l = [[0, 0]]
tmp = [[0, 0]]
for i in range(10000):
  t = []
  for n in tmp:
    u = main(n[0], n[1])
    l += u
    t += u
  if t == []:
    ans = white+1
  elif [H-1, W-1] in t:
    ans = i+2
    break
  else:
    tmp = t
print(white-ans)
N,M,K=map(int,input().split())
MOD=998244353
X=M*pow(M-1,N-1,MOD)
#X=M*pow(M-1,N-1)
ans=X%MOD
i=1
'''
s=[]
a=1
for j in range(1,K+1):
  a*=N-j
  a=a//j
  s.append(a%MOD)
'''
for k in range(1,K+1):
  i*=(N-k)
  i=i//k
  #ans+=(i*X[-1-k])%MOD
  #i%=MOD
  ans+=((i%MOD)*X*pow(M-1,-k,MOD))%MOD
  #X=X//M-1
  #ans+=(i*X)%MOD
  ans%=MOD
print(ans%MOD)

### FIXED CODE ###

N,M,K=map(int,input().split())
mod=998244353

def cmb(n, r, mod):
  if ( r<0 or r>n ):
    return 0
  r = min(r, n-r)
  return g1[n] * g2[r] * g2[n-r] % mod

g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
  g1.append( ( g1[-1] * i ) % mod )
  inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
  g2.append( (g2[-1] * inverse[-1]) % mod )

ans=0
for k in range(K+1):
  ans+=(M*pow(M-1,N-1-k,mod)*cmb(N-1,k,mod))%mod
  ans=ans%mod
print(ans%mod)
from math import sqrt
n = int(input())
s = int(input())

if n < s:
  print(-1)
  import sys
  sys.exit()
if n == s:
  print(n+1)
  import sys
  sys.exit()

def f(b, n):
  if n < b:
    return n
  return f(b, n//b) + (n % b)

res = -1

for p in range(int(sqrt(n)), 0, -1):
  b = (n-s)//p + 1
  if f(b, n) == s:
    res = b
    break

for b in range(2, int(sqrt(n))+2):
  if f(b, n) == s:
    res = b
    break

print(res)

### FIXED CODE ###

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

if n < s:
  print(-1)
  import sys
  sys.exit()
if n == s:
  print(n+1)
  import sys
  sys.exit()

def f(b, n):
  if n < b:
    return n
  return f(b, n//b) + (n % b)

res = -1

for p in range(int(sqrt(n)), 0, -1):
  b = (n-s)//p + 1
  if b == 1:
    continue
  if f(b, n) == s:
    res = b
    break

for b in range(2, int(sqrt(n))+2):
  if f(b, n) == s:
    res = b
    break

print(res)
A, B, C, K = map(int, input().split())
lst = [1] * A + [0] * B + [-1] * C
print(sum(sorted(lst)[-K:]))

### FIXED CODE ###

A, B, C, K = map(int, input().split())
ans = min(A, K) - max(0, K - A - B)
print(ans)
a,b=map(int, input().split())
print(sort([a+b,a-b,a*b][-1]))

### FIXED CODE ###

a,b=map(int, input().split())
print(sorted([a+b,a-b,a*b])[-1])
n = int(input))
print((n + 1)*n/2)

### FIXED CODE ###

n = int(input())
print(int((n+1)*n/2))
import sys

while 1:
  str = sys.stdin.readline()
  if str=="0 0":
    break
  a , b = sorted(str.split(" "), key=int)
  print(a,b)

### FIXED CODE ###

import sys

while 1:
  a , b = sys.stdin.readline().split()
  if a == b == "0":
    break
  elif int(a) > int(b) :
    print(b,a)
  else :
    print(a,b)
s,w = map(int, input().split())
if s =< w:
  print("unsafe")
else:
  print("safe")

### FIXED CODE ###

s,w = map(int, input().split())
if s <= w:
  print("unsafe")
else:
  print("safe")
n, k = map(int, input().split())
s = str(input())

s0 = s[0]
a = [0]

s = s.replace('10', '1,0')
s = s.replace('01', '0,1')
s = s.split(',')
for i in s:
    a.append(a[-1] + len(i))

if len(a) == 2:
    print(a[1])
    exit()
ans = []
if s0 == '0':
    for i in range(2 * k,len(a)):
        ans.append(a[i] - a[i - (2 * k)])
else:
    for i in range(2 * k + 1,len(a)):
        ans.append(a[i] - a[i - (2 * k + 1)])

print(max(ans))

### FIXED CODE ###

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

a = [0]

ls = s.replace('10', '1,0')
ls = ls.replace('01', '0,1')
ls = ls.split(',')
for i in ls:
    a.append(a[-1] + len(i))

ans = 0
res = 0
if s[0] == '1':
    for i in range(len(a)):
        if i % 2 == 0:
            ans = a[min(i + 2 * k + 1, len(a) - 1)] - a[i]
        else:
            ans = a[min(i + 2 * k, len(a) - 1)] - a[i]

        res = max(res, ans)

else:
    for i in range(len(a)):
        if i % 2 == 0:
            ans = a[min(i + 2 * k, len(a) - 1)] - a[i]
        else:
            ans = a[min(i + 2 * k + 1, len(a) - 1)] - a[i]

        res = max(res, ans)

print(res)
class Graph():
	def __init__(self):
		self.adjacency_dict = {}
		self.weight = []

	def add_vartex(self, v):
		self.adjacency_dict[v] = []
		self.weight.append([])

	def add_edge(self, v1, v2, w):
		self.adjacency_dict[v1].append(v2)
		self.adjacency_dict[v2].append(v1)
		self.weight[v1].append(w)
		self.weight[v2].append(w)

	def get_vartexes(self):
		return self.adjacency_dict.keys()

    def get_edges(self, v):
        return self.adjacency_dict[v], self.weight[v]

    def printgraph(self):
    	return print(self.adjacency_dict)

n = int(input())

res = []
g = Graph()
for i in range(n):
	res.appned(-1)
	g.add_vartex(i)

for i in range(n-1):
	u, v, w = map(int, input().strip().split())
	g.add_edge(u - 1, v - 1, w % 2)


q = []
res[0] = 0
q.append(0)
while(len(q) > 0):
	v = q.pop()
	u_l, w_l = get_edges(v)
	for u, w = in zip(u_l, w_l):
		if res[u] != -1:
			continue
		res[u] = (res[v] + w) % 2
		q.appned(u)

for i in range(n):
	print(res[i])

### FIXED CODE ###

class Graph():
	def __init__(self):
		self.adjacency_dict = {}
		self.weight = []

	def add_vartex(self, v):
		self.adjacency_dict[v] = []
		self.weight.append([])

	def add_edge(self, v1, v2, w):
		self.adjacency_dict[v1].append(v2)
		self.adjacency_dict[v2].append(v1)
		self.weight[v1].append(w)
		self.weight[v2].append(w)

	def get_vartexes(self):
		return self.adjacency_dict.keys()

	def get_edges(self, v):
		return self.adjacency_dict[v], self.weight[v]

	def printgraph(self):
		return print(self.adjacency_dict)

n = int(input())

res = []
g = Graph()
for i in range(n):
	res.append(-1)
	g.add_vartex(i)

for i in range(n-1):
	u, v, w = map(int, input().strip().split())
	g.add_edge(u - 1, v - 1, w % 2)


q = []
res[0] = 0
q.append(0)
while(len(q) > 0):
	v = q.pop()
	u_l, w_l = g.get_edges(v)
	for u, w in zip(u_l, w_l):
		if res[u] != -1:
			continue
		res[u] = (res[v] + w) % 2
		q.append(u)

for i in range(n):
	print(res[i])
n, k = list(map(int, input().split()))
s = list(input())

start = []
end = []
flag = True

m = 0

for i in range(n):
    if flag and s[i] == "1":
        flag = False
        start.append(i)
    elif not flag and s[i] == "0":
        flag = True
        end.append(i-1)

if start[0] != 0:
    start = [0] + start
    end = [0] + end

end.append(n-1)

#print(start, end)

if len(end) <= k:
    print(n)
else:
    m = 0
    for i in range(len(end)-k):
        m = max(m, end[i+k] - start[i] + 1)
    print(m)

### FIXED CODE ###

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

start = []
end = []
flag = True

m = 0

for i in range(n):
    if flag and s[i] == "1":
        flag = False
        start.append(i)
    elif not flag and s[i] == "0":
        flag = True
        end.append(i-1)

if len(start) <= 0 or start[0] != 0:
    start = [0] + start
    end = [0] + end

end.append(n-1)

#print(start, end)

if len(end) <= k:
    print(n)
else:
    m = 0
    for i in range(len(end)-k):
        m = max(m, end[i+k] - start[i] + 1)
    print(m)
# 5 2
# 1 1 2 2 5
n, k = map(int, input().split())
a = list(map(int, input().split()))
countup = [0 for x in range(n)]
for i in a:
  countup[i] += 1

result = 0
f = list(filter(lambda x: x != 0, countup.sort()))

for i, v in enumerate(f):
 if i >= len(f) - k:
    print(result)
    break
 result += v


### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
countup = [0 for x in range(n + 1)]
for i in a:
  countup[i] += 1

countup.sort()
result = 0
f = list(filter(lambda x: x != 0, countup))

for i, v in enumerate(f):
 if i >= len(f) - k:
    print(result)
    break
 result += v
import itertools
import heapq
import sys
import functools
import operator
import numpy as np
input = sys.stdin.readline
#-------------
n,k = map(int,input().split())
a = list(map(int,input().split()))
#-------------
a_high = sorted(a , reverse=True)
a_high_k = a_high[:k]
a_low = sorted(a)
a_low_k = a_low[:k]
a_new = a_high_k + a_low_k
D = [[a_new[i+j-k] for j in range(k)] for i in range(2k)]
A = (functools.reduce(operator.mul,D[_]) for _ in range(len(D)))
l_max = max(A)
waru = 10**9 + 7
print(l_max % waru)

### FIXED CODE ###

import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod
 
print(ans)
r,g,b = map(int, input().spilit())
ans = r*100+10*g+b

if ans%4==0:
  print('YES')
else:
  print('NO')

### FIXED CODE ###

r,g,b = map(int, input().split())
ans = 100*r+10*g+b

if ans%4==0:
  print('YES')
else:
  print('NO')
def resolve():
    from scipy.sparse.csgraph import floyd_warshall
    import numpy as np
    import sys
    input = sys.stdin.readline
    n, m, l = map(int, input().split())
    inf = 10 ** 20
    ar = [[0] * n for _ in range(n)]
    for _ in range(m):
        a, b, c = map(int, input().split())
        ar[a - 1, b - 1] = c
        ar[b - 1, a - 1] = c
    x = floyd_warshall(ar)
    br = [[0] * n for _ in range(n)]
    for i in range(n):
        for j in range(i + 1, n):
            if x[i, j] <= l:
                br[i, j] = 1
                br[j, i] = 1
    y = floyd_warshall(br)
    q = int(input())
    for _ in range(q):
        s, t = map(int, input().split())
        p = y[s - 1, t - 1]
        print(int(p) - 1 if p < inf else -1)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

def resolve():
    from scipy.sparse.csgraph import floyd_warshall
    import numpy as np
    import sys
    input = sys.stdin.readline
    n, m, l = map(int, input().split())
    inf = 10 ** 20
    ar = np.zeros((n, n))
    for _ in range(m):
        a, b, c = map(int, input().split())
        ar[a - 1, b - 1] = c
        ar[b - 1, a - 1] = c
    x = floyd_warshall(ar)
    br = np.zeros((n, n))
    for i in range(n):
        for j in range(i + 1, n):
            if x[i, j] <= l:
                br[i, j] = 1
                br[j, i] = 1
    y = floyd_warshall(br)
    q = int(input())
    for _ in range(q):
        s, t = map(int, input().split())
        p = y[s - 1, t - 1]
        print(int(p) - 1 if p < inf else -1)


if __name__ == "__main__":
    resolve()
import numpy as np

H, W = map(int, input().split())
field = []
for i in range(H):
    field.append(list(map(int, input().split())))

urdl = [(0,-1,0), (1,0,1), (0,1,2), (-1,0,3)]

move_records = []

if H != 1 or W != 1:
    for i in range(H):
        for j in range(W):
            if i == H-1 and j == W-1:
                continue
            if field[i][j] % 2 == 0:
                continue
            adj_values = np.array([-1, -1, -1, -1])
            if not i == 0:
                adj_values[0] = field[i-1][j]
            if not j == W-1:
                adj_values[1] = field[i][j+1]
            if not i == H-1:
                adj_values[2] = field[i+1][j]
            if not j == 0:
                adj_values[3] = field[i][j-1]

            if sum(adj_values[adj_values != -1] % 2) == 0:
                h,w,k = urdl[np.where(adj_values != -1)[0][0]]
                field[i][j] -= 1
                field[i+h][j+w] += 1
                
            else:
                for w,h,k in urdl:
                    if adj_values[k] == -1:
                        continue

                    if adj_values[k] % 2 != 0:
                        field[i][j] -= 1
                        field[i+h][j+w] += 1
                        break
            
            move_records.append([i+1,j+1,i+h+1,j+w+1])

M = len(move_records)
print(M)
for i in range(M):
    print('{} {} {} {}'.format(move_records[i][0],
                               move_records[i][1],
                               move_records[i][2],
                               move_records[i][3]))

### FIXED CODE ###

import numpy as np
H, W = map(int, input().split())
field = []
for i in range(H):
    field.append(list(map(int, input().split())))
rd = [(0,1,0), (1,0,1)]
move_records = []
if H != 1 or W != 1:
    for i in range(H):
        for j in range(W):
            if field[i][j] % 2 == 0:
                continue
            if i == H-1 and j == W-1:
                continue
            if i == H-1 and j == W-2:
                # import ipdb; ipdb.set_trace()
                if (field[H-1][W-1] + field[H-1][W-2]) % 2 != 0:
                    continue
                else:
                    field[H-1][W-2] -= 1
                    field[H-1][W-1] += 1
                    move_records.append([i+1,j+1,i+1,j+2])
            elif j != W-1:
                field[i][j] -= 1
                field[i][j+1] += 1
                move_records.append([i+1,j+1,i+1,j+2])
            else:
                field[i][j] -= 1
                field[i+1][j] += 1
                move_records.append([i+1,j+1,i+2,j+1])
M = len(move_records)
print(M)
for i in range(M):
    print('{} {} {} {}'.format(move_records[i][0],
                               move_records[i][1],
                               move_records[i][2],
                               move_records[i][3]))
N = int(input())
a = input().split()
b = []
for i in range(len(a)):
	if i % 2 == 1:
		b.insert(0, a[i])
	else:
		b.append(a[i])
if N % 2 == 1:
	b = b.reverse()
print(b)
line = " ".join(b)
print(line)

### FIXED CODE ###

N = int(input())
a = input().split()
b = [""] * N
b1 = [a[i] for i in range(len(a)) if i % 2 == 1][::-1]
b2 = [a[i] for i in range(len(a)) if i % 2 == 0]
b = b1 + b2
if N % 2 == 1:
	b = b[::-1]
line = " ".join(b)
print(line)
a, b = input()
num_a = int(a)
num_b = int(b)
dif = num_a - num_b*2
if dif >= 0:
  print(dif)
else:
  print(0)

### FIXED CODE ###

a, b = input().split()
num_a = int(a)
num_b = int(b)
dif = num_a - num_b*2
if dif >= 0:
  print(dif)
else:
  print(0)
n=int(input())
s=[input() for _ in range(n)]
ans=0
dic=dict()
for i in range(n):
    lst=sorted(list(s[i]))
    if dic[lst]:
      dic[lst]=1
    else: dic[lst]+=1
for i in dic.values():
  ans+=i*(i-1)

    
print(ans)


### FIXED CODE ###

n=int(input())
ans=0
dic={}
for _ in range(n):
    s=input()
    s=sorted(s)
    s=''.join(s)
    if not s in dic.keys():
      dic[s]=1
    else: dic[s]+=1
for i in dic.values():
  ans+=i*(i-1)//2


print(ans)
import math
import sys 
input = sys.stdin.readline
N = int(input())
x = list(map(int,input().split()))

d = [0]*(N-1)
for i in range(N-1):
    d[i] = x[i+1]-x[i]
    d[i] %= 10**9+7

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

ans=0
x=0

def pow_r(x, n):
    """
    O(log n)
    """
    x %= mod
    if n == 0:  # exit case
        return 1
    if n % 2 == 0:  # standard case ① n is even
        return pow_r(x ** 2, n // 2)%mod
    else:  # standard case ② n is odd
        return (x * (pow_r(x ** 2, (n - 1) // 2)))%mod

for i in range(N-1):
    #(i+1)**(10**9+5)を計算してyへ
    y = pow_r(i+1,k)
    #x+= kaijou//(i+1))%(10**9+7)
    x += (kaijou*y)%mod
    ans+= (d[i]*x)%mod

print(ans%mod)

### FIXED CODE ###

import math
import sys 
input = sys.stdin.readline

N = int(input())
x = list(map(int,input().split()))
mod = 10**9+7

d = [0]*(N-1)

for i in range(N-1):
    d[i] = x[i+1]-x[i]
    d[i] %= mod


kaijou = 1
for i in range(1,N):
    kaijou *= i
    kaijou %= mod


ans=0
x=0

def pow_r(x, n):
    """
    O(log n)
    """
    x %= mod
    if n == 0:  # exit case
        return 1
    if n % 2 == 0:  # standard case ① n is even
        return pow_r(x ** 2, n // 2)%mod
    else:  # standard case ② n is odd
        return (x * (pow_r(x ** 2, (n - 1) // 2)))%mod

for i in range(N-1):
    #(i+1)%(mod-2)を計算してyへ
    y = pow_r(i+1,mod-2)
    #x+= kaijou//(i+1))%(10**9+7)
    x += kaijou*y
    ans += d[i]*x
    ans %= mod

print(ans)
n, m, x, y = map(int, input().split())
xs = max(list(map(int, input().split())).append(x))
ys = max(list(map(int, input().split())).append(y))
print('No War' if xs < ys else 'War')

### FIXED CODE ###

n,m,x,y = map(int,input().split())
xs = max(list(map(int,input().split())))
ys = min(list(map(int,input().split())))
ans = 'War'
if xs+1 <= ys:
    for i in range(xs+1,ys+1):
        if x < i <= y:
            ans = 'No War'
            break
print(ans)
N = int(input())
W = [ [] for _ in range(N) ]
dist = [-1] * N
dist[0] = 0

for i in range(N-1):
    u,v,w = map(int,input().split(" "))
    W[u-1].append(( v-1, w))
    W[v-1].append((u-1, w))

def dfs(cur, d, prev):
    for v, w in W[cur]:
        if v == prev:
            continue
        dist[v] = d + w
        dfs(v, dist[v], cur)
    

dfs(0, 0, -1)

for ans in dist:
    print(ans % 2)



### FIXED CODE ###

N = int(input())
W = [ [] for _ in range(N) ]
used = [-1] * N

for i in range(N-1):
    u,v,w = map(int,input().split(" "))
    W[u-1].append(( v-1, w))
    W[v-1].append((u-1, w))

used[0] = 0
lst = [ 0 ]
while len(lst) != 0:
    newList = []
    for v in lst:
        for (nx, w) in W[v]:
            if used[nx] == -1:
                if w % 2 == 0:
                    used[nx] = used[v]
                else:
                    used[nx] = (used[v] + 1) % 2
                newList.append(nx)
    lst = newList

for ans in used:
    print(ans)
n = int(input())
stocks = [int(x) for x in input().split()]
mymoney = 1000
mystock = 0

for i in range(0,len(stocks)-1):     # コメントアウト部分はデバッグ用コード
      #print(stocks[i],stocks[i+1],end=":")
      if stocks[i] < stocks[i+1]:    # 明日の方が株価が高くなる場合は、今日のうちに株を買えるだけ買う
            #print("buying",end=" ")
            mystock = mymoney//stocks[i]
            mymoney = mymoney%stocks[i]
      elif stocks[i] >= stocks[i+1]:  # 明日の方が株価が安くなる場合には、今日のうちに手持ちの株を売却
            #print("selling",end=" ")
            mymoney += mystock*stocks[i]
            mystock = 0
      #print(mymoney,mystock)

i += 1
mymoney += mystock * stocks[i]      # 最終日に手持ちの株をすべて売却して現金化
mystock = 0

print(mymoney)

### FIXED CODE ###

score = [1800,1600,1400,1200,1000, 800, 600, 400]
ranks = [   1,   2,   3,   4,   5,   6,   7,   8]

x = int(input())
i = 0

while(x < score[i]):
      i += 1

print(ranks[i])
import fraction

a,b,c= map(int, input().split())
d= int(fraction.gcd(a,b))
if c==1:
  print(d)
else:
  arr=[]
  for i in range(1,d):
    if(d%i == 0):
      arr.append(i)
  print(arr[-(c-1)])

### FIXED CODE ###

def gcd(x, y):
    if y == 0:
        return x
    else:
        return gcd(y, x % y)

a,b,c= map(int, input().split())
d= int(gcd(a,b))
if c==1:
  print(d)
else:
  arr=[]
  for i in range(1,d):
    if(d%i == 0):
      arr.append(i)
  print(arr[-(c-1)])
n,k=map(int,input().split())
mod=10**9+7
ans=0
for i in range(k,n+2):
  ans+=((2*n-i+1)*i//2-i*(i-1)//2+1)%mod
print(ans)

### FIXED CODE ###

import math
r=int(input())
print(2*r*math.pi)
#input
N = int(input())
X = [[input().split(), i + 1] for i in range(N)]
X = sorted(X, key = lambda x:(x[0][0], int(-x[0][1])) )

for i in range(N):
    print(X[i][0])

### FIXED CODE ###

N = int(input())
X = [[input().split(), i + 1] for i in range(N)]
X = sorted(X, key = lambda x:(x[0][0], -int(x[0][1])))
for i in range(N):
	print(X[i][1])
# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

# a, bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

# a, bの最小公倍数
def lcm(a, b):
    return a * b / gcd(a,b)

# リストnumbers最小公倍数
def lcmlist(numbers):
    a = numbers[0]
    for i in range(len(numbers)):
        a = lcm(a, numbers[i])
    return int(a)

#### START
n = int(input())
t = [int(input()) for i in range(n)]

print(lcmlist(t))


### FIXED CODE ###

# https://qiita.com/_-_-_-_-_/items/34f933adc7be875e61d0
# abcde	s=input()	s='abcde'
# abcde	s=list(input())	s=['a', 'b', 'c', 'd', 'e']
# 5(1つだけ)	a=int(input())	a=5
# 1 2	| x,y = map(int,input().split())   |	x=1,y=2
# 1 2 3 4 5 ... n 　	li = input().split()	li=['1','2','3',...,'n']
# 1 2 3 4 5 ... n 　	li = list(map(int,input().split()))	li=[1,2,3,4,5,...,n]
# FFFTFTTFF 　	li = input().split('T')	li=['FFF', 'F', '', 'FF']

# INPUT
# 3
# hoge
# foo
# bar
# ANSWER
# n=int(input())
# string_list=[input() for i in range(n)]


from collections import defaultdict, Counter
import math
from bisect import bisect_left, bisect_right
import numpy as np

# a, bの最大公約数
def gcd(a,b):
    if b == 0:
        return a
    else:
        return gcd(b,a%b)

# a, bの最小公倍数
def lcm(a, b):
    return int(a * b) // gcd(a,b)

# リストnumbers最小公倍数
def lcmlist(numbers):
    a = numbers[0]
    for i in range(1, len(numbers)):
        a = lcm(a, numbers[i])
    return int(a)

#### START
n = int(input())
t = [int(input()) for i in range(n)]

print(lcmlist(t))
N = int(input())
def dfs(s):
    if int(s) > N:
        return 0
    else:
        if '7' in s and '5' in s and '3' in s:
            ret = 1
        else:
            ret = 0
        for c in '357':
            ret += dfs(s + c)
        return ret
print(def("0"))

### FIXED CODE ###

N = int(input())
def dfs(s):
    if int(s) > N:
        return 0
    else:
        if '7' in s and '5' in s and '3' in s:
            ret = 1
        else:
            ret = 0
        for i in '357':
            ret += dfs(s + i)
        return ret
print(dfs("0"))
def main():
    N,M = int(input().split())

    print((1900*M+100*(N-M))*2**M)

if __name__ == '__main__':
    main()

### FIXED CODE ###


def main():
    N,M = map(int,input().split())

    print((1900*M+100*(N-M))*2**M)

if __name__ == '__main__':
    main()
a,b,c = map(int,input().split())
print(a*b*/2)

### FIXED CODE ###

a,b,c = map(int,input().split())
print(int(a*b/2))