peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted
a, b, c = map(int, input().split())

ans = 'NO'
for i in range(b):
    if ((a*i) % b) == c: ans = 'YES'
print(ans)
# Judge status: Wrong Answer
s=input()
print("Good" if any([s[i]!=s[i+1] for i in range(len(s)-1)]) else "Bad")
# Judge status: Accepted
from math import sqrt
n=int(input())
def make_divisors(n):
	lower_divisors , upper_divisors = [], []
	i = 1
	while i*i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n//i)
		i += 1
	return lower_divisors + upper_divisors[::-1]
l=make_divisors(n)
if len(l)%2==0:
	print((l[len(l)//2]+l[(len(l)//2)-1])-2)
elif len(l)%2==1:
	print(int((sqrt(n)*2)-2))
# Judge status: Wrong Answer
arr = set(map(int, input().split()))
print('AC' if len(arr) == 1 else 'WA')
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))

cnt4 = 0
cnt2 = 0
for i in a:
    if i % 4 == 0:
        cnt4 += 1
    elif i % 2 == 0:
        cnt2 += 1

if cnt4 >= n//2:
    print('Yes')
elif 2 * cnt4 >= n - cnt2:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
def is_kaibun(s):
    if len(s) % 2 == 1:
        for i in range(int((len(s) + 1) / 2)):
            if s[i] != s[-(i + 1)]:
                return False
            return True

s = input()
result = is_kaibun(s) and is_kaibun(s[:int((len(s) - 1) / 2)]) and is_kaibun(s[int(((len(s) + 3) / 2) - 1):])
print('Yes' if result else 'No')
# Judge status: Accepted
D, N = map(int, input().split())

if N < 100:
    ans = N * 100 ** D
else:
    ans = N * 100 ** D + 100**D
print(ans)
# Judge status: Accepted
from collections import deque
s = deque(input())
q = int(input())

t = 0
for _ in range(q):
  query = list(input().split())
  query[0] = int(query[0])
  if query[0] == 1: t = 1 - (t)
  else:
    if t == 0:
      if int(query[1]) == 1: s.appendleft(query[2])
      else: s.append(query[2])
    else:
      if int(query[1]) == 1: s.append(query[2])
      else: s.appendleft(query[2])
if t == 0: print(*s, sep = '')
else: print(*reversed(s), sep = '')
# Judge status: Wrong Answer
a = int(input())
b = int(input())
h = int(input())
print(0.5*h*(a+b))
# Judge status: Accepted
import numpy as np
n, k = map(int, input().split())
x = np.array(list(map(int, input().split())))

result = []
for i in range(n-k+1):
    l, r = x[i], x[i+k-1]
    if l*r >= 0:
        result.append(max(abs(l), abs(r)))
    else:
        result.append(abs(2*l-r))
        result.append(abs(2*r-l))
print(min(result))
# Judge status: Accepted
A, B, C, D = map(int, input().split())
ans = -1
for i in range(101):
    if (A <= i) and (C <= i) and (i <= B) and (i <= D):
        ans += 1
print(max(ans,0))
# Judge status: Wrong Answer
h, n = map(int, input().split())
dp = [10**10]*(h+1)
dp[0] = 0
for _ in range(n):
    a, b = map(int, input().split())
    for end in range(1, h+1):
        start = end - a
        if start < 0:
            continue
        dp[end] = min(dp[end], dp[start]+b)
print(dp[h])
# Judge status: Accepted
S=input()
list=list(S)
a=len(list)

answer=[]
s=0
while s<a:
    answer.append('x')
    s=s+1

y=''.join(answer)
print(y)
# Judge status: Accepted
N, K = map(int, input().split())

def calculate_Expectation(n):
    n = int(n)
    p = 1/n
    e = p * (n*(n+1)/2)
    return e

E = list(map(calculate_Expectation, input().split()))
if N == K:
    print(sum(E))
else:
    S = [0]
    for i, e in enumerate(E):
        S.append(S[i]+e)

    sum_of_E = []
    for left in range(1, N+1-K):
        right = left + K
        sum_of_E.append(S[right]-S[left])
    print(max(sum_of_E))
# Judge status: Wrong Answer
li = []

for i in range(5):
    li.append(int(input()))

k = int(input())

if li[0] - li[4] > k:
    print(':(')
else:
    print("Yay!")
# Judge status: Accepted
h, a = map(int, input().split())

div, mod = divmod(h, a)

if mod > 0:
    print(div + 1)
else:
    print(div)
# Judge status: Accepted
n,m=map(int,input().split())
L=[0]*m
R=[0]*m
ans=0
for i in range(m):
        L[i],R[i]=map(int,input().split())
print(max(0,(min(R)-max(L)+1)))
# Judge status: Accepted
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
cost = 0
for i in range(1,N+1):
  if i <= K:
    cost += X
  else:
    cost += Y
print(cost)
# Judge status: Accepted
sx, sy, tx, ty = map(int, input().split())

ans = ""
ans = "R"*(tx-sx) + "U"*(ty-sy) + "L"*(tx-sx) + "D"*(ty-sy) + "L" + "U"*(ty+1-sy) + "R"*(tx+1-sx) + "D" +"R" + "D"*(ty+1-sy) + "L"*(tx+1-sx) + "U"

print(ans)
# Judge status: Accepted
s = input()
rev = s[::-1]
n = len(s)
for i in range(1, n):
  l = s[i:]
  r = rev[i:]

  if l[:(n-i)//2] == l[(n-i)//2:] or r[:(n-i)//2] == r[(n-i)//2:]:
    print(n-i)
    break
# Judge status: Accepted
x,y = map(int,input().split())
for i in range(1,100):
    x = x * 2
    if x > y:
        break
print(i)
# Judge status: Accepted
import sys
input = sys.stdin.readline
from itertools import chain

def readlines(*xy):
    for n in xy:
        yield sorted(map(int, input().split()), reverse=True)[:n]
    
    yield map(int, input().split())

def main():
    x, y, a, b, c = map(int, input().split())
    apples = sorted(chain(*readlines(x,y)), reverse=True)
    print(sum(apples[:x+y]))


main()
# Judge status: Accepted
print("NO" if input().replace("eraser", "").replace("erase", "").replace("dreamer", "").replace("dream", "") else "YES")
# Judge status: Accepted
S=input()
x=int(S[:2])
y=int(S[2:4])
if 1<=x<=12:
    if 1<=y<=12:
        print("AMBIGUOUS")
    else:
        print("MMYY")
else:
    if 1<=y<=12:
        print("YYMM")
    else:
        print("NA")
# Judge status: Wrong Answer
n=input()
m=list(n)
l=[int(i) for i in m]
l.reverse()
l.append(0)
k=l
ans=0
for i in range(len(l)):
  if k[i]<6:
    ans+=k[i]
  else:
    ans+=10-k[i]
    k[i+1]+=1
print(ans)
# Judge status: Accepted
N,A,B = map(int,input().split())

count = 0
for i in range(1,N+1):
    tot = 0
    num = i
    while(num > 0):
        tot = tot + num%10
        num = int(num/10)
    if tot >= A and tot <= B:
        count += i

print(count)
# Judge status: Accepted
total, k = map(int, input().split())

d = list(map(int, input().split()))

def total_to_digits(total):
    return map(int, list(str(total)))

def find_lowest_denomination(total, d):
    res = None
    for i in range(total, 99999):
        digits = list(total_to_digits(i))
        if not (set(digits) & set(d)):
            print(i)
            return


find_lowest_denomination(total, d)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
b = [a[i]-i-1 for i in range(n)]
b.sort()
if n%2 == 0:
    c = (b[(n-2)//2] + b[n//2])//2
else:
    c = b[(n - 1) // 2]
ans = 0
for i in range(n):
    ans += abs(b[i]-c)
print(ans)
# Judge status: Wrong Answer
nums = list(map(int,input().split()))
money_sum = 500 * nums[0]
if nums[1]  < money_sum:
    print("No")
else:
    print("Yes")
# Judge status: Wrong Answer
import math
A,B,C = map(int, input().split())
if math.sqrt(A) + math.sqrt(B) < math.sqrt(C):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a,b,c = map(int,input().split())
print("Yes" if a<=c<=b else "No")
# Judge status: Wrong Answer
import sys
from functools import reduce
def gcd(m, n):
    r = m % n
    return gcd(n, r) if r else n
def gcd_list(numbers):
    return reduce(gcd, numbers)

n = int(input())
a = list(map(int, sys.stdin.readline().split()))
c = [gcd_list(a[:i] + a[i+1:]) for i in range(min(n, 20))]
c.sort()
if n == 2:
    print(c[1])
else:
    print(c[2])
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
ans = sum(a)**2
mod = 10**9 + 7

for i in range(n):
    ans -= a[i]**2
ans //= 2
print(ans%mod)
# Judge status: Accepted
n=int(input())
def prime(n):
  dic={}
  f=2
  m=n
  while f*f<=m:
    r=0
    while n%f==0:
      n//=f
      r+=1
    if r>0:
      dic[f]=r
    f+=1
  if n!=1:
    dic[n]=1
  return dic

def counter(dic):
  ans=0
  for val in dic.values():
    i=1
    while i*(i+3)/2<val:
      i+=1
    ans+=i
  return ans

print(counter(prime(n)))
# Judge status: Wrong Answer
N = int(input())
a = list(map(int, input().split()))

a_4 = [val for val in a if val % 4 == 0]
num_4=len(a_4)
a_odd = [val for val in a if val % 2 ==1]
num_odd=len(a_odd)
num_2 = N - num_odd - num_4

if num_4>=num_odd:
    print('Yes')
elif 1<=num_4 < num_odd:
    if num_2:
        print('No')
    else:
        print('Yes')
else:
    print('No')
# Judge status: Accepted
S = input()
if S.count("a") == 1  and S.count("b") == 1 and S.count("c") == 1:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
n,k = map(int,input().split())
l = list(map(int,input().split()))

l.sort()

cheap = l[:k]

print(sum(cheap))
# Judge status: Accepted
x,y = map(int, input().split())
ans = 0
if x*y<0:
    ans = abs(x+y) +1
else:
    ans = abs(x-y)
    if 0 < y and y < x:
        ans +=2
    elif x==0 and y < 0:
        ans +=1
    elif y < x and x < 0:
        ans +=2
    elif y==0 and x>0:
        ans +=1
print(ans)
# Judge status: Accepted
import math


H,W,N = [int(input()) for i in range(3)]
 
print(min(math.ceil(N/H),math.ceil(N/W)))
# Judge status: Accepted
#!/usr/bin python3
# -*- coding: utf-8 -*-

n, x, t = map(int, input().split())
ret = (n + (x-1))//x
print(ret*t)
# Judge status: Wrong Answer
def calc():
    ans = r + g + b
    
    if ans%4 == 0:
        return "YES"
    
    else:
        return "NO"
 
r, g, b = map(int, input().split())
print(calc)
# Judge status: Wrong Answer
n = int(input())
ls = list(map(int,input().split()))
for i in range(n):
    ls[i] -= i+1
mn = int(sum(ls)/n)
if sum(ls)/n> 0:
    mx = int(sum(ls)/n) +1
elif sum(ls)/n< 0:
    mx = int(sum(ls)/n)-1
else:
    mx = float("inf")
lsmn = [abs(e-mn) for e in ls]
lsmx = [abs(e-mx) for e in ls]
print(min(sum(lsmn),sum(lsmx)))
# Judge status: Wrong Answer
S = input()

a = S[:-1]
b = S[-1]
if b == 's': print(a + 'es')
else: print(a + 's')
# Judge status: Wrong Answer
S=input()
count=0
Ans=True
for i in range(len(S)):
    if i%2==1 and S[i]=="R":
        Ans=False
    elif i%2==0 and S[i]=="L": 
        Ans=False
print(Ans)
# Judge status: Wrong Answer
from fractions import gcd
s=int(input())
t=list(map(int, input().split()))
ans=t[0]
for i in t:
  ans=(ans*i)//gcd(ans,i)
mod=10**9+7
ans%=mod
a=0
for j in t:
  a+=ans//j
print(int(a)%mod)
# Judge status: Accepted
p = sorted(list(map(int, input().split())))

if p[0] == p[1]:
  if p[1] == p[2]:
    print(1)
  else:
    print(2)
elif p[1] == p[2]:
  print(2)
else:
  print(3)
# Judge status: Accepted
if __name__ == '__main__':
    n, k = map(int, input().split())
    a = list(map(int, input().split()))
    tolerance = (k - 1)
    cnt = 0
    for i in range(1, n + 10):
        if k + tolerance * (i - 1) < n:
            cnt += 1
        else:
            cnt += 1
            break

    print(cnt)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ans = 0
c = 0
for i in range(N):
	a = A[i]
	ans += B[a - 1]
	ans += c
	c = C[a - 1] if a < N else 0
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

def main():
    S = int(input())

    x1, y1 = 0, 0
    x2, y2 = 10**9, 1

    x3 = (x2 - (S % x2)) % x2
    y3 = (S + x3) // x2

    print('{} {} {} {} {} {}'.format(x1, y1, x2, y2, x3, y3))


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n, m = map(int, input().split())
cnt = 0
if n == 1 and m == 1:
  corner = 1
  wall = 0
if n > 1 and m > 1:
  corner = 4
  wall = max(0, n-2) * 2 + max(0, m-2) * 2
if n == 1 and m > 1:
  corner = 2
  wall = 0
if n > 1 and m == 1:
  corner = 2
  wall = 0
print(n * m - corner - wall)
# Judge status: Accepted
s = input().split()[1]
print("A"+s[0]+"C")
# Judge status: Accepted
s = int(input())
a = [s]
ans = 0
for i in range(1000000):
    if a[i] % 2 == 0:
        if a[i]/2 in a:
            ans = i + 2
            break
        a.append(a[i]/2)
    else:
        if 3*a[i] + 1 in a:
            ans = i + 2
            break
        a.append(3*a[i] + 1)
print(ans)
# Judge status: Accepted
r = int(input())
print(int(r*r))
# Judge status: Accepted
N, D = map(int, input().split())
ans = 0
for i in range(N):
    x, y = map(int, input().split())
    if x ** 2 + y ** 2 <= D ** 2:
        ans += 1
print(ans)
# Judge status: Accepted
a,b,c=map(int,input().split());print("YNEOS"[b-a!=c-b::2])
# Judge status: Accepted
S = input()
res = ''
for s in S:
    if s == 'B':
        res = res[:len(res)-1]
    else:
        res += s
print(res)
# Judge status: Wrong Answer
import collections as c

n = int(input())
l = [input() for _ in range(n)]
c = c.Counter(l)
c = c.most_common()
for i in c:
  if i[1] == c[0][1]: 
    print(i[0])
# Judge status: Wrong Answer
S = list(input())
print("Yes" if S.count("S")==S.count("N") and S.count("E") == S.count("W") else "No")
# Judge status: Accepted
n = int(input())
s = input()
r_list = list()
x = 0
r_list.append(x)
for t in s:
	if t == 'I':
		x = x + 1
	else:
		x = x - 1
	r_list.append(x)
print(max(r_list))
# Judge status: Accepted
n, l = map(int, input().split())

apple = [i + l for i in range(n)]
aji = sum(apple)

if 0 in apple:
    print(aji)
elif apple[0] > 0:
    print(aji - min(apple))
else:
    print(aji - max(apple))
# Judge status: Accepted
import sys
n = int(input())
a_ls = [int(i) for i in sys.stdin.readline().split()]
MOD = 10**9+7
def gcd(a, b):
    while a and b:
        if a > b:
            a %= b
        else:
            b %= a
    return max(a, b)

def lcm(a, b):
    _gcd = gcd(a, b)
    return a * b // _gcd

_a = a_ls[0]
for a in a_ls:
    _a = lcm(_a, a)
ls = [_a // a for a in a_ls]
print(sum(ls) % MOD)
# Judge status: Accepted
N=int(input())
A=list(map(int,input().split()))
A=sorted(A)
ans=0
for i in range(N):
    ans+=A[N+2*i]
 
print(ans)
# Judge status: Accepted
import random as rd
d = int(input())
c = list(map(int,input().split()))
s = []
for i in range(d):
    s.append(list(map(int,input().split())))
for i in range(d):
    print(rd.randint(1,26))
# Judge status: Wrong Answer
a = input()
if a == "RRR":
  print(3)
elif a in "RR":
  print(2)
elif a == "SSS":
  print(0)
else:
  print(1)
# Judge status: Accepted
s=input()
if(s.isupper()):
    print('A')
else:
    print('a')
# Judge status: Accepted
a,b=map(int,input().split())
if a>=13:
  print(b)
elif a>=6 and a<=12:
  print(b//2)
else:
  print(0)
# Judge status: Wrong Answer
import numpy as np
from scipy.special import comb
n,d=map(int,input().split())
x=[]
total=0
for i in range(n):
    x.append(list(map(int,input().split())))
for i in range(n):
    for j in range(n):
        if i!=j:
            a=np.array(x[i])
            b=np.array(x[j])
            u=b-a
            print(np.linalg.norm(u))
            if np.linalg.norm(u)==int(np.linalg.norm(u)):
                total+=1
print(total/2)
# Judge status: Wrong Answer
n = int(input())
a = []
b = []
for i in range(n):
    x, y = map(int, input().split())
    a.append(x)
    b.append(y)
a = a[::-1]
b = b[::-1]

ans = 0
for i in range(n):
    if b[i]==1:
        continue
    else:
        t = (a[i]+ans) % b[i]
        ans += abs(b[i]-t)

print(ans)
# Judge status: Accepted
import math

num = input()

l = len(num)

k = 0
for i in range(l):
    k += int(num[i])

ans = k % 9

if ans == 0:
    print("Yes")

else:
    print("No")
# Judge status: Wrong Answer
n,m = map(int, input().split())
mini = 0
maxi = 10**9
for i in range(m):
    l,r = map(int, input().split())
    if mini < l:
        mini = l
    if r < maxi:
        maxi = r
print(maxi-mini+1)
# Judge status: Accepted
import sys
import math
import itertools
import collections
import heapq
import re
import numpy as np
from functools import reduce

rr = lambda: sys.stdin.readline().rstrip()
rs = lambda: sys.stdin.readline().split()
ri = lambda: int(sys.stdin.readline())
rm = lambda: map(int, sys.stdin.readline().split())
rl = lambda: list(map(int, sys.stdin.readline().split()))
inf = float('inf')
mod = 10**9 + 7

a, b = rm()
c = b - a
c = c*(c+1)//2
print(c-b)
# Judge status: Accepted
N=int(input())
L=list(map(int,input().split()))
M=list(map(int,input().split()))
ans=0
for i in range(N):
	ans=max(ans,sum(L[:i+1])+sum(M[i:]))
print(ans)
# Judge status: Wrong Answer
import sys
import numpy as np
sys.setrecursionlimit(10 ** 7)

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))

cookies = np.array(lr())
if len(set(cookies)) == 1:
    print(-1)
    exit()
if any(cookies&1):
    print(0)
    exit()
count = 0
half_total = cookies.sum() // 2
while True:
    cookies = half_total - cookies//2
    count += 1
    if any(cookies&1):
        print(count)
        break
    if count == 1000000:
        print(-1)
        exit()
# Judge status: Accepted
MAX_A = 100_001
N = int(input())
A = list(map(int, input().split()))
_A = [0] * MAX_A
for a in A:
    _A[a] += 1
    if a - 1 >= 0:
        _A[a - 1] += 1
    if a + 1 < MAX_A:
        _A[a + 1] += 1
print(max(_A))
# Judge status: Wrong Answer
x, a, b = map(int, input().split())

if (x - a) < (b - x):
    print('A')
else:
    print('B')
# Judge status: Accepted
N, K, S = list(map(int, input().split()))


ans = [0] * N

tmp = S+1
if S+1 > 10 ** 9:
    tmp -= 2

for i in range(N):
    if i < K:
        ans[i] = S
    else:
        ans[i] = tmp

print(*ans)
# Judge status: Wrong Answer
n = int(input())
sum = 0
for i in range(1, n+1) :
  sum += n
print(sum)
# Judge status: Accepted
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")



n = int(input())
l = [chr(v) for v in range(ord("a"), ord("z")+1)]

ans = []
while n>0:
    n -= 1
    i,j = n//26, n%26
    ans.append(l[j])
    n = i
# ans.append(l[n])
print("".join(ans[::-1]))
# Judge status: Wrong Answer
from itertools import product
n,m,x = list(map(int, input().split()))
book = []
for i in range(n):
  book.append(list(map(int, input().split())))
ans = 10 ** 5 * n
for i in product([0,1], repeat=n):
  price = 0
  skill = [0] * m
  for index_, bit in enumerate(i):
    if bit:
      for j in range(m):
        skill[j] += book[index_][ j + 1]
      price += book[index_][0]
  if all(v >= x for v in skill):
    ans = min(ans, price)
        
print(ans)
# Judge status: Accepted
import sys
input = sys.stdin.readline
N, A, B, C, D = map(int, input().split())
S = list(input())[: -1]
tri = 0
for i in range(min(A, B) - 1, max(C, D) - 1):
  if S[i] == "#" and (S[i + 1] == "#"):
    print("No")
    exit(0)
for i in range(max(A, B) - 1, min(C, D)):
  if S[i] == "." and (S[i - 1] == ".") and (S[i + 1] == "."): tri = 1
if C <= D:
  print("Yes")
else:
  if tri: print("Yes")
  else: print("No")
# Judge status: Wrong Answer
import copy

S = input()
flag_fail = 0
N = len(S)

while N != 1:
  S_temp = copy.copy(S)
  N = len(S)
  K = N // 2
  if N == 2:
    break
  else:
    for i in range(K):
      if S_temp[i] != S_temp[N - i - 1]:
        flag_fail = 3
        break
        
  if flag_fail != 0:
    print('No')
    break
  else:
    S = []
    S = S_temp[0:K]
if flag_fail == 0:
  print('Yes')
# Judge status: Accepted
K, N = map(int, input().split(' '))
A_ls = list(map(int, input().split(' ')))
rst = -1
for i in range(N):
    l = A_ls[(i + 1) % N] - A_ls[i]
    if l < 0:
        l = K - A_ls[i] + A_ls[(i + 1) % N]
    if rst == -1:
        rst = l
    else:
        rst = max(rst, l)
print(K - rst)
# Judge status: Wrong Answer
def solve():
    N, M, X, Y = map(int, input().split())
    x = list(map(int, input().split()))
    y = list(map(int, input().split()))
    
    max_x = max(X, max(x))
    min_y = min(Y, min(y))
    if max_x < min_y:
        print('NO War')
    else:
        print('War')


if __name__ == '__main__':
    solve()
# Judge status: Accepted
import bisect
n,m = map(int, input().split())

L = [[] for i in range(n)]
D = []

for i in range(m):
    p, y= map(int, input().split())
    L[p-1].append(y)
    D.append([p,y])

for i in range(n):
    L[i].sort()

for i in range(m):
    s1 = str(D[i][0]).zfill(6)
    s2 = str(bisect.bisect_left(L[D[i][0]-1], D[i][1])+1).zfill(6)
    print(s1+s2)
# Judge status: Accepted
# -*- coding: utf-8 -*-
colors = input().split()
arr = {}
for color in colors:
    arr[color] = 1

print(len(arr))
# Judge status: Accepted
_,s=open(b:=0);w=a=s.count('.')
for c in s:b+=(x:=c<'.');w-=(x<1);a=min(a,b+w)
print(a)
# Judge status: Wrong Answer
a, b = map(int, input().split())
if a>b:
  c = a//b
  d = a/c
  e = b/c
  print(int(min(a*e, b*d)))
else:
  f = b//a
  g = a/f
  h = b/f
  print(int(min(a*h, b*g)))
# Judge status: Wrong Answer
n = int(input())
d = list(map(int, input().split()))
res = 0
for i in range(n - 1):
    if d[i]  == (i + 1): # もし同じ子がいたら
        d[i], d[i+1] = d[i+1], d[i]
        res += 1
print(res)
# Judge status: Accepted
a, b, c = map(int, input().split())
ans = c-(a-b)
if ans < 0:
    print(0)
else:
    print(ans)
# Judge status: Accepted
s = input()
s_eve = [i for i in s[::2]]
s_odd = [i for i in s[1::2]]

if 'L' not in s_eve and 'R' not in s_odd:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
A = input()
op_cnt = len(A) - 1
result = 0
for i in range(2 ** op_cnt):
    f = ""
    bag = []
    for j in range(op_cnt):
        if (i >> j) & 1:
            bag.append("+")
        else:
            bag.append("-")
    for p_n, p_o in zip(A, bag + [""]):
        f += (p_n + p_o)
    if eval(f) == 7:
        print(f+'=7')
        break
# Judge status: Accepted
N = int(input())
myList = list(map(int, input().split()))

sortedList = sorted(myList)

myDict = {sortedList[0]:1}
for myIndx1 in range(1,N):
    if sortedList[myIndx1] == sortedList[myIndx1-1]:
        myDict[sortedList[myIndx1-1]] = myDict[sortedList[myIndx1-1]] + 1
    else:
        myDict[sortedList[myIndx1]] = 1

total = 0
for myVal in myDict.values():
    total = total + int((myVal*(myVal-1))/2)

for item in myList:
    print(total - (myDict[item]-1))
# Judge status: Accepted
a,b,c=map(int,input().split())
print((a-c)//(b+c))
# Judge status: Accepted
MOD=1000000007

def fac(x):
    ret=1
    for i in range(1,x+1):
        ret*=i
        ret%=MOD
    return ret

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

if N==M:
    print(fac(N)**2*2%MOD)
elif abs(N-M)==1:
    print(fac(N)*fac(M)%MOD)
else:
    print(0)
# Judge status: Accepted
W, a, b = map(int, input().split())

if (a <= b <= a + W) or  (a <= b + W <= a + W):
  ans = 0
else:
  ans = max((b - (a + W)),(a - (b + W)))
print(ans)
# Judge status: Wrong Answer

def main():
  n = int(input())
  cnt = 0
  same = 0

  for a in range(1, n):
    for b in range(a, n):
      if a * b >= n:
        break

      cnt += 1
      if a == b:
        same += 0

  print((cnt - same) * 2 + same)



main()
# Judge status: Accepted
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = int(input())
XY = [tuple(map(int,input().split())) for i in range(n)]
for jun in itertools.permutations(range(n),n):
  cost = 0
  for i in range(1,n):
    cost += math.sqrt((XY[jun[i]][0]-XY[jun[i-1]][0])**2+(XY[jun[i]][1]-XY[jun[i-1]][1])**2)
  ans += cost
print(ans/math.factorial(n))
# Judge status: Accepted
s = input()

l = 0
ans = 0
pre = ''
for r in range(len(s)):
    if pre != s[l:r+1]:
        pre = s[l:r+1]
        l = r+1
        ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
s = input()
l = len(s)

for i in range(l):
    d = ord(s[i])
    d = d + n
    if d > 90:
        d = d - 26
    d = chr(d)
    print(d, sep="", end="")
# Judge status: Accepted
a, b, n = map(int, input().split())


if  b>n:
    print(a*n//b - a*((n)//b))
else:
    print(a*((n//b)*b-1)//b - a*(((n//b)*b-1)//b))
# Judge status: Accepted
X, Y = map(int, input().split())
ans = 0
num = X
while num <= Y:
    ans += 1
    num *= 2
print(ans)
# Judge status: Accepted
import sys
sx,sy,tx,ty = map(int,input().split())

if not ( -1000 <= sx <= 1000 and sx < tx <= 1000 ): sys.exit()
if not ( -1000 <= sy <= 1000 and sy < ty <= 1000 ): sys.exit()
if not ( isinstance(sx,int) and isinstance(sy,int) and isinstance(tx,int) and isinstance(ty,int)): sys.exit()

x=tx-sx
y=ty-sy
print('U'*y+'R'*x+'D'*y+'L'*x+'L'+'U'*(y+1)+'R'*(x+1)+'DR'+'D'*(y+1)+'L'*(x+1)+'U')