Harryxun/stf_run huggingface dataset:
import sys
from collections import Counter

read = sys.stdin.read


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def sieve_of_eratosthenes(n):
    sieve = [True] * n
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i]:
            sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
    return [2] + [i for i in range(3, n, 2) if sieve[i]]


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


N, *A = map(int, read().split())
mod = 10 ** 9 + 7

primes = sieve_of_eratosthenes(max(A))
dic = {i: 0 for i in primes}

n = len(primes)
p = [0] * n
for i in A:
    tmp = Counter(prime_factorize(i))
    for key, value in tmp.items():
        #print(key, value)
        if dic[key] < value:
            dic[key] = value

lcm = 1
for i, j in dic.items():
    if j == 0:
        continue
    lcm *= pow(i, j, mod)
    lcm %= mod

answer = 0
for i in A:
    answer += lcm * pow(i, mod - 2, mod)
    answer %= mod

print(answer)


### FIXED CODE ###

import sys
from collections import Counter

read = sys.stdin.read


def gcd(a, b):
    while b:
        a, b = b, a % b
    return a


def sieve_of_eratosthenes(n):
    sieve = [True] * n
    for i in range(3, int(n ** 0.5) + 1, 2):
        if sieve[i]:
            sieve[i * i::2 * i] = [False] * ((n - i * i - 1) // (2 * i) + 1)
    return [2] + [i for i in range(3, n, 2) if sieve[i]]


def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a


N, *A = map(int, read().split())
mod = 10 ** 9 + 7

primes = sieve_of_eratosthenes(max(A) + 1)
dic = {i: 0 for i in primes}

n = len(primes)
p = [0] * n
for i in A:
    tmp = Counter(prime_factorize(i))
    for key, value in tmp.items():
        #print(key, value)
        if dic[key] < value:
            dic[key] = value

lcm = 1
for i, j in dic.items():
    if j == 0:
        continue
    lcm *= pow(i, j, mod)
    lcm %= mod

answer = 0
for i in A:
    answer += lcm * pow(i, mod - 2, mod)
    answer %= mod

print(answer)
x,a=int(input())
print(0 if x<a else 10)

### FIXED CODE ###

x,a=map(int,input().split())
print(0 if x<a else 10)
import sys
while True:
	y,x=map(int, input().split())
	if x==y==0: break
	for i in range(1,y+1):
		for j in range(1,x+1):
			if(i%2==1):
				if(j%2==1):
					sys.stdout.write('#')
				elif(j%2==0):
					sys.stdout.write('.')
			if(i%2==0):
				if(j%2==0):
					sys.stdout.write('#')
				elif(j%2==1):
					sys.stdout.write('.')
		print('')
	print('')

### FIXED CODE ###

import sys
while True:
	y,x=map(int, input().split())
	if x==y==0: break
	for i in range(1,y+1):
		for j in range(1,x+1):
			if(i%2==1):
				if(j%2==1):
					sys.stdout.write('#')
				elif(j%2==0):
					sys.stdout.write('.')
			if(i%2==0):
				if(j%2==0):
					sys.stdout.write('#')
				elif(j%2==1):
					sys.stdout.write('.')
		print('')
	print('')
H,W = map(int, input().split())
a = [list(input()) for i in range(W)]
a = [x for x in a if '#' in x]

aT = list(zip(*a))
aT = [x for x in aT if '#' in x]
ans = list(zip(*aT))

for i in ans:
    print("".join(i))


### FIXED CODE ###

H,W = map(int, input().split())
a = [list(input()) for i in range(H)]
a = [x for x in a if '#' in x]

aT = list(zip(*a))
aT = [x for x in aT if '#' in x]
ans = list(zip(*aT))

for i in ans:
    print("".join(i))
a,b = map(int,input())
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(':(')
n,k=map(int,input().split())
s,p,r=map(int,input().split())
f={'s':s,'p':p,'r':r}
t=str(input())
ans=0
for i in range(k):
  a=i+k
  last=t[i]
  ans+=f[last]
  while a<n-k:
    if t[a-k]==last:
      if t[a+k]==last:
        if last=='s':
          last='r'
        else:
          last='s'
      else:
        if last=='s':
          if t[a+k]=='r':
            last='p'
          else:
            last='r'
        elif last=='r':
          if t[a+k]=='s':
            last='p'
          else:
            last='s'
        else:
          if 
            

      
      
      
      
      






### FIXED CODE ###

#abc149-d
n,k=map(int,input().split())
s,p,r=map(int,input().split())
f={'s':s,'p':p,'r':r}
t=str(input())
ans=0
for i in range(k):
    a=i+k
    last=t[i]
    ans+=f[last]
    while a<n-k:
        if t[a]==last:
            if t[a+k]==last:
                if last=='s':
                    last='r'
                else:
                    last='s'
            else:
                if last=='s':
                    if t[a+k]=='r':
                        last='p'
                    else:
                        last='r'
                elif last=='r':
                    if t[a+k]=='s':
                        last='p'
                    else:
                        last='s'
                else:
                    if t[a+k]=='r':
                        last='s'
                    else:
                        last='r'
        else:
            last=t[a]
            ans+=f[last]
        a+=k
    
    if a<n:
        if t[a]!=last:
            ans+=f[t[a]]

print(ans)
N = input()
if N == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A + B)

### FIXED CODE ###

N = int(input())
if N == 1:
    print('Hello World')
else:
    A = int(input())
    B = int(input())
    print(A + B)
import sys
sys.setrecursionlimit(10000)

def poll_height(n):
    if n:
        return n + poll_height(n - 1)
    else:
        return 1

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

difference_a_b = b - a
print(poll_height(difference_a_b) - b)

### FIXED CODE ###

# -*- coding: utf-8 -*-
def margin0(n):
    if n < 10:
        return "00{}".format(n)
    elif n < 100:
        return "0{}".format(n)
    elif n < 1000:
        return "".format(n%1000)
    else:
        return "{}".format(n%1000 - 1)
n = int(input())
# print(n)
name = ""
if n < 1000:
    name = "ABC{}".format(margin0(n))
else:
    name = "ABD{}".format(margin0(n))
print(name[:3])
N,K=map(int,input().split())
A=list(map(int,input().split()))
Mod=10**9+7
ans_first=0
ans_sec=0
for i in range(len(A)-1):
  for j in range(i,len(A)):
    if A[i]>A[j]:
      ans_first+=1
for i in A:
  for j in A:
    if i > j:
      ans_sec+=1
if K%2==0
  tmp=(2*ans_first+(K-1)*ans_sec)%Mod
  ans=(tmp*K)//2%Mod
else:
  tmp=(2*ans_first+(K-1)//2*ans_sec)%Mod
  ans=(tmp*K)%Mod
print(ans)

### FIXED CODE ###

N,K=map(int,input().split())
A=list(map(int,input().split()))
Mod=10**9+7
ans_first=0
ans_sec=0
for i in range(len(A)-1):
  for j in range(i,len(A)):
    if A[i]>A[j]:
      ans_first+=1
for i in A:
  for j in A:
    if i > j:
      ans_sec+=1
if K%2==0:
  tmp=(2*ans_first+(K-1)*ans_sec)%Mod
  K=K//2
  ans=(tmp*K)%Mod
else:
  tmp=(ans_first+(K-1)//2*ans_sec)%Mod
  ans=(tmp*K)%Mod
print(ans)
#!/usr/bin/env python
# -*- coding: utf-8 -*-

var = raw_input().split()

var = map(int, var)

if var[0] > var[1]:
	tmp = var[0]
	var[0] = var[1]
	var[1] = tmp
	
if var[0] > var[2]:
	tmp = var[0]
	var[0] = var[2]
	var[2] = tmp
	
if var[1] > var[2]:
	tmp = var[1]
	var[1] = var[2]
	var[2] = tmp

prini var[0],var[1],var[2]

### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

var = raw_input().split()

var = map(int, var)

if var[0] > var[1]:
	tmp = var[0]
	var[0] = var[1]
	var[1] = tmp
	
if var[0] > var[2]:
	tmp = var[0]
	var[0] = var[2]
	var[2] = tmp
	
if var[1] > var[2]:
	tmp = var[1]
	var[1] = var[2]
	var[2] = tmp

print var[0],var[1],var[2]
n, x = map(int,input().split())
m = []
mall = 0
for i in range(n):
    mone = int(input())
    mall = mall + mone
    
y = x - mall
mm = []
p = y // (min(m))

print(p + n)


### FIXED CODE ###

n, x = map(int,input().split())
m = []
mall = 0
for i in range(n):
    mone = int(input())
    mall = mall + mone
    m.append(mone)
    
y = x - mall
mm = []
p = y // (min(m))

print(p + n)
_, *a = open(0)
mod = 10**9+7
c = 1
l = [3] + [0]*10**6

for a in a.split():
  a = int(a)
  c = c * l[a] % mod
  d[a] -= 1
  d[a] += 1
print(c)

### FIXED CODE ###

_, a = open(0)
mod = 10**9+7
c = 1
l = [3] + [0]*10**6

for a in a.split():
  a = int(a)
  c = c * l[a] % mod
  l[a] -= 1
  l[a+1] += 1
print(c)
N = int(input())

nums = [float(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = num * (10**9)
    assert int_converted.is_integer()
    int_converted = int(int_converted)

    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
        
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0
for i in range(N):
    for j in range(i+1,N):
        two_sum = two_fives[i][0] + two_fives[j][0]
        five_sum = two_fives[i][1] + two_fives[j][1]
        if two_sum >= 18 and five_sum >= 18:
            ok_count += 1

print(ok_count)



### FIXED CODE ###

import numpy as np
from decimal import Decimal

N = int(input())

nums = [Decimal(input()) for _ in range(N)]

two_fives = []


for i, num in enumerate(nums):
    int_converted = int(num * (10**9))
    
    two_div_count = 0
    while int_converted % 2 == 0:
        two_div_count += 1
        int_converted //= 2
    
    five_div_count = 0
    while int_converted % 5 == 0:
        five_div_count += 1
        int_converted //= 5

    two_fives.append((two_div_count,five_div_count))


ok_count = 0

two_five_exists = np.zeros((19,19), dtype=int)

for i in range(N):    
    two_count, five_count = two_fives[i]
    two_count = min(18, two_count)
    five_count = min(18, five_count)
    ok_count += two_five_exists[two_count, five_count]

    two_pair = 18 - two_count
    five_pair = 18 - five_count
    two_five_exists[two_pair:, five_pair:] += 1

print(ok_count)
import math

r = int(input())

s = r * r * math.pi
l = r * 2 * math.pi

print(s, l)

### FIXED CODE ###

import sys
import math
from decimal import Decimal

r = Decimal(sys.stdin.readline())
area = r ** Decimal(2) * Decimal(math.pi)
circumference = r * Decimal(2) * Decimal(math.pi)

print(round(area, 5), round(circumference, 5))
N = int(input())
val = []
cos = []
for i in range(N):
    val.append(int(input())
for i in range(N):
    cos.append(int(input())
dif = [val[i]-cos[i] for i in range(N)]
ma = 0
for d in dif:
    ma += d if d >= 0 else 0
return ma

### FIXED CODE ###

n = int(input())
va = input().split()
co = input().split()

val = [int(v) for v in va]
cos = [int(c) for c in co]

dif = [val[i]-cos[i] for i in range(n)]
ma = 0
for d in dif:
    ma += d if d >= 0 else 0
print(ma)
n = int(input())
a = list(map(int, input().split()))
m = (10**9 + 7)
for i in range(n):
    if abs(a[i]-m) < a[i]:
        a[i] = x - m
result = [(a[i]*a[j])%m for i in range(n) for j in range(n) if i < j]
result = sum(result)%m
if(result < 0):
    result += m 
print(result)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
m = (10**9 + 7)

result = 0

sum_a = 0
for i in range(n):
    sum_a = (sum_a + a[i]) % m

result = 0
for i in range(n):
    x = a[i]
    sum_a -= x
    result = (result + x*sum_a) % m

if(result < 0):
    result += m
print(result)
a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print('Yay!')
else:
  prit(':(')

### FIXED CODE ###

a, b = map(int, input().split())
if a <= 8 and b <= 8:
  print('Yay!')
else:
  print(':(')
x = int(input())
y = x // 11
z = x % 11
if z = 0:
  print(y * 2)
elif z <= 6:
  print(y * 2 + 1)
elif z > 6:
  print(y * 2 + 2)


### FIXED CODE ###

x = int(input())
y = x // 11
z = x % 11
if z == 0:
  print(y * 2)
elif z <= 6:
  print(y * 2 + 1)
elif z > 6:
  print(y * 2 + 2)
n = int(input())
vote = 0
tt = 0
aa = 0
for i in range(n):
    t, a = map(int,input().split())
    if (tt < t and aa = a) or (tt = t and aa < a) or (tt< t and aa <a):
        tt = t
        aa = a
        vote = t + a
    else:
        count = 1
        s = t + a
        while vote > s:
            count = count + 1
            s = s * count
            
        vote = s
        tt = count * t
        ss = count * a
            
print(vote)

### FIXED CODE ###

n = int(input())
import math as m
t1 , a1 = map(int,input().split())
tt = t1
aa = a1
for i in range(n-1):
    t, a = map(int,input().split())
    n = ((max((tt//t),(aa//a))))
    if tt > t*n or aa> a*n:
        n = n + 1
    tt = t * n
    aa = a * n
print(tt + aa)
if int(input()) * int(input()) % 2 == 0:
  print("Even")
else:
  print("Odd")


### FIXED CODE ###

a, b = map(int, input().split())
if (a * b) % 2 == 0:
  print("Even")
else:
  print("Odd")
n = int(input())
a = [list(map(int,input().split())) for i in range(n)]
a.insert([0,0,0])
ans = True
for i in range(1,n+1):
  t = a[i][0]-a[i-1][0]
  xy = a[i][1]+a[i][2]-a[i-1][1]-a[i-1][2]
  if not (t >= xy and t%2 == xy%2):
    ans = False
    break
print("Yes" if ans else "No")
   
  

### FIXED CODE ###

n = int(input())
a = [list(map(int,input().split())) for i in range(n)]
a.insert(0,[0,0,0])
ans = True
for i in range(1,n+1):
  t = a[i][0]-a[i-1][0]
  xy = a[i][1]+a[i][2]-a[i-1][1]-a[i-1][2]
  if not (t >= xy and t%2 == xy%2):
    ans = False
    break
print("Yes" if ans else "No")
T, A = map(int, raw_input().split())
H_list = map(int, raw_input().split())

average_diff = sys.float_info.max
min_i = None

for i, H in enumerate(H_list):
    tempature_diff = abs(A - (T - H*0.006))
    if tempature_diff < average_diff:
        average_diff = tempature_diff
        min_i = i
print min_i + 1


### FIXED CODE ###

import sys

N = int(raw_input())
T, A = map(int, raw_input().split())
H_list = map(int, raw_input().split())

average_diff = sys.float_info.max
min_i = None

for i, H in enumerate(H_list):
    tempature_diff = abs(A - (T - H*0.006))
    if tempature_diff < average_diff:
        average_diff = tempature_diff
        min_i = i
print min_i + 1
N = int(input())
T,A = map(int,input().split(" "))
temp = []
for i in range(N):
  temp.append(map(int,input().split(" ")))
j = 0
k = 0
flag = 0
s = []
while j < N:
  k = T - (0.006)*temp[j]
    if k >= A:
      s.append(k - A)
    else:
      s.append(A - k)
  if s[j] <= s[flag]:
    flag = j
  j = j + 1
print(j)

### FIXED CODE ###

N = int(input())
T,A = map(int,input().split(" "))
H = list(map(int,input().split(" ")))
j = 0
k = 0
flag = 0
s = []
while j < N:
  k = T - (0.006)*H[j]
  if k >= A:
    s.append(k - A)
  else:
    s.append(A - k)
  if s[j] <= s[flag]:
    flag = j
  j = j + 1
print(flag+1)
N, K = map(int, input().split())
x = []
for i in range(N):
    x.append(list(map(int, input().split())))
ans = []
for i in range(N):
    for j in range(i+1, N):
        count = 0
        x1 = min(x[i][0], x[j][0])
        x2 = max(x[i][0], x[j][0])
        y1 = min(x[i][1], x[j][1])
        y2 = max(x[i][1], x[j][1])
        print([x1, x2, y1, y2])

        for k in range(N):
            if x1 <= x[k][0] and x[k][0] <= x2 and y1 <= x[k][1] and x[k][1] <= y2:
                count += 1
        print(count)
        if count >= K:
            ans.append((x2 - x1) * (y2 - y1))
print(min(ans))


### FIXED CODE ###

N, K = map(int, input().split())
x = []
for i in range(N):
    x.append(list(map(int, input().split())))
ans = []
for i in range(N):
    for j in range(i+1, N):
        for l in range(N):
            for m in range(l+1, N):
                count = 0
                x1 = min(x[i][0], x[j][0])
                x2 = max(x[i][0], x[j][0])
                y1 = min(x[l][1], x[m][1])
                y2 = max(x[l][1], x[m][1])

                for k in range(N):
                    if x1 <= x[k][0] and x[k][0] <= x2 and y1 <= x[k][1] and x[k][1] <= y2:
                        count += 1
                if count >= K:
                    ans.append((x2 - x1) * (y2 - y1))
print(min(ans))
def calc(a, b, c):
    if a < b:
        b -= a 
        c += a 
        a = 0 
    else:
        a -= b 
        c += b 
        b = 0
    return a, b, c 

c = 0
for i in reversed(range(N)):
    A[i+1], B[i], c = calc(A[i+1], B[i], c)
    A[i], B[i], c = calc(A[i], B[i], c)

print(c)

### FIXED CODE ###

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

def calc(a, b, c):
    if a < b:
        b -= a 
        c += a 
        a = 0 
    else:
        a -= b 
        c += b 
        b = 0
    return a, b, c 

c = 0
for i in reversed(range(N)):
    A[i+1], B[i], c = calc(A[i+1], B[i], c)
    A[i], B[i], c = calc(A[i], B[i], c)

print(c)
n = int(input())
a = list(map(int, input().split(' ')))
b = [0] * n
K = [0] * n
def hopping(j):
    if j == 1: return 0
    else:
        K[j-1] = ((-1)**(j-1))*2*(j-1)+hopping(j-1)
        return K[j-1]

hopping(n)

if n % 2 == 0:
    for i in range(n):
        b[(n+K[i])//2] = a[i]
else:
    for i in range(n):
        b[(n-K[i]-1)//2] = a[i]
print(b)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split(' ')))
b = [0] * n
K = [0] * n
for i in range(n):
    if i % 2 == 0: K[i] = i
    else: K[i] = -1 * (i + 1)

if n % 2 == 0:
    for i in range(n):
        b[(n+K[i])//2] = a[i]
else:
    for i in range(n):
        b[(n-K[i]-1)//2] = a[i]

print(' '.join(map(str, b)))
N, M, X, Y = map(int, input().split())

x = list(map(int, input().split()))
y = list(map(int, input().split()))    

for z in range(-100, 101):
    if (X < z) and (max(x) < z) and (z <= min(y) and (z <= Y):
        print("No War")
    else:
        print("War")

### FIXED CODE ###

a, b, c = (int(x) for x in input().split())
print(a + b + c + max(a, b, c)*9)
import math
from functools import reduce

N,X = map(int,input().split(" "))
x = list(map(int,input().split(" ")))
Y = [i-X for i in x]

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(Y))

#Yの最大公約数を求める

### FIXED CODE ###


from functools import reduce
from fractions import gcd

N,X = map(int,input().split(" "))
x = list(map(int,input().split(" ")))
Y = [abs(i-X) for i in x]

print(reduce(gcd, Y, 0))
#入力
A, B, C, D = map(int, input().split())

#各々HPを定義
int takahashi = A
int aoki = C
int aokiDeath
int takahashiDeath

#高橋の攻撃何発分か
if C % B == 0:
    aokiDeath = C // B
else:
    aokiDeath = C // B + 1 

#青木の攻撃何回分か
if A % D == 0:
    takahashiDeath = A // D
else:
    takahashiDeath = A // D + 1

if aokiDeath <= takahashiDeath:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

#入力
A, B, C, D = map(int, input().split())


#高橋の攻撃何発分か
if C % B == 0:
    aokiDeath = C // B
else:
    aokiDeath = C // B + 1 

#青木の攻撃何回分か
if A % D == 0:
    takahashiDeath = A // D
else:
    takahashiDeath = A // D + 1

if aokiDeath <= takahashiDeath:
    print("Yes")
else:
    print("No")
S = list(input())
s = sorted(S)[::-1]
B = []
W = []

for i in range(len(S)):
    if S[i] == 'B':
        B.append(i)
    else:
        W.append(i)

W = W[::-1]
#print(B,W)
cnt = 0
while True:
    if B == [] :
        break
    tmpB = B.pop(0)
    tmpW = W.pop(0)
    if tmpB >= tmpW:
        break
    cnt += tmpW - tmpB
    W.append(tmpB)
print(cnt)


### FIXED CODE ###

N = input()
cnt1 = 0
for x in N:
  if x == 'B':
    cnt1 += 1
N = N[::-1]
ans =  0
cnt2 = 0
for i in range(len(N)):
  if N[i] == 'B':
    ans += i - cnt2
    cnt2 += 1
print(ans)
import sys

ans=0
g=[]
n=0
input()
for s in sys.stdin:
    x=set()
    d=[]
    for a in s.split():
        x.add(a)
        for i in range(len(g)):
            if a in g[i]:
                d+=[i]
                x|=g[i]
    for i in d:
        del g[i]
    g.append(x)

if g:
    print(max(len(t) for t in g))
else:
    print(0)



### FIXED CODE ###

import sys

n,m=map(int,next(sys.stdin).split())
adj=[[] for _ in range(n)]
for _ in range(m):
    ln=next(sys.stdin)
    a,b=map(int,ln.split())
    a,b=a-1,b-1
    adj[a].append(b)
    adj[b].append(a)

ans=0
vis=[0]*n
for i in range(n):
    if vis[i]:
        continue
    vis[i]=1
    k=0
    stk=[i]
    while stk:
        u=stk.pop()
        k+=1
        for v in adj[u]:
            if vis[v]:
                continue
            vis[v]=1
            stk.append(v)
    ans=max(ans,k)

print(ans)
n = list(int(input()))
for i in range(len(n)):
    if n[i]==1:
        n[i]=9
    elif n[i]==9:
        n[i]=1
print("".join(n))


### FIXED CODE ###

n = list(input())
for i in range(len(n)):
    if n[i]=="1":
        n[i]="9"
    elif n[i]=="9":
        n[i]="1"
print("".join(n))
import numpy as np

N, K = map(int, input().split())
H = np.array([int(i) for i in input().split()])

dp = np.full(N, np.inf, int)
dp[0] = 0
for i in range(1, N):
    dp[i] = min(dp[max(i-K, 0):i]+np.abs(H[max(i-K, 0):i]-H[i]))
    
print(dp[N-1])

### FIXED CODE ###

import numpy as np

# 入力
N, K = map(int, input().split())
H = np.array([int(i) for i in input().split()])

# ndarray型のDPテーブルを生成
dp = np.zeros(N, dtype=int)
# 初期値をセット
dp[0] = 0

# 各足場へたどり着く最小コストを調べる
for i in range(1, N):
    s = max(0, i-K)
    dp[i] = min(dp[s:i] + np.abs(H[i] - H[s:i])) # iより前の足場のコストに足す

print(dp[N-1])
H, W = map(int, input().split())
inf = float("inf")
s = [["#"] * (W + 2)]
D = [[None] * (W + 2)]
white_num = 0
for i in range(H):
    main = list(input())
    white_num += len([e for e in main if e == "."])
    s.append(["#"] + main + ["#"])
    D.append([None] * (W + 2))
s.append(["#"] * (W + 2))
D.append([None] * (W + 2))


def search(i, j):  # (i,j)からの最短経路長を求める再帰関数
    #print("({},{})".format(i, j))
    if i == H and j == W:
        return 0
    if s[i][j] == "#":
        D[i][j] = inf
        return inf
    if D[i][j] is not None:
        return D[i][j]
    D[i][j] = inf
    D[i][j] = min(search(i - 1, j), search(i, j - 1),
                  search(i, j + 1), search(i + 1, j)) + 1
    return D[i][j]


white_min = search(1, 1) + 1
if white_min == inf:
    print(-1)
else:
    print(white_num - white_min)


### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
inf = float("inf")
s = [["#"] * (W + 2)]
D = [[inf] * (W + 2)]
white_num = 0
for i in range(H):
    main = list(input())
    white_num += len([e for e in main if e == "."])
    s.append(["#"] + main + ["#"])
    D.append([inf] * (W + 2))
s.append(["#"] * (W + 2))
D.append([inf] * (W + 2))


def BFS():  # 幅優先探索
    global D
    D[1][1] = 1
    q = deque()
    q.append((1, 1))
    while len(q) != 0:
        p = q.popleft()
        for e in [(p[0] + 1, p[1]), (p[0], p[1] + 1), (p[0] - 1, p[1]), (p[0], p[1] - 1)]:
            if s[e[0]][e[1]] == "." and D[e[0]][e[1]] == inf:
                D[e[0]][e[1]] = D[p[0]][p[1]] + 1
                q.append(e)
                if e == (H, W):
                    return white_num - D[H][W]
    return -1


print(BFS())

# for i in range(1, H + 1):
#    print(" ".join(list(map(str, D[i][1:-1]))))
n=raw_input()
k=n.split(" ")

W=int(k[0])
H=int(k[1])
x=int(k[2])
y=int(k[3])
r=int(k[4])



if 0<=x-r<=W:
        if 0<=y-r<=H:
                print "Yes"
        else:
                print "No"
else:

### FIXED CODE ###


n=raw_input()
k=n.split(" ")

W=int(k[0])
H=int(k[1])
x=int(k[2])
y=int(k[3])
r=int(k[4])
f=0

if 0<=x-r<=x+r<=W:
  if 0<=y-r<=y+r<=H:
    print "Yes"
    f=1
if f==0:
  print "No"
R=int(input())
pai=3.14
    print(R*2*pai)

### FIXED CODE ###

R=int(input())
pai=3.14
print(R*2*pai)
while True:
    m, f, r = [int(i) for i in input().split]

    if m == f == r == -1:
         break

    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')

    elif total < 50 and r < 50:
        print('D')

    elif total < 65:
        print('C')

    elif total < 80:
        print('B')

    else:
        print('A')

### FIXED CODE ###

while True:
    m, f, r = [int(i) for i in input().split()]
 
    if m == f == r == -1:
        break
 
    total = m + f
    if m == -1 or f == -1 or total < 30:
        print('F')
 
    elif total < 50 and r < 50:
        print('D')
 
    elif total < 65:
        print('C')
         
    elif total < 80:
        print('B')
 
    else:
        print('A')