Harryxun/stf_run huggingface dataset:
# coding: utf-8
# Your code here!
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

n,k=map(int,input().split())
a=list(map(int,input().split()))
g=gcd(a[0],a[1])
mx=max(a)
for i in range(2,n):
    g=gcd(g,a[i])
if k%g==0 and k<=mx:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


### FIXED CODE ###

# coding: utf-8
# Your code here!
def gcd(a,b):
    while b:
        a,b=b,a%b
    return a

n,k=map(int,input().split())
a=list(map(int,input().split()))
if n==1:
    if k==a[0]:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')
    exit()
g=gcd(a[0],a[1])
mx=max(a)
for i in range(2,n):
    g=gcd(g,a[i])
if k%g==0 and k<=mx:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
N, M = map(int, input().split())
X = [0 for _ in range(N)]
if N % 2 == 0:
    l, r = 0, 1
    for i in range(M):
        X[l] = 1
        X[r] = 1
        print(l+1, r+1)
        if i < M - 1:
            while X[l] != 0 or X[(l+i+2)%N] != 0:
                l += 1
            r = (l + i + 2) % N
else:
    for i in range(M):
        print(N-i-1, i+1)

### FIXED CODE ###

N, M = map(int, input().split())
X = [0 for _ in range(N)]
if N % 2 == 0:
    X = [0 for _ in range((N-1)//2)]
    l, r = 1, N // 2
    for i in range((N//2)//2):
        X[i] = [l, r]
        l += 1
        r -= 1
    l, r = N, N // 2 + 2
    for i in range((N-1)//2-(N//2)//2):
        X[i+(N//2)//2] = [l, r]
        l -= 1
        r += 1
    for i in range(M):
        print(X[i][0], X[i][1])
else:
    for i in range(M):
        print(N-i, i+1)
# -*- coding: utf-8 -*-
import sys
from collections import defaultdict, deque
from math import sqrt, gcd, factorial
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]

# n = int(input())



def solve():
    n = int(input())
    ans = 0
    a = 0
    b = 0
    for _ in range(n):
        s = input()
        a += s[-1] == 'A'
        b += s[0] == 'B'
        ans += s.replace('AB', "*").count('*')
    print(ans + min(a, b))
    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()




"""




"""



### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import deque
from math import sqrt
# def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline()[:-1]

# n = int(input())



def solve():
    n = int(input())
    ans = 0
    a = 0
    b = 0
    c = 0
    for _ in range(n):
        s = input()
        a += s[-1] == 'A' and s[0] != 'B'
        b += s[0] == 'B' and s[-1] != 'A'
        c += s[0] == 'B' and s[-1] == 'A'
        ans += s.replace('AB', "*").count('*')
    if (a+b) > 0:
        print(ans + c + min(a, b))
    else:
        if c:
            c -= 1
        print(ans + c)
    

t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()




"""




"""
input_number = int(input())
input_str = input()
abc_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
abc_list = abc_list + abc_list
for i in len(input_str):
    output_str += abc_list[abc_list.index(input_str[i]) + input_number]
print(output_str)

### FIXED CODE ###

input_number = int(input())
input_str = input()
abc_list = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
abc_list = abc_list + abc_list
output_str = ""
for i in range(len(input_str)):
    output_str += abc_list[abc_list.index(input_str[i]) + input_number]
print(output_str)
n=int(input())
if n>400 and n<=599:
	print("8")
elif n>600 and n<=799:
	print("7")
elif n>800 and n<=999:
	print("6")
elif n>1000 and n<=1199:
	print("5')
elif n>1200 and n<=1399:
	print("4")
elif n>1400 and n<=1599:
    print("3")
elif n>1600 and n<=1799:
    print("2")
elif n>1800 and n<=1999:
	print("1")

### FIXED CODE ###

n=int(input())
if n>=400 and n<=599:
  print("8")
elif n>=600 and n<=799:
  print("7")
elif n>=800 and n<=999:
  print("6")
elif n>=1000 and n<=1199:
  print("5")
elif n>=1200 and n<=1399:
  print("4")
elif n>=1400 and n<=1599:
  print("3")
elif n>=1600 and n<=1799:
  print("2")
elif n>=1800 and n<=1999:
  print("1")
=input()
t=input()
for i in range(0,len(s)):
    if(s[i]!=t[i]):
        break
if(i==len(s)):
    if(len(s)==(len(t)-1)):
       print("Yes")
else:
    ("No")

### FIXED CODE ###

s=input()
t=input()
f=1
if(len(s)==(len(t)-1)):
    for i in range(0,len(s)):
        if(s[i]!=t[i]):
            f=0
            break
    if(f==1):
        print("Yes")
        exit()
print("No")
def prime(n):
  if n==1:
    return False
  elif n==2 or n==3:
    return True
  else:
    for i in range(2,int(n**0.5)+1):
      if n%i==0:
        return False
    else:
      return True

ans=[0]*(10**5+1)
for i in range(3,10**5+1,2):
  if prime(i) and prime((i+1)//2):
    ans[i]=1
for i in range(1,10**5+1)=:
  ans[i]=ans[i]+ans[i-1]
q=int(input())
for i in range(q):
  l,r=map(int,input().split())
  print(ans[r]-ans[l-1])

### FIXED CODE ###

def prime(n):
  if n==1:
    return False
  elif n==2 or n==3:
    return True
  else:
    for i in range(2,int(n**0.5)+1):
      if n%i==0:
        return False
    else:
      return True

ans=[0]*(10**5+1)
for i in range(3,10**5+1,2):
  if prime(i) and prime((i+1)//2):
    ans[i]=1
for i in range(1,10**5+1):
  ans[i]=ans[i]+ans[i-1]
q=int(input())
for i in range(q):
  l,r=map(int,input().split())
  print(ans[r]-ans[l-1])
n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
lst = [0] * (a_max + 1)
cnt = 0
for i in a:
    if lst[i] > 1:  # 配列中のカウントが2以上なら以降の処理を省略
        continue
    lst[1::i] += 1
    # for j in range(a_max // i + 1):  # Aiの倍数にインクリメント(配列の上限はa[-1])
    #     lst[i * j] += 1
for i in a:
    if lst[i] == 1:
        cnt += 1
print(cnt)

### FIXED CODE ###

import numpy as np

n = int(input())
a = list(map(int, input().split()))
a_max = max(a)
lst = [0] * (a_max + 1)
cnt = 0
# if len(a) <= 1:
#     print(0)
# else:
for i in a:
    if lst[i] > 1:  # 配列中のカウントが2以上なら以降の処理を省略
        continue
    for j in range(a_max // i + 1):  # Aiの倍数にインクリメント(配列の上限はa[-1])
        lst[i * j] += 1
    # lst[1::i] += 1
for i in a:
    if lst[i] == 1:
        cnt += 1
print(cnt)
list = [int(input())for i in range(3)]

for i in range(3):
    if list[i] == 1:
        print(9, end="")
    elif list[i] == 9:
        print(9, end="")

print()


### FIXED CODE ###

nyu = input()
list(nyu)

for i in nyu:
    if i == "1":
        print("9", end="")
    elif  i == "9":
        print("1", end="")
print()
import numpy as np
n = int(input())
a =list(map(int,input().split()))
box = [[0]*n for _ in range(n)]
for i in range(n-1):
     box[i][i] = 1
     box[i][i+1] = 1

box[n-1][0] = 1
box[n-1][n-1] = 1
boxx = np.array(box)
inv = np.linalg.inv(boxx)
aa = np.array(a)
ans = np.dot(inv,aa)
print(*ans//2)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
 
m = [0]*n
m[0] = sum(a)
 
for i in range((n-1)//2):
	m[0] -= 2*(a[1+i*2])
 
for i in range(1,n):
	m[i] = 2*a[i-1] - m[i-1]
 
print(' '.join(map(str, m)))
def resolve():
    input().split()
    map(int, input().split())
    list(map(int, input().split()))
resolve()

### FIXED CODE ###

def resolve():
	n, m = map(int, input().split())
	a = list(map(int, input().split()))
	print(n-sum(a) if n-sum(a) > -1 else -1)
resolve()
s = list(map(int,input().split()))
t = s.pop(0)
s.sort()
s.reverse()
c = 1
d = 1
for i in range(t):
  for k in range(i+1,t):
    if s[i]%s[k]==0:
      c = 0
      break
  if c == 1:
    d = d+1
print(d)
  
    


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
M = 10**6 + 1
cnt = [0] * M
for a in A:
    if cnt[a] != 0:
        cnt[a] += 1
        continue
    for b in range(a, M, a):
        cnt[b] += 1
ans = 0
for a in A:
    if cnt[a] == 1:ans += 1
print(ans)
import sys
sys.setrecursionlimit(1000000000)
NQ = input().split(' ')
N = int(NQ[0])
Q = int(NQ[1])

tree_dict = {
    1: {
        'count': 0,
        'has_trees': []
    }
}

def f(p,x):
    tree_dict[p]['count'] += x
    for num in tree_dict[p]['has_trees']:
        f(num,x)


#Make tree dict
for _ in range(N-1):
    ab = input().split(' ')
    a = int(ab[0])
    b = int(ab[1])
    tree_dict[a]['has_trees'].append(b)
    if b not in tree_dict.keys():
        tree_dict[b] = {
                'count': 0,
                'has_trees': []
            }

for _ in range(Q):
    px = input().split(' ')
    p = int(px[0])
    x = int(px[1])
    f(p,x)

out_put_list = []
for each_dict in tree_dict.values():
    out_put_list.append(str(each_dict['count']))
print(' '.join(out_put_list))

### FIXED CODE ###


NQ = input().split(' ')
N = int(NQ[0])
Q = int(NQ[1])
out_put_list = [0] * N
tree_list = {}
for i in range(N):
    tree_list[i] = []

for i in range(N-1):
    ab = input().split(' ')
    a = int(ab[0]) -1
    b = int(ab[1]) -1
    tree_list[a].append(b)

for _ in range(Q):
    px = input().split(' ')
    p = int(px[0])
    x = int(px[1])
    out_put_list[p-1] += x

for i in range(len(tree_list)):
    for num in tree_list[i]:
        out_put_list[num] += out_put_list[i]

print(*out_put_list)
import sys
heights = sorted([ int(h) for h in sys.stdin],reverce)
heights[0]
heights[1]
heights[2]

### FIXED CODE ###

import sys
heights = sorted([ int(h) for h in sys.stdin ], reverse=True)
print( heights[0] )
print( heights[1] )
print( heights[2] )
N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

score = np.array([0, R, S, P], dtype=int)
M = (1 + (N-1)//K)
addi = M * K - N
t = np.array([{'n':0, 's':1, 'p':2, 'r':3}[i] for i in T+'n'*addi], dtype=int)

t = t.reshape(M,K).T

for i in range(K):
    for j in range(M):
        if j!=0 and t[i,j] == t[i,j-1]:
            t[i,j] = 0

print(score[t].sum())

### FIXED CODE ###

N, K = map(int, input().split())
R, S, P = map(int, input().split())
T = input()

import numpy as np

score = np.array([0, R, S, P], dtype=int)
M = (1 + (N-1)//K)
addi = M * K - N
t = np.array([{'n':0, 's':1, 'p':2, 'r':3}[i] for i in T+'n'*addi], dtype=int)

t = t.reshape(M,K).T

for i in range(K):
    for j in range(M):
        if j!=0 and t[i,j] == t[i,j-1]:
            t[i,j] = 0

print(score[t].sum())
def get_cost(arr, n, dp_arr):
  if n == 1:
    return abs(arr[1] - arr[0])
  elif n == 0:
    return 0
  else:
    if dp_arr[n] != 0:
      return dp_arr[n]
    else:
      dp_arr[n] = min(
        abs(arr[n] - arr[n-1]) + get_cost(arr, n-1, dp_arr),
        abs(arr[n] - arr[n-2]) + get_cost(arr, n-2, dp_arr)
      )
      return dp_arr[n]


N = int(input())
arr = [int(num) for num in input().split()]
dp_arr = [0]*N
print(get_cost(arr, N-1, dp_arr))


### FIXED CODE ###

import sys
sys.setrecursionlimit(500000)

def get_cost(arr, n, dp):
  if dp[n] != float('inf'):
    return dp[n]
  if n == 1:
    dp[1] = abs(arr[1] - arr[0])
    return dp[1]
  elif n == 0:
    dp[0] = 0
    return dp[0]
  else:
    dp[n] = min(
      abs(arr[n] - arr[n-1]) + get_cost(arr, n-1, dp),
      abs(arr[n] - arr[n-2]) + get_cost(arr, n-2, dp)
    )
    return dp[n]


N = int(input())
arr = [int(num) for num in input().split()]
dp_arr = [float('inf')]*N
print(get_cost(arr, N-1, dp_arr))
import math
N,M = map(int,input().split())
count = 0
if N*2>M:
    count = math.floor(M/2)
else:
    temp=M-2*N
    ans = N+math.floor(temp/4)

print(ans)

### FIXED CODE ###

import math
N,M = map(int,input().split())
count = 0
if N*2>M:
    count = math.floor(M/2)
else:
    temp=M-2*N
    count = N+math.floor(temp/4)

print(count)
import sys

def my_index(l, x):
    if x in l:
        return l.index(x)
    else:
        return -1

input = sys.stdin.readline
n,m = map(int, input().split())
A = list(map(int,input().split()))
d = {}
for i in range(m):
    b,c = map(int, input().split())
    if d.get(c) == None:
        d[c] = b
    else:
        d[c] = d[c] + b

print(d)

for c, b in sorted(d.items(), key=lambda x: -x[0]):
    A.sort()
    print(A)
    if b > n:
        b = n

    if A[0] < c:
        if A[b-1] > c:
            for i in range(b):
                if i // c == 0:
                    f = i
                break
            A[:f]=[c]*f
        else:
            A[:b]=[c]*b


print(sum(A))


### FIXED CODE ###

import sys
import heapq

input = sys.stdin.readline
n,m = map(int, input().split())
A = list(map(int,input().split()))
d = [list(map(int,input().split())) for _ in range(m)]

d.sort(key=lambda x:-x[1])
total = sum(A)
heapq.heapify(A)

for i in range(m):
    for j in range(d[i][0]):
        tmp = heapq.heappushpop(A, d[i][1])
        if tmp < d[i][1]:
                total += (d[i][1] - tmp)
        else:
            break

print(total)
n,T=map(int, input().split())'
m=-1
for i in range(n):
  c,t=map(int, input().split())
  if t<=T:
    if m=-1:
      m=c
    else:
      m=min(m,c)
if m==-1:
  print('TLE')
else:
  print(m)

### FIXED CODE ###

n,T=map(int, input().split())
m=-1
for i in range(n):
  c,t=map(int, input().split())
  if t<=T:
    if m==-1:
      m=c
    else:
      m=min(m,c)
if m==-1:
  print('TLE')
else:
  print(m)
i=input()
 
 a,b = i.split(' ')
 v,h = int(a),int(b)
 
 area = v * h
 div = 2 * (v + h)
 
 print(' '.join([str(area),str(div)]))
 ~                                      

### FIXED CODE ###

i=input()
 
a,b = i.split(' ')
v,h = int(a),int(b)
 
area = v * h
div = 2 * (v + h)
 
print(' '.join([str(area),str(div)]))
x = int(input())
y = int(input())
result = x + y *0.5
print(result)

### FIXED CODE ###

x, y = map(int, input().split())
print(int(x + y / 2))
n = int(input())
cnt = 0
for i in range(1,n+1):
  if len(i) == 1:
    cnt+=1
  elif len(i)>1 and len(i) % 2 != 0:
    cnt+=1
    
print(cnt)

### FIXED CODE ###

n=int(input())

i=1
cnt = 0 
while(i<=n):
	if i < 10 or (i >= 100 and i < 1000) or (i>=10000 and i<100000) :
		cnt+=1
		i+=1
	elif n == 100000:
		cnt  = 90909
		break
	elif len(str(i)) > 1:
		if i < 100:
			i = 100

		elif i >999 and i< 10000:
			i = 10000
	
print(cnt)
n, k = map(int, input().split())
a = list(map(int, input().split()))
f = [0 for _ in range(n)]
f[0] = 1

v = [0]
s = 0
idx = 0
loop = 0
last = 0

for _ in range(k):
    vi = a[last] - 1
    if not f[vi]:
        f[vi] = 1
        last = vi
        s += 1
        v.append(vi)
    else:
        s += 1
        idx = v.index(vi)
        loop = s - idx
        break

remain = k - s

print(v[idx:][remain % loop] + 1)

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
f = [0 for _ in range(n)]
f[0] = 1

v = [1]
s = 0
idx = 0
loop = 0
last = 1
for i in range(k):
    vi = a[last - 1]
    if not f[vi - 1]:
        f[vi - 1] = 1
        last = vi
        s += 1
        v.append(vi)
    else:
        s += 1
        idx = v.index(vi)
        loop = s - idx
        break
else:
    print(vi)
    exit()
remain = k - s
print(v[idx:][remain % loop])
n = int(input())
p = list(map(int, input().split()))

l = int(a/2)

for i in range(l-1):
    t1 = max(p)
    t2 = min(p)
    #print(t1, t2)
    p.remove(t1)
    p.remove(t2)

print(max(p) - min(p))

### FIXED CODE ###

from heapq import nsmallest

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

m = int(-(n/2))
s = int(n/2)

m2 = sorted(p)[m]
s2 = nsmallest(s, p)[-1]

print(m2-s2)
n,m=map(int,input().split())

par=[i for i in range(n)]


def find(x):
  if par[x]==x:
    return par[x]
  else:
    par[x]=find(par[x])
    return par[x]


def union(x,y):
  fx=find(x)
  fy=find(y)
  if fx!=fy:
    par[fx]=fy


for i in range(m):
  x,y,z=map(int,input().split())
  union(x-1,y-1)

ans=0

for i in range(n):
    if i==find(i):
        ans+=1

print(ans)



### FIXED CODE ###

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

par=[i for i in range(n)]
size=[1]*n

def find(x):
  if par[x]==x:
    return x
  else:
    par[x]=find(par[x])
    return par[x]
def union(a,b):
  x=find(a)
  y=find(b)
  if x!=y:
    if size[x]<size[y]:
      par[x]=par[y]
      size[y]+=size[x]
    else: 
      par[y]=par[x]
      size[x]+=size[y]
  else:
    return

for i in range(m):
  x,y,z=map(int,input().split())
  union(x-1,y-1)


ans={find(i) for i in range(n)}

print(len(ans))
#!/usr/bin/python3
# -*- coding:utf-8 -*-

from collections import defaultdict

def main():
  n, m = map(int, input().strip().split())
  memo = [-1] * (n+1)
  graph = defaultdict(list)

  for _ in range(m):
    x, y = map(int, input().strip().split())
    graph[y].append(x)

  def rec(v):
    if memo[v] != -1:
      return memo[v]

    memo[v] = max([0] + [rec(t)+1 for t in graph[v]])
    return memo[v]

  print(max([rec(v) for v in range(1, n+1)]))

if __name__=='__main__':
  main()

### FIXED CODE ###

#!/usr/bin/python3
# -*- coding:utf-8 -*-

from collections import defaultdict
import sys
sys.setrecursionlimit(10**7)

def main():
  n, m = map(int, input().strip().split())
  memo = [-1] * (n+1)
  graph = defaultdict(list)

  for _ in range(m):
    x, y = map(int, input().strip().split())
    graph[y].append(x)

  def rec(v):
    if memo[v] != -1:
      return memo[v]

    lp = 0
    for t in graph[v]:
      lp = max(lp, rec(t)+1)
    memo[v] = lp
    return memo[v]

  lp = 0
  for v in range(1, n+1):
    lp = max(lp, rec(v))
  print(lp)


if __name__=='__main__':
  main()
h = int(input())
a = int(input())
i = 0
while h > 0:
    h = h - a
    i = i + 1
print(i)

### FIXED CODE ###

h,a=(int(x) for x in input().split())
i = 0
while h > 0:
    h = h - a
    i = i + 1
print(i)
100000 1
1 100000

### FIXED CODE ###

N,M=map(int,input().split())
Lmax=1
Rmin=N
for i in range(M):
    L,R=map(int,input().split())
    Lmax=max(Lmax,L)
    Rmin=min(Rmin,R)
    
print(max(Rmin-Lmax+1,0))
N,K = map(int,input())

print(100*(10-K) if N <=10 else K)

### FIXED CODE ###

N,R = map(int,input().split())

print( R if N >= 10 else R + 100*(10-N))
from collections import deque

h,w = map(int,input().split())
hw = [list(input()) for _ in range(h)]

for i in range(h):
  for j in range(w):
    if hw[i][j] == ".":
      cnt = 0
      for x in [-1, 0, 1]:
        for y in [-1, 0, 1]:
          if i+y in range(h) and j+x in range(w):
            if hw[i+y][j+x]=="#":
              cnt += 1
      hw[i][j]=cnt

for line in hw:
  print("".join(list(map(str, line))))


### FIXED CODE ###

A, B, C = map(int, input().split())
if A==B:
  print(C)
elif A==C:
  print(B)
else:
  print(A)
N = int(input())
parts = [[] for i in range(3)]
bigger = [[0] * N for i in range(2)]

m = 0

for i in range(3):
  t = list(map(int,input().split()))
  t = [i for i in t if i >= m]
  parts[i] = t
  m = min(t)

under =parts[2]
middle = parts[1]
upper = parts[0]

con = 0

for i in range(len(under)):
  p = under[i]
  for j in range(len(middle)):
    q = middle[j]
    if p > q:
      for k in range(len(upper)):
        r = upper[k]
        if q > r:
          con += 1
          
print(con)

### FIXED CODE ###

import bisect

N = int(input())
parts = [[] for i in range(3)]
con = [0] * N

ans = 0

for i in range(3):
  t = sorted(list(map(int,input().split())))
  parts[i] = t

under =parts[2]
middle = parts[1]
upper = parts[0]

for i in range(N):
  p = middle[i]
  ans += bisect.bisect_left(upper,p) * (N - bisect.bisect_right(under,p))
    
print(ans)
N = input()
A = list(map(int,input().split(' ')))
if 0 in A:
    print(0)
    exit()
x = 1
for a in A:
    x *= a
    if x > 1000000000000000000:
        print(-1)
        exit()
print(x)

### FIXED CODE ###

A, B = map(int,input().split(' '))
print(A*B)
from math import factorial

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

memo = dict()
ans = []
d = 0
for i in range(1, k+1):
    nn = n - k + 1
    k1 = nn - i
    k2 = i
    nn2 = k - 1
    k3 = nn2 - (i - 1)
    k4 = i - 1
    if nn not in memo:
        memo[nn] = factorial(nn)
    if k1 not in memo:
        memo[k1] = factorial(k1)
    if k2 not in memo:
        memo[k2] = factorial(k2)
    if nn2 not in memo:
        memo[nn2] = factorial(nn2)
    if k3 not in memo:
        memo[k3] = factorial(k3)
    if k4 not in memo:
        memo[k4] = factorial(k4)
    c = ((memo[nn] // memo[k1] // memo[k2]) * (memo[nn2] // memo[k3] // memo[k4])) % 1000000007
    ans.append(str(c))
print("\n".join(ans))


### FIXED CODE ###

from math import factorial

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

memo = dict()
ans = []
d = 0
for i in range(1, k+1):
    nn = n - k + 1
    if i > nn:
        ans.append("0")
        continue
    k1 = i
    k2 = nn - k1
    nn2 = k - 1
    k3 = i - 1
    k4 = nn2 - k3
    if nn not in memo:
        memo[nn] = factorial(nn)
    if k1 not in memo:
        memo[k1] = factorial(k1)
    if k2 not in memo:
        memo[k2] = factorial(k2)
    if nn2 not in memo:
        memo[nn2] = factorial(nn2)
    if k3 not in memo:
        memo[k3] = factorial(k3)
    if k4 not in memo:
        memo[k4] = factorial(k4)
    c = ((memo[nn] // memo[k2] // memo[k1]) * (memo[nn2] // memo[k4] // memo[k3])) % 1000000007
    ans.append(str(c))
print("\n".join(ans))
n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i range(n):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))

### FIXED CODE ###

n = int(input())
v = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
for i in range(n):
    d = v[i] - c[i]
    if 0 < d:
        ans += d
print(int(ans))
a, b, h = map(int, input().split())

print((a + b) * h / 2)


### FIXED CODE ###

a = int(input())
b = int(input())
h = int(input())

area = int((a + b) * h / 2)
print(area)
n = int(input())

al = [int(i) for i in input().split()]
bl = [int(i) for i in input().split()]

ans = 0
for i in range(n):
    if bl[i] <= al[i]:
        ans += bl[i]
    elif bl[i] > al[i] and bl[i] <= al[i] + al[i+1]:
        ans += bl[i]
        al[i+1] = al[i] + al[i+i] - bl[i]
    else:
        ans += al[i] + al[i+1]
        al[i+1] = 0
        
print(ans)
        

### FIXED CODE ###

n = int(input())
al = [int(i) for i in input().split()]
bl = [int(i) for i in input().split()]

ans = 0
for i in range(n):
    if al[i] > bl[i]:
        ans += bl[i]
    elif al[i] + al[i+1] > bl[i]:
        ans += bl[i]
        al[i+1] = al[i+1] + al[i] - bl[i]
    else:
        ans += al[i] + al[i+1]
        al[i+1] = 0
        
print(ans)
from typing import List


def diff_one(l: List[str]) -> bool:
    prev = l[0]

    for i in range(1, len(l)):
        if abs(ord(l[i]) - ord(prev)) >= 2:
            return False
        prev = l[i]

    return True


def comb(current: List[str], rest: List[str], target: int):
    if len(current) == target:
        yield current
    elif len(current) < target and len(rest) > 0:
        for i in range(len(current) + 1):
            yield from comb(current + [rest[i]], rest, target)


if __name__ == '__main__':
    n = int(input())
    alphabet = [str(chr(i)) for i in range(97, 97 + 26)]

    for perm in comb([], alphabet[:n], n):
        if diff_one(perm):
            print(perm)


### FIXED CODE ###

def comb(current, mx, target: int):
    if len(current) == target:
        yield current
    elif len(current) < target and len(alphabet) > 0:
        for i in range(mx + 1):
            yield from comb(current + [chr(i + 97)], mx + 1 if i == mx else mx, target)


if __name__ == '__main__':
    n = int(input())
    alphabet = [str(chr(i)) for i in range(97, 97 + 26)]
    result = set()

    for perm in comb([], 0, n):
        print("".join(perm))
A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if ((B-A)/(V-W)) <= T:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

A, V = map(int, input().split())
B, W = map(int, input().split())
T = int(input())

if V-W <= 0:
  print("NO")
else:
  if (abs(B-A)/(V-W)) <= T:
      print("YES")
  else:
    print("NO")
arr=[]
for i in range(5):
	t=int(input())
	arr.append(t)
ans=0
arr2=[]
for i in range(5):
	if(arr[i]%10==0):
		ans+=arr[i]
	else:
		ans+=((arr[i]//10)+1)*10
		arr2.append(arr[i]%10)
ans-=10
ans+=min(arr2)
print(ans)






### FIXED CODE ###

arr=[]
for i in range(5):
	t=int(input())
	arr.append(t)
ans=0
arr2=[]
for i in range(5):
	if(arr[i]%10==0):
		ans+=arr[i]
	else:
		ans+=((arr[i]//10)+1)*10
		arr2.append(arr[i]%10)
if(len(arr2)>0):
	ans-=10
	ans+=min(arr2)
print(ans)
import math
x,y=input().split()
x=int(x)
y=int(y)
 
def lcm(x, y):
    return (x * y)/math.gcd(x, y)
 
print(lcm(x, y))

### FIXED CODE ###

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

if (a<b):
  tmp = a
  a = b;
  b = tmp

r = a % b
while(r!=0):
  a = b
  b = r
  r = a % b

print(int(x/b))