Harryxun/stf_run huggingface dataset:
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

MOD = 10 ** 9 + 7

A.sort()

ans = A[K-1] - A[-K]

tmp2 = 1
tmp3 = K

a = 1

for k in range(K, N):
    a = a * tmp3 / tmp2
    ans += a * (A[k] - A[N-k-1])
    if ans > MOD:
        ans %= MOD
    tmp2 += 1
    tmp3 += 1

print(int(ans))


### FIXED CODE ###

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

mod = 10 ** 9 + 7

f = [i for i in range(N+1)]
for i in range(2, N+1):
    f[i] *= f[i-1]
    f[i] %= mod
f[0] = 1

q = K - 1
fk = pow(f[q], mod - 2, mod)

total = 0

for i in range(N - K + 1):
    p = N - i - 1

    c = (f[p] * fk * pow(f[p-q], mod-2, mod)) % mod
    total += c * (A[-1 - i] - A[i])
    total %= mod

print(total)
a,b=map(int,input(),split())
if a<=8 and b<=8:
  print("Yay!")
else:
  print(":(")

### FIXED CODE ###

a,b=map(int,input().split())
if a<=8 and b<=8:
  print("Yay!")
else:
  print(":(")
#import sys
from heapq import heapify, heappushpop
from heapq import _heapify_max as heapify_max, _siftup_max


def heappushpop_max(heap, item):
    if heap and heap[0] > item:
        item, heap[0] = heap[0], item
        _siftup_max(heap, 0)
    return item


fin = sys.stdin.readline
N, *a_list = map(int, open(0).read().split())

left_pq = a_list[:N]
right_pq = a_list[2 * N:]
heapify(left_pq)
heapify_max(right_pq)

left_sum = [sum(left_pq)]
right_sum = [sum(right_pq)]
for k in range(N, 2 * N):
    left_item = a_list[k]
    right_item = a_list[-k - 1]
    left_sum.append(left_sum[-1] - heappushpop(left_pq, left_item) + left_item)
    right_sum.append(right_sum[-1] - heappushpop_max(right_pq, right_item) + right_item)

max_sum = max(map(sum, zip(left_sum, [-item for item in right_sum[::-1]])))
print(max_sum)


### FIXED CODE ###

import sys
fin = sys.stdin.readline
from heapq import heappop, heappush, heapify

N = int(fin())
a_list = [int(elem) for elem in fin().split()]
left, right = a_list[:N], a_list[N:]

thrown_away = [False] * (2 * N)
discarded_items = []

# initialize
right_sum = sum(right)
for i, item in enumerate(right):
    if i < N:
        heappush(discarded_items, (item, i))
        thrown_away[i] = True
        right_sum -= item
    else:
        if item > discarded_items[0][0]:
            old_item, old_idx = heappop(discarded_items)
            thrown_away[old_idx] = False
            heappush(discarded_items, (item, i))
            thrown_away[i] = True
            right_sum += old_item - item


# move partitions and calculate a global maximum
left_sum = sum(left)
heapify(left)
moved_to_left = [False] * (2 * N + 1)
# dirty trick
moved_to_left[-1] = True
max_score = left_sum - right_sum
for i, item in enumerate(right[:N]):
    if not thrown_away[i]:
        # update right
        updated_idx = -1
        while moved_to_left[updated_idx] == True:
            updated_item, updated_idx = heappop(discarded_items)
        right_sum += updated_item - item
        thrown_away[updated_idx] = False
    else:
        # want to update discarded_items
        moved_to_left[i] = True
    # update left
    if item > left[0]:
        old_item = heappop(left)
        heappush(left, item)
        left_sum += item - old_item
    max_score = max(max_score, left_sum - right_sum)

print(max_score)
N, M, X, Y =map( int, input()split())
x = list(map( int, input().split()))
y = list(map( int, input().split()))

x = sorted(x)
y = sorted(y)

for i in range(X + 1, Y + 1):
  if( x[N-1] < i <= y[0]):
    print('No War')
    exit()
    
  else:
    print('war')
    break

### FIXED CODE ###

N, M, X, Y =map( int, input().split())
x = list(map( int, input().split()))
y = list(map( int, input().split()))
 
x = sorted(x)
y = sorted(y)
 
for i in range(X + 1, Y + 1):
  if( x[N-1] < i <= y[0]):
    print('No War')
    exit()
    
print('War')
n = input()
num = int(input())
len = len(n)
sn = 0

for i in range(len):
    sn += n[i]

if n % sn == 0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

n = input()
num = int(n)
len = len(n)
sn = 0

for i in range(len):
    sn += int(n[i])

if num % sn == 0:
    print("Yes")
else:
    print("No")
s=input()
t=input()
f=1
tmp=0
if len(s)<len(t):
  print("UNRESTORABLE")
  exit()
n=len(s)
m=len(t)
for i in range(n-m+1):
  x=s[i:i+m]
  for j in range(m+1): #
    if j==m:
      print((s[:i]+t+s[i+m:]).replace("?","a"))
    if x[j]=="?":
      continue
    elif x[j]!=t[j]:
      break
print("UNRESTORABLE")

### FIXED CODE ###

s=input()
t=input()
if len(s)<len(t):
  print("UNRESTORABLE")
  exit()
n=len(s)
m=len(t)
for i in range(n-m,-1,-1):
  x=s[i:i+m]
  for j in range(m+1): #
    if j==m:
      print((s[:i]+t+s[i+m:]).replace("?","a"))
      exit()
    if x[j]=="?":
      continue
    elif x[j]!=t[j]:
      break
print("UNRESTORABLE")
import math

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

h1 = b - x/a/a
h2 = 2*x/(a*b)


if b*a*a/2 <= x:
    radians = math.atan(a/2/h1)
    print(90 - math.degrees(radians))
else:
    radians = math.atan(h2/b)
    print(90 - math.degrees(radians))
    


### FIXED CODE ###

import math

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

h1 = b - x/a/a
h2 = 2*x/(a*b)


if x == a*a*b:
    print(0)
elif b*a*a/2 <= x:
    radians = math.atan(a/2/h1)
    print(90 - math.degrees(radians))
else:
    radians = math.atan(h2/b)
    print(90 - math.degrees(radians))
x=int(input())
a=0
while true
    for b in range(10**3):
        if a**5-b**5==x:
            print(a,b)
            exit()
        elif a**5+b**5==x:
            print(a,-b)
            exit()
        elif -a**5+b**5==x:
            print(-a,-b)
            exit()
    a+=1

### FIXED CODE ###

x=int(input())
x5=[i**5 for i in range(0,10**3+1,1)]
for i in range(len(x5)):
    for j in range(len(x5)):
        if x5[i]-x5[j]==x:
            print(i,j)
            exit()
        if -x5[i]+x5[j]==x:
            print(-i,-j)
            exit()
        if x5[i]+x5[j]==x:
            print(i,-j)
            exit()
        if -x5[i]-x5[j]==x:
            print(-i,j)
            exit()
import math

def combination_count(n,k):
    s = math.factorial(n)
    t = math.factorial(k)
    u = math.factorial(n-k)
    
    return s//(t*u)
    
n,k = map(int,input().split())
mod = 10**9 + 7

for i in range(1,k+1):
    x = combination_count(n-k+1, i) 
    y = combination_count(k-1, i-1)
    z = (x*y) % mod
    print(z)

### FIXED CODE ###

import math

def combination_count(n,k):
    if k < 0 or k > n:
        return 0
    if n == 0 or k == 0:
        return 1
    
    s = math.factorial(n)
    t = math.factorial(k)
    u = math.factorial(n-k)
    
    return s//(t*u) 
    
n,k = map(int,input().split())
mod = 10**9 + 7

for i in range(1,k+1):
    x = combination_count(n-k+1, i) 
    y = combination_count(k-1, i-1)
    z = (x*y) % mod
    print(z)
import math
n=int(input())
m=math.sqrt(n)//1
for i in range(m):
  if n%(m-i)==0:
    print(m-i+(n//(m-i)))
    break
    

### FIXED CODE ###

import math
n=int(input())
p=math.sqrt(n)
def x(g):
  a=g
  c=0
  while a>=0:
    a-=1
    c+=1
  return c-1

m=x(p)
for i in range(m):
  if n%(m-i)==0:
    print(m-2-i+(n//(m-i)))
    break
a=int(input())
b=int(input())
k=int(input())

c=b-a+1

a1=[]
b1=[]

for i in range(k):
    a1.append(a+i)
    b1.append(b-i)

if c>2*k-1:
    for i in range(k):
        print(a1[i])
    for i in range(k):
        print(b1[k-i-1])

else:
    for i in range(a,b+1):
        print(i)



### FIXED CODE ###

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

c=b-a+1

a1=[]
b1=[]

for i in range(k):
    a1.append(a+i)
    b1.append(b-i)

if c>2*k-1:
    for i in range(k):
        print(a1[i])
    for i in range(k):
        print(b1[k-i-1])

else:
    for i in range(a,b+1):
        print(i)
N = int(input())

ans = 0.0
for i in range(N):
    x,u = map(str, input().split())
    x = float(x)
    if u == 'JPY':
        ans += x
    else:
        ans += x*(380000)

print(ans)
mac:119 ryonakay$

### FIXED CODE ###

N = int(input())

ans = 0.0
for i in range(N):
    x,u = map(str, input().split())
    x = float(x)
    if u == 'JPY':
        ans += x
    else:
        ans += x*(380000)

print(ans)
N=int(input())
count=0
a=list(map(int,input().split()))
w=[]
s=[]
num=[0]*100000000

for i in range(N):
  w.append(1+i+a[i])
  s.append(1+i-a[i])
  num[1+i-a[i]+50000000]+=1
for i in range(N):
  count+=num[w[i]+50000000]
print(count)

### FIXED CODE ###

N=int(input())
count=0
a=list(map(int,input().split()))
w=[]
s=[]
num=[0]*N
maxi=max(a)
for i in range(N):
  s.append(1+i-a[i])
  if 1+i+a[i]<N:
    num[1+i+a[i]]+=1
for i in range(N):
  if s[i]>=0:
    count+=num[s[i]]
print(count)
n = int(input())
a = list(map(int, input().split()))
aa = 0

for i in range(N):
    aa = aa ^ a[i]
    
if aa == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

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

for i in range(n):
  aa = aa ^ a[i]

if aa == 0:
  print("Yes")
else:
  print("No")
import numpy as np
N = int(input())
m = np.zeros((N + 1, N + 1), dtype='int64')
for _ in range(N - 1):
    u, v = sorted(map(int, input().split()))
    np.add(m[:u + 1, v:], 1,out=m[:u + 1, v:])
ans = 0
for L in range(1, N + 1):
    for R in range(L, N + 1):
        ans += R - L + 1 - m[L, R]
print(ans)


### FIXED CODE ###

N = int(input())
M = 0
for _ in range(N - 1):
    u, v = sorted(map(int, input().split()))
    M += u * (N - v + 1)
V = 0
for r in range(1, N + 1):
    V += r * (N - r + 1)
print(V - M)
# 何本の数直線上にあるかを求める　1<=ans<=n-1
# 少なくとも2点を通る直線のみ調べれば良い
n=int(input())
xy=[list(map(int,input().split())) for _ in range(n)]
xy.sort(key=lambda x:(x[0],x[1]))
# print(xy)
if n<=2:
    print(1)
else:
    diff=[]
    for i in range(n):
        for j in range(i):
            diff.append((xy[i][0]-xy[j][0],xy[i][1]-xy[j][1]))

    ans=[]
    # print(set(diff))
    for p,q in set(diff):
        intercept=[]
        for i in range(n):
            qxHIKUpy=q*xy[i][0]-p*xy[i][1]
            intercept.append(qxHIKUpy)
        # print(q,'x-',p,'y=',intercept)
        intercepts=sorted(enumerate(intercept),key=lambda x:x[1])
        intercept=set(intercept)
        # print(intercepts)
        i=0
        cnt=len(intercept)
        for b in intercept:
            x=0
            if intercepts[i][1]==b:
                x=xy[intercepts[i][0]][0]
            i+=1
            while intercepts[i][1]==b:
                if x+p!=xy[intercepts[i][0]][0]:
                    cnt+=1
                x=xy[intercepts[i][0]][0]
                i+=1
                if i==n:
                    break

        ans.append(cnt)
    # print(ans)
    print(min(ans))


### FIXED CODE ###

n=int(input())
xy=[list(map(int,input().split())) for _ in range(n)]
xy.sort(key=lambda x:(x[0],x[1]))
# print(xy)
if n<=2:
    print(1)
else:
    diff=[]
    for i in range(n):
        for j in range(i):
            diff.append((xy[i][0]-xy[j][0],xy[i][1]-xy[j][1]))

    ans=[]
    # print(set(diff))
    for p,q in set(diff):
        cnt=n
        for i in range(n):
            for j in range(i):
                if xy[i][0]-xy[j][0]==p and xy[i][1]-xy[j][1]==q:
                    cnt-=1
        ans.append(cnt)
    print(min(ans))
n=input()
if int(n[5]+n[6]) >=5:
  print('TBD'):
else:
  print('Heisei')

### FIXED CODE ###

n=input()
if int(n[5]+n[6]) >=5:
  print('TBD')
else:
  print('Heisei')
import sys
from collections import Counter

sys.stdin = open('b1.in')


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


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


yes, no = 'Yes', 'No'


def solve(n, a):
    s = set(a)
    c = Counter(a)
    if len(s) == 1:
        a = list(s)[0]
        n_colors = a + 1
        if n_colors == n:
            return yes
        n_colors = a
        if 2 * n_colors <= n:
            return yes
    if len(s) == 2:
        a, b = sorted(s)
        if a + 1 == b:
            n_colors = b
            appear_once = c[a]
            appear_twice_or_more = n_colors - appear_once
            if appear_once < n_colors:
                if c[b] >= 2 * appear_twice_or_more:
                    return yes
    return no

n = read_int()
a = read_int_list()
res = solve(n, a)
print(res)



### FIXED CODE ###

import sys
from collections import Counter

# sys.stdin = open('b1.in')


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


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


yes, no = 'Yes', 'No'


def solve(n, a):
    s = set(a)
    c = Counter(a)
    if len(s) == 1:
        a = list(s)[0]
        n_colors = a + 1
        if n_colors == n:
            return yes
        n_colors = a
        if 2 * n_colors <= n:
            return yes
    if len(s) == 2:
        a, b = sorted(s)
        if a + 1 == b:
            n_colors = b
            appear_once = c[a]
            appear_twice_or_more = n_colors - appear_once
            if appear_once < n_colors:
                if c[b] >= 2 * appear_twice_or_more:
                    return yes
    return no

n = read_int()
a = read_int_list()
res = solve(n, a)
print(res)
n=int(input())
li = list(map(int,input().slice()))
cnt=0
for i in range(1,n-1):
    if li[i-1]<li[i]<li[i+1]:
        cnt+=1
    elif li[i-1]>li[i]>li[i+1]:
        cnt+=1
print(cnt)

### FIXED CODE ###

s=list(input())
s.sort()
if s[0] == s[1] and s[2]==s[3] and s[0] != s[2]:
    print("Yes")
else:
    print("No")
ls = map(int,input().split())
K = int(input())
ls.sort()
ans = ls[0]+ls[1]+ls[2]*2**K
print(ans)

### FIXED CODE ###

ls = list(map(int,input().split()))
K = int(input())
ls.sort()
ans = ls[0]+ls[1]+ls[2]*2**K
print(ans)
A,B,C,D = map(int, input().split())
# A = int(input())
# B = int(input())
# C = int(input())
# X = input()
L = A + B
R = C + D
print("Left" if L > R else "Balanced" if L = R else "Right")

### FIXED CODE ###

A,B,C,D = map(int, input().split())
# A = int(input())
# B = int(input())
# C = int(input())
# X = input()
L = A + B
R = C + D
print("Left" if L > R else "Balanced" if L == R else "Right")
ABC = input().split()
A=ABC[0]
B=ABC[1]
C=ABC[2]


count = 100
N=0


for index in range(count+1):
    if (A*N-C)%B ==0:
        print("Yes")
        break
    elif index == (count):
        print("NO")
    else:
        N+=1

### FIXED CODE ###

ABC = input().split()
A=int(ABC[0])
B=int(ABC[1])
C=int(ABC[2])


count = A*B


for index in range(count+1):
    if (A*index)%B==C:
        print("YES")
        break
    elif index ==count:
        print("NO")
input(S)
a=S.count(o)
y=700+100*a
print(y)

### FIXED CODE ###

S=input()
a=S.count('o')
y=700+100*a
print(y)
from collections import deque

def main():
    h,w=map(int,input().split())
    maze=[list(input()) for i in range(h)]
    d=[[float("inf")]*w for i in range(h)]
    que=deque([])
    dx=[1,0,-1,0]
    dy=[0,1,0,-1]
    for i in range(h):
        for j in range(w):
            if maze[i][j]=="#":
                que.append((i,j))           
                d[i][j]=0
    while que:
        p=que.popleft()
        for i in range(4):
            nx=p[0]+dx[i]
            ny=p[1]+dy[i]
            if 0<=nx and nx<h and 0<=ny and ny<w and maze[nx][ny]!="#" and d[nx][ny]==float("inf"):
                d[nx][ny]=d[p[0]][p[1]]+1
                que.append((nx,ny))  
    ans=0
    for i in range(h):
        ans=max(ans,d[i])
    return ans
if __name__=='__main__':
    print(main())




### FIXED CODE ###

from collections import deque

def main():
    h,w=map(int,input().split())
    maze=[list(input()) for i in range(h)]
    d=[[-1]*w for i in range(h)]
    que=deque([])
    dd=((1,0),(0,1),(-1,0),(0,-1))
    for i in range(h):
        for j in range(w):
            if maze[i][j]=="#":
                que.append((i,j))           
                d[i][j]=0
    ans=0
    while que:
        p=que.popleft()
        ans=d[p[0]][p[1]]
        for dx,dy in dd:
            nx=p[0]+dx
            ny=p[1]+dy
            if 0<=nx and nx<h and 0<=ny and ny<w and maze[nx][ny]!="#" and d[nx][ny]==-1:
                d[nx][ny]=ans+1
                que.append((nx,ny))  
    return ans
if __name__=='__main__':
    print(main())
n=int(input())
s=input()
ans=s.count("R")*s.count("G")*s.count("B")
for j in range(n):
  for i in range(j):
    if (k:=2*j-i)<n:
      if s[i]!=s[k]!=s[j]!=s[i]:
        ans-=1   
print(ans)

### FIXED CODE ###

# coding: utf-8
# Your code here!
from collections import Counter
def MI():return map(int,input().split())
def LI():return list(MI())

n=int(input())
s=input()
ans=s.count("R")*s.count("G")*s.count("B")


for j in range(n):
    jj=s[j]
    for i in range(j):
        k=2*j-i
        if not j<=k<=n-1:
            continue
        ii=s[i]
        kk=s[k]
        if jj!=ii and jj!=kk and ii!=kk:
            ans-=1

print(ans)
import numpy as np
import sys
temp = input().split()
N = int(temp[0])
M = int(temp[1])
A = []
B = []
def change(n):
  if(n=='#'):
    return True;
  return False;

for i in range(N):
  temp = input()
  A.append(list(map(change, temp)))
for i in range(M):
  temp = input()
  B.append(list(map(change, temp)))
A = np.array(A)
B = np.array(B)

for i in range(N-M+1):
  for j in range(N-M+1):
    if (B== A[i:M+j, i:M+j]).all():
      print("Yes")
      sys.exit()

print("No")


### FIXED CODE ###

import numpy as np
import sys
temp = input().split()
N = int(temp[0])
M = int(temp[1])
A = []
B = []
check = False
def change(n):
  if(n=='#'):
    return True;
  return False;

for i in range(N):
  temp = input()
  A.append(list(map(change, temp)))
for i in range(M):
  temp = input()
  B.append(list(map(change, temp)))
A = np.array(A)
B = np.array(B)

for i in range(N-M+1):
  for j in range(N-M+1):
    if (B== A[i:M+i, j:M+j]).all():
      check = True
      break
  if check:
    break

if check:
  print("Yes")
else:
  print("No")
import decimal
decimal.getcontext().prec = 4
A, B = map(int, input().split())
 
A_price = (A / 8) * 100
 
B_price = (B / 10) * 100
 
if int(A_price) == int(B_price):
	print(int(A_price))
else:
	X = (int(A_price) / 100) * 10
    Y = (int(B_price) / 100) * 8
    if B == int(X):
    	print(int(A_price))
    elif A == int(Y):
    	print(int(B_price))
    else:
    	print(-1)

### FIXED CODE ###

A,B = map(int, input().split())
num = 0
while num < 1011:
  num += 1
  X = num * 0.08
  if int(X) == A:
    Y = num * 0.1
    if int(Y) == B:
      print(num)
      break
    else:
      pass
  elif num == 1010:
    print(-1)
    break
  else:
    pass
e = sorted(map(int, input().split()))
print("yes" if e[0] == e[1] and e[2] == e[3])

### FIXED CODE ###

e = sorted(map(int, input().split()))
print("yes" if e[0] == e[1] and e[2] == e[3] else "no")
# you take the input of A and B
# if b = 0 then straight away print 0
# if other value than 0 then compute X x b[i]
# if x > tha 10**18 then x = -1

a = int(input())
b = list(map(int,input().split()))
x = 1
if 0 in b :
  print(0)
  exit()
for i in range(len(b)):
  x = x * b[i]
  if x > 10**18:
    x = -1
    break
print(x)

### FIXED CODE ###

str_a, str_b = input().split()
a = int(str_a)
b_100 = int(str_b.replace('.', ''))
print(a * b_100 // 100)
N = input()
if n[-1] in ('0','1','6','8'):
	print('pon')
else if n[-1] =="3":
	print('bon')
else:
	print("bon")
    

### FIXED CODE ###

N = input()
if N[-1] in ('0','1','6','8'):
    print('pon')
elif N[-1] == '3':
    print('bon')
else:
    print('hon')
X, Y = map(int, input().split())

def comb(n, k, p):
  # nCk mod p (組合せのmod)
  from math import factorial
  if n < 0 or k < 0 or n < k:
    return 0
  if n == 0 or k == 0:
    return 1
  a = factorial(n) % p
  b = factorial(k) % p
  c = factorial(n - k) % p
  return (a * power_func(b, p - 2, p) * power_func(c, p - 2, p)) % p

def power_func(a, b, p):
  # a ^ b mod p # (指数のmod)
  if b == 0:
    return 1
  if b % 2 == 0:
    d = power_func(a, b // 2, p)
    return d * d % p
  if b % 2 == 1:
    return (a * power_func(a, b - 1, p )) % p

mod = 10 ** 9 + 7
  
if (X + Y) % 3 == 0:
  n = (X + Y) // 3 
  if min(X, Y) >= n:
    s = min(X, Y) - n
    ans = comb(n, s, mod)
else:
  ans = 0

print(ans)


### FIXED CODE ###

X, Y = map(int, input().split())
def framod(n, mod, a=1):
    for i in range(1,n+1):
        a=a * i % mod
    return a

def power(n, r, mod):
    if r == 0: return 1
    if r%2 == 0:
        return power(n*n % mod, r//2, mod) % mod
    if r%2 == 1:
        return n * power(n, r-1, mod) % mod

def comb(n, k, mod):
    a=framod(n, mod)
    b=framod(k, mod)
    c=framod(n-k, mod)
    return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod
  
mod = 10 ** 9 + 7
  
if (X + Y) % 3 == 0:
  n = (X + Y) // 3 
  if min(X, Y) >= n:
    s = min(X, Y) - n
    ans = comb(n, s, mod)
  else:
    ans = 0
else:
  ans = 0

print(ans)
import math
test = input()
five_hundred = math.floor(test / 500) * 1000
five_happy = math.floor((test - five_hundred*500)/5) * 5


### FIXED CODE ###

import math
numeric = int(input())
result = math.floor(numeric / 500)*1000
intermediate = numeric - math.floor(numeric / 500)*500
result = result + math.floor(intermediate / 5)*5
print(result)
n = int(input())
a, b = map(int, input().split())
for i in range(a, b + 1):
	if(i % k == 0):
    	print('OK')
        exit()
print('NG')        

### FIXED CODE ###

n = int(input())
a, b = map(int, input().split())
for i in range(a, b + 1, 1):
  if(i % n == 0):
    print('OK')
    exit()
print('NG')
s, t = map(input().split())
print(s, t,sep='')

### FIXED CODE ###

s, t = input().split()
print(t,s,sep='')
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
point = 0
for i in range(N):
    a[i] -= 1
    point += b[a[i]]
    if i > 0 and a[i - 1] + 1 == a[i]:
        point += c[a[i - 1]]
 
print(point)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
 
point = 0
for i in range(N):
    A[i] -= 1
    point += B[A[i]]
    if i > 0 and A[i - 1] + 1 == A[i]:
        point += C[A[i - 1]]
 
print(point)
A, B = [int(input()) for i in range(2)]
result = int(int(A)*int(B))
if 9 < int(A) and 9 < int(B):
    print(-1)
else:
    print(result)

### FIXED CODE ###

list = input().split(' ')
A = int(list[0])
B = int(list[1])
if A <= 9 and B <= 9:
    print(A*B)
else:
    print(-1)
a, b = raw_input, raw_input
print(a * b, 2*(a+b))

### FIXED CODE ###

a, b = map(int, raw_input().split())
print(str(a*b) + " " + str(2*(a+b)))
H,W=map(int,input().split())
field=[]
for i in range(H):
  field.append(list(input()))

l=[[[-1,-1] for _ in range(W)] for _ in range(H)]

def xp(x,y):
  global xn
  if x>=W:
    pass
  elif field[y][x]=="#":
    l[y][x][0]=0
  else:
    xn+=1
    xp(x+1,y)
    l[y][x][0]=xn


def yp(x,y):
  global yn
  if y>=H:
    pass
  elif field[y][x]=="#":
    l[y][x][1]=0
  else:
    yn+=1
    yp(x,y+1)
    l[y][x][1]=yn


for j in range(H):
  for i in range(W):
    xn=0
    yn=0
    if l[j][i][0]==-1:
      xp(i,j)
    if l[j][i][1]==-1:
      yp(i,j)

print(max([max([i[0]+i[1]-1 for i in j]) for j in l]))

### FIXED CODE ###

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

l=[[0]*W for _ in range(H)]
r=[[0]*W for _ in range(H)]
u=[[0]*W for _ in range(H)]
d=[[0]*W for _ in range(H)]

for j in range(H):
  for i in range(W):
    if field[j][i]==".":
      if i==0:
        l[j][i]=1
      else:
        l[j][i]=l[j][i-1]+1
      if j==0:
        u[j][i]=1
      else:
        u[j][i]=u[j-1][i]+1
        

for j in reversed(range(H)):
  for i in reversed(range(W)):
    if field[j][i]==".":
      if i==W-1:
        r[j][i]=1
      else:
        r[j][i]=r[j][i+1]+1
      if j==H-1:
        d[j][i]=1
      else:
        d[j][i]=d[j+1][i]+1

A=[]
for j in range(H):
  for i in range(W):
    A.append(l[j][i]+r[j][i]+d[j][i]+u[j][i]-3)

print(max(A))
while True:
    l = sorted([int(x) for x in input().split()])
    if l[0] == 0 and l[1] == 0:
        break
    l.sort()
    print(" ".join(map(str,l)))

### FIXED CODE ###

cnt = 1
while True:
    i = input()
    if i == '0':
        break
    print("Case {}: {}".format(cnt,i))
    cnt = cnt+1