Harryxun/stf_run huggingface dataset:
M=10**9+7
n,m=map(int,input().split())
import sys, functools as ft
sys.setrecursionlimit(10**6)
@ft.lru_cache(None)
def f(n):
  if n<2: return 1
  return n*f(n-1)%M
a=0
for k in range(n+1):
  a+=(-1)**k*f(m-k)*pow(f(k)*f(n-k),-1,M)%M
print(a*f(n)*f(m)*pow(f(m-n)**2,-1,M)%M)

### FIXED CODE ###

M=10**9+7
n,m=map(int,input().split())
F=[1]
for i in range(1,m+1): F+=[i*F[-1]%M]
a=0
for k in range(n+1):
  a+=(-1)**k*F[m-k]*pow(F[k]*F[n-k],-1,M)%M
print(a*F[n]*F[m]*pow(F[m-n]**2,-1,M)%M)
import numpy as np
def main():
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    maxA=max(A)
    dp=np.array([0 for i in range(s+1)])
    dp[0]=1
    for ai in A:
        tmp=dp[:-ai].copy()
        #print(tmp)
        dp*=2
        dp[ai:]+=tmp
    print(dp[s])
    

if __name__=="__main__":
    main()


### FIXED CODE ###

import numpy as np
def main():
    n,s=map(int,input().split())
    A=list(map(int,input().split()))
    dp=np.array([0 for i in range(min(3001,s+1))])
    dp[0]=1
    for ai in A:
        tmp=dp[:-ai].copy()
        #print(tmp)
        dp*=2
        dp[ai:]+=tmp
        dp%=998244353
    print(dp[s])
    

if __name__=="__main__":
    main()
A,B,K = map(int,input().split())

if K>B-A:
  K=B-A
  
ans=[]
for i in range(K):
  ans.append(A+i)
for i in range(B-K,B):
  ans.append(i+1)
#print(ans)

n=len(ans)
print(ans[0])
for i in range(1,n):
  if ans[i]!=ans[i-1]:
    print(ans[i])
  

### FIXED CODE ###

A,B,K = map(int,input().split())

if A+K-1< B-K+1:
  for i in range(A,A+K):
    print(i)
  for i in range(B-K+1,B+1):
    print(i)
elif A+K-1>= B-K+1:
  for i in range(A,B+1):
    print(i)
n = int(input())
g = [[-1]* 15 for _ in range(15)]
for i in range(n) :
    m = int(input())
    for j in range(n) :
        x, y = map(int, input().split())
        #人iが「人xはyである」と証言している
        g[i][x-1] = y

ans = 0
for i in range(1<<n) :
    honest = [0] * n
    for j in range(n) :
        if (i>>j) & 1 == 1 :
            honest[j] = 1
    #ここまでですべての組み合わせを網羅している
    ok = True
    for j in range(n) :
        if honest[j] : #正直者の証言だけ検証する
            for k in range(n) :
                if g[j][k] == -1 :
                    continue
                if g[i][j] != honest[k] :
                    ok = False
            if ok :
                ans = max(ans, honest.count(1))
print(ans)


### FIXED CODE ###

n = int(input())
g = [[-1 for _ in range(15)] for _ in range(15)]
for i in range(n) :
    m = int(input())
    for j in range(m) :
        x,y = map(int, input().split())
        #人iが「人xはyである」と証言している
        g[i][x-1] = y

ans = 0
for i in range(1<<n) :
    honests = [0] * n
    for j in range(n) :
        if (i>>j) & 1 :
            honests[j] = 1
    ok = True
    for j in range(n) :
        if honests[j] : #正直者の証言だけ検証する
            for k in range(n) :
                if g[j][k] == -1 :
                    continue
                if g[j][k] != honests[k] :
                    ok = False
    if ok :
        ans = max(ans, honests.count(1))

print(ans)
x = ""
while True:
    try:
        x += str(input())
    except ValueError:
        pass
alist = list(x)
alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
ALPHABET = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
aa = [0]*27
for num in alist:
    itr =0
    for alp in alphabet:
        if num == alp:
            aa[itr] += 1
        itr += 1
    itr = 0
    for ALP in ALPHABET:
        if num == ALP:
            aa[itr] += 1
        itr += 1
for i in range(26):
    print("{} : {}".format(alphabet[i], aa[i]))


### FIXED CODE ###

import sys
x = ""
x = sys.stdin.read()
# while True:
#     x += str(input())
#     t = time.time()

alist = list(x)
alphabet = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
ALPHABET = ["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
aa = [0]*27
for num in alist:
    itr =0
    for alp in alphabet:
        if num == alp:
            aa[itr] += 1
            break;
        itr += 1
    itr = 0
    for ALP in ALPHABET:
        if num == ALP:
            aa[itr] += 1
            break;
        itr += 1
for i in range(26):
    print("{} : {}".format(alphabet[i], aa[i]))
n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
dp = [[[0 for _ in range(n*x_max+1)] for _ in range(n+1)] for _ in range(n+1)]

for i in range(n+1):
    for j in range(n+1):
        for k in range(n*x_max+1):
            if i == 0 and j == 0 and k == 0:
                dp[i][j][k] = 1
            elif i >= 1 and k < x[i-1]:
                dp[i][j][k] = dp[i-1][j][k]
            elif i >= 1 and j >= 1 and k >= x[i-1]:
                dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k - x[i-1]]
            else:
                dp[i][j][k] = 0
ans = 0
for k in range(n+1):
    ans += dp[n][k][k*a]
print(ans-1)

### FIXED CODE ###

n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
dp = [[[0 for _ in range(n*x_max+1)] for _ in range(n+1)] for _ in range(n+1)]

for i in range(n+1):
    for j in range(n+1):
        for k in range(n*x_max+1):
            if i == 0 and j == 0 and k == 0:
                dp[i][j][k] = 1
            elif i >= 1 and k < x[i-1]:
                dp[i][j][k] = dp[i-1][j][k]
            elif i >= 1 and j >= 1 and k >= x[i-1]:
                dp[i][j][k] = dp[i-1][j][k] + dp[i-1][j-1][k - x[i-1]]
            else:
                dp[i][j][k] = 0
ans = 0
for k in range(1, n+1):
    if k * a <= n*x_max:
        ans += dp[n][k][k*a]
print(ans)
import math
N,X,T=float(int,input().split())
B=math.ceil(N/X)
A=T*B
print(A)

### FIXED CODE ###

import math
n, x, t = map(int, input().split())
if n % x == 0:
    c = n / x
else:
    b = n / x
    c = math.ceil(b)
a = int(c * t)
print(a)
N = int(input())
H = list(map(int,input().split()))
s = 0
l =[]
for n in range(N-1):
  if H[n]>=H[n+1]:
    s += 1
    l.append(s)
  else:
    l.append(s)
    s = 0
print(max(l))

### FIXED CODE ###

N = int(input())
H = list(map(int,input().split()))
s = 0
l =[0]
for n in range(N-1):
  if H[n]>=H[n+1]:
    s += 1
    l.append(s)
  else:
    l.append(s)
    s = 0
print(max(l))
a=[print(I) for I in sorted([int(input()) for i in range(10)])[2::-1]]

### FIXED CODE ###

a=[]
for i in range(10):
    a.append(input())
a.sort()
a=a[::-1]
a=a[:3]
print(a[0])
print(a[1])
print(a[2])
#times volume24 2424
Q=int(input())
for i in range(Q):
    N=str(input())
    c=0
    while len(N)>1 and c<15:
        M=0
        for j in range(1,len(N)):
  #          print(N[:j])
            l=int(N[:j])
            r=int(N[j:])
            l*=r
            if M<l:
                M=l
        #    print(M)
        N=str(M)
        c+=1
    if c>=15:
        d=[int(N)]
        while c>=0 and c<50:
            while len(N)>1 and c<50:
                M=0
                for j in range(1,len(N)):
  #          print(N[:j])
                    l=int(N[:j])
                    r=int(N[j:])
                    l*=r
                    if M<l:
                        M=l
        #    print(M)
                k=0
                while k<len(d) and M<d[k]:
                    k+=1
                if M==d[k]:
                    c=-1
                else:
                    d.insert(j,M)
                N=str(N)
    print(c)

### FIXED CODE ###

# your code goes here
#times volume24 2424
Q=int(input())
for i in range(Q):
    N=str(input())
    c=0
    while len(N)>1 and c<15:
        M=0
        for j in range(1,len(N)):
    #        print(N[:j])
            l=int(N[:j])
            r=int(N[j:])
            l*=r
            if M<l:
                M=l
      #      print(M)
        N=str(M)
        c+=1
  #  print(N)
    if c>=15:
        d=[int(N)]
        while len(N)>1 and c>=0 and c<50:
            M=0
        #    print(d)
            for j in range(1,len(N)):
        #        print(N[:j])
                l=int(N[:j])
                r=int(N[j:])
                l*=r
                if M<l:
                    M=l
      #          print(M)
            k=0
            while k<len(d) and M>d[k]:
                k+=1
         #   print(k)
            if k>=len(d):
                k=-1
            elif M==d[k]:
                c=-1
            d.insert(k,M)
            N=str(M)
            c+=1
        #    print(k)
    print(c)
import numpy as np
A =int(raw_input())
B =int(raw_input())
T =int(raw_input())
print str(int(np.trunc((T+0.5)/A)*B))

### FIXED CODE ###

import numpy as np
nums = map(int ,raw_input().split())
print str(int(np.trunc((nums[2]+0.5)/nums[0])*nums[1]))
# -*- coding: utf-8 -*-
D, G = map(int, input().split())

cp = [tuple(map(int, input().split())) for i in range(D)]
cpg = [(c, (i + 1) * 100, (i + 1) * 100 * c + p)
       for i, (c, p) in enumerate(cp)]

cnt = 0
while True:

    c, p, g = cpg.pop()
    if G - g > 0:
        if cpg:
            cn, pn, gn = cpg[-1]
            if G - gn <= 0:
                cnt += cn
                break

        G -= g
        cnt += c
        continue

    else:

        if G / p < c:
            cnt += G // p if G % p == 0 else G // p + 1
            break

        if cpg:
            cn, pn, gn = cpg[-1]
            if G - gn <= 0 and cn < c:
                cnt += cn
                break

        else:
            cnt += c
            break

print(cnt)


### FIXED CODE ###

# -*- coding: utf-8 -*-
from itertools import product

D, G = map(int, input().split())
pc_table = [tuple(map(int, input().split())) for _ in range(D)]

bit_table = list(product([0, 1], repeat=D))
cnts = []
for bits in bit_table:
    g = sum([
        pc_table[i][1] + 100 * (i + 1) * pc_table[i][0]
        for i, bit in enumerate(bits) if bit
    ])
    cnt = sum([pc_table[i][0] for i, bit in enumerate(bits) if bit])

    if g >= G:
        cnts.append(cnt)

    else:
        max_p = max([i for i, bit in enumerate(bits) if not bit])
        for _ in range(pc_table[max_p][0]):
            g += 100 * (max_p + 1)
            cnt += 1
            if g >= G:
                cnts.append(cnt)
                break

print(min(cnts))
n = int(input())
t, a = map(int, input().split(" "))


nums = map(int, input().split(" "))

xxx = map(lambda x: abs(a-t-0.006*x), nums)

m = min(xxx)

for i, v in xxx.enumerate:
    if m == v:
        print(i)


### FIXED CODE ###

n = int(input())
t, a = map(int, input().split())
hs = list(map(int, input().split()))

min = 99999
ans = 99999

for i in range(n):
    tmp = t - hs[i] * 0.006
    d = abs(a-tmp)
    if d < min:
        ans = i
        min = d

print(ans+1)
from itertools import takewhile
from functools import reduce

data_num = int(input())
data_list = [bin(int(num)) for num in input().split(' ')]

combine_data = reduce(lambda x, y: x or y, data_list)

results = takewhile(lambda x: x == '0', combine_data[::-1])

print(len(results))

### FIXED CODE ###

from itertools import takewhile

data_num = int(input())
data_list = [bin(int(num)) for num in input().split(' ')]

results = [takewhile(lambda x: x == '0', data[::-1]) for data in data_list]

print(min([len(list(result)) for result in results]))
N = int(input())

mod_list = []
if N % 2:
    i = 1
    while True:
        num = (7*((10**i)-1)/9) % N
        if num == 0:
            print(i)
            break
        if num in mod_list:
            print(-1)
            break
        else:
            mod_list.append()
            i += 1

else:
    print(-1)


### FIXED CODE ###

N = int(input())
if N % 7:
    L = 9*N
else:
    L = 9*N//7
num = 1
if L % 2 and L % 5:
    i = 1
    while i <= L:
        num = (num*10) % L
        if num == 1:
            print(i)
            break

        else:

            i += 1

else:
    print(-1)
import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

S=input()
A=['a','b','c','b','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
if(S=='z'):
    print('a')
else:
    inds=A.index(S)
    print(A[inds+1])


### FIXED CODE ###

import sys
stdin=sys.stdin

ns = lambda:stdin.readline().rstrip()
ni = lambda:int(stdin.readline().rstrip())
nm = lambda:map(int,stdin.readline().split())
nl = lambda:list(map(int,stdin.readline().split()))

S=input()
A=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
if(S=='z'):
    print('a')
else:
    inds=A.index(S)
    print(A[inds+1])
import numpy as np

def main():
    H,N = map(int, input().split())
    weight = list(); value = list()
    for n in range(N):
        temp = input().split()
        weight.append(int(temp[0]))
        value.append(int(temp[1]))
    
    inf = float("inf")
    dp = np.zeros([N+1, H+max(weight)+1])
    for i in range(N+1):
        for j in range(H+max(weight)+1):
            dp[i,j] = inf
    for i in range(N+1): dp[i,0] = 0
    for i in range(N):
        for h in range(H+max(weight)+1):
            if(weight[i] <= h):
                dp[i+1,h]=min(dp[i,h-weight[i]]+value[i], dp[i+1,h-weight[i]]+value[i], dp[i,h])
            else:
                dp[i+1,h]=dp[i,h]
    res = int(min(dp[N][H:]))
    print(res)

if __name__ == "__main__":
    main()


### FIXED CODE ###

def main():
    H,N = map(int, input().split())
    weight = list(); value = list()
    for n in range(N):
        temp = input().split()
        weight.append(int(temp[0]))
        value.append(int(temp[1]))
    
    inf = float("inf")
    dp = [[inf for i in range(H+max(weight)+1)] for j in range(N+1)]
    for i in range(N+1): dp[i][0] = 0
    for i in range(N):
        for h in range(H+max(weight)+1):
            if(weight[i] <= h):
                dp[i+1][h]=min(dp[i][h-weight[i]]+value[i], dp[i+1][h-weight[i]]+value[i], dp[i][h])
            else:
                dp[i+1][h]=dp[i][h]
    res = int(min(dp[N][H:]))
    print(res)



if __name__ == "__main__":
    main()
n, m = map(int, input().split())

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        self.parents[x] += self.parents[y]
        self.parents[y] = x


uf = UnionFind(n)
for _ in range(m):
    a, b = map(int, input().split())
    uf.union(a, b)

ans = 0
for i in uf.parents:
    if i  < 0:
        ans += 1
print(ans-1)



### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n, m = map(int, input().split())
root = [-1] * n
def find(x):
    if root[x] < 0:
        return x
    else:
        root[x] = find(root[x])
        return root[x]
    

def unite(x, y):
    x = find(x)
    y = find(y)
    if x == y:
        return
    root[x] += root[y]
    root[y] = x
        

for _ in range(m):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    unite(a, b)

ans = len([i for i in root if i < 0]) - 1
print(ans)
D, N = input().split(" ")
D = int(D)
if int(N) == 100:
  N[2] = "1"
print(N+"0"*(2*D))


### FIXED CODE ###

D, N = map(int, input().split(" "))
if N == 100:
  N += 1
print(N*100**D)
N = int(input())
p = list(map(int, input().split()))

q = []
summation = [p[i] + p[i + 1] for i in range(N - 1)]
for i in range(int(N / 2)):
    if len(p) == 2:
        q = p + q
    else:
        index = summation.index(max(summation))
        q = p[index:index + 2] + q
        p = p[:index] + p[index + 2:]
        if index == 0:
            summation = summation[2:]
        elif index == len(summation):
            summation = summation[:index - 1]
        else:
            summation = summation[:index - 1] + [p[index - 1] + p[index]] + summation[index + 2:]

[print(i, end=' ') for i in q]


### FIXED CODE ###

N = int(input())
a = list(map(int, input().split()))

count1 = 0
count2 = 0
count4 = 0
for i in range(N):
    value = a[i] % 4
    if value == 0:
        count4 += 1
    elif value == 2:
        count2 += 1
    else:
        count1 += 1

if count1 <= count4 or (count1 - count4 == 1 and count2 == 0):
    print('Yes')
else:
    print('No')
n = input()

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

eve = []
odd = []

for i in range(len(v)):

    if (i % 2 == 1):
        eve.append(v[i])
    else:
        odd.append(v[i])

dic_o = {}
dic_e = {}

dic_o[-1] = 0
dic_e[-1] = 0
#print (dic_o)

for i in odd:

    if ( i in dic_o.keys() ):
        dic_o[i] += 1
    else:
        dic_o[i] = 1


for i in eve:

    if ( i in dic_e.keys() ):
        dic_e[i] += 1
    else:
        dic_e[i] = 1

omax = -1
emax = -1
bul = True

while bul:

    for i in dic_o:
        
        if omax < 0:
            omax = i
        
        elif dic_o[i] > dic_o[omax] :
            omax = i

    for i in dic_e:

        if emax < 0:
            emax = i
        
        elif dic_e[i] > dic_e[emax] :
            emax = i

    if omax != emax :
        bul = False

    else:

        print(dic_o,dic_e)
        
        flag = True
        
        for i in dic_e:
            if dic_e[i] == dic_e[emax] and i != emax:
                emax = i
                flag = False

        if flag:
            for i in dic_o:
                if dic_o[i] == dic_o[emax] and i != omax:
                    omax = i
                    flag = False

        if flag:
        
            if dic_o[omax] > dic_e[emax]:
        
                dic_e.pop(emax)
                emacs = -1

            else:

                dic_o.pop(omax)
                emacs = -1

    
emax_n = dic_e[emax]
omax_n = dic_o[omax]

#print (dic_o,dic_e)
#print (omax,emax)
print ( (len(odd) - omax_n) + (len(eve) - emax_n))


### FIXED CODE ###


n = int(input())
odd = {}
eve = {}

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

for i in range(n):
    
    new_v = nums[i]
    
    if (i % 2 == 0):

        if new_v in odd:
            odd[new_v] += 1

        else:
            odd[new_v] = 1

    else:

        if new_v in eve:
            eve[new_v] += 1

        else:
            eve[new_v] = 1



odd_m = max(odd , key=odd.get)
eve_m = max(eve , key=eve.get)

odd_c = odd.copy()
eve_c = eve.copy()

del odd_c[odd_m]
del eve_c[eve_m]

if len(odd_c) == 0:
    odd_mt = 0
else:
    odd_mt = max(odd_c , key=odd.get)

if len(eve_c) == 0:
    eve_mt = 0
else:
    eve_mt = max(eve_c , key=eve.get)

odd[0] = 0
eve[0] = 0


if odd_m != eve_m:
    print (n - odd[odd_m] - eve[eve_m])

elif odd[odd_m] + eve[eve_mt] > odd[odd_mt] + eve[eve_m] :
    print (n - odd[odd_m] - eve[eve_mt])

else:
    print (n - odd[odd_mt] - eve[eve_m])
mod = 10 ** 9 + 7
N, M = [int(_) for _ in input().split()]

factorize_result = {}
def factorization(n):
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            factorize_result[i] = 1
            n = n // i
            while n % i == 0:
                factorize_result[i] += 1
                n = n // i
    if n > 1:
        factorize_result[n] = 1


factorial = [1] * (2 * N)
def calc_factorial():
    for i in range(1, 2 * N):
        factorial[i] = i * factorial[i - 1] % mod


def comb(n, k):
    a = factorial[n] % mod
    b = (factorial[k] * factorial[n - k]) % mod
    b_ = pow(b, mod - 2, mod)
    return (a * b_) % mod


# 素因数分解
factorization(M)

# 階乗を用意
calc_factorial()

ans = 1
for k, v in factorize_result.items():
    ans *= comb(N + v - 1, v) % mod

print(ans % mod)


### FIXED CODE ###

mod = 10 ** 9 + 7
N, M = [int(_) for _ in input().split()]

MAX_N = 10 ** 5 + 100

factorize_result = {}
def factorization(n):
    for i in range(2, int(n ** 0.5) + 1):
        if n % i == 0:
            factorize_result[i] = 1
            n = n // i
            while n % i == 0:
                factorize_result[i] += 1
                n = n // i
    if n > 1:
        factorize_result[n] = 1


factorial = [1] * MAX_N
def calc_factorial():
    for i in range(1, MAX_N):
        factorial[i] = i * factorial[i - 1] % mod


def comb(n, k):
    a = factorial[n] % mod
    b = (factorial[k] * factorial[n - k]) % mod
    b_ = pow(b, mod - 2, mod)
    return (a * b_) % mod


# 素因数分解
factorization(M)

# 階乗を用意
calc_factorial()

ans = 1
for k, v in factorize_result.items():
    ans *= comb(N + v - 1, v) % mod

print(ans % mod)
n = int(input())

for i in range(0.9*n//1, n):
  if (i * 1.08) // 1 == n:
    print(i)
    break
else:
  print(':(')

### FIXED CODE ###

n = int(input())
 
ans = -1
for i in range(1, n+1):
  if int(i  * 1.08) == n:
    ans = i
if ans == -1:
  print(':(')
else:
  print(ans)
a,b = map(int,input().split())
import math
def lcm(x, y):
    return (x * y) // math.gcd(x, y)
print(lcm(a, b))

### FIXED CODE ###

a,b = map(int,input().split())
import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)
print(lcm(a, b))
import math

N = input()
list = []
min = 0
for i in range(5)
	list.append(int(input()))
	if min > list[i] or i = 0:
      min = list[i]

print(math.ceil(N/min) + 4)


### FIXED CODE ###

import math

N = int(input())
list = []
min = 0
for i in range(5):
  list.append(int(input()))
  if min > list[i] or i == 0:
    min = list[i]

print(math.ceil(N/min) + 4)
n = int(input())
if n%3 == 0:
    if n == 111:
        print 3
    else
        print 0
elif n%3 ==1:
    print 1
else
    print 2

### FIXED CODE ###

n = int(input())
if n%3 == 0:
    if n == 111:
        print(3)
    else:
        print (0)
elif n%3 ==1:
    print(1)
else:
    print(2)
s = input()
dp = [0]*(len(s) + 1)
dp[0] = 1
judge = 'NO'
word = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(s)):
  if d[i] = 0:
    continue
  for w in words():
    if s[i:i+len(w)] == w:
      dp[i+len(w)] = 1
    if dp[len(s)] == 1:
      judge = 'YES'
      break
print(judge)

### FIXED CODE ###

s = input()
dp = [0]*(len(s) + 1)
dp[0] = 1
judge = 'NO'
words = ['dream', 'dreamer', 'erase', 'eraser']
for i in range(len(s)):
  if dp[i] == 0:
    continue
  for w in words:
    if s[i:i+len(w)] == w:
      dp[i+len(w)] = 1
    if dp[len(s)] == 1:
      judge = 'YES'
      break
print(judge)
a, b, x = map(int, raw_input().split())

i = a
count = 0
for i in i < b + 1:
    if x%i == 0:
        count = count + 1

print count


### FIXED CODE ###

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

i = a
count = 0
count_b = 0
count_a = 0

count_b = b/x
count_a = (a-1)/x


print count_b - count_a
n=int(input())
l=[0]+list(map(int,input().split()))\
ans=sum(l)
for i in range(int(input())):
  a,s=map(int,input().split())
  print(ans-l[a]+s)

### FIXED CODE ###

n=int(input())
t=[0]+list(map(int,input().split()))
ans=sum(t)
o=ans
for i in range(int(input())):
    p,x=map(int,input().split())
    print(ans-t[p]+x)
from itertools import accumulate

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

# 期待値の前計算
expP = [(P[i]+1)/2 for i in range(n)]

# 累積和の計算
acc = [0]+ list(+accumulate(expP)) # 0を忘れずに
print(acc)

# 隣接する K 項の和の計算
ans = 0
for i in range(n-k+1):
  ans = max(ans,acc[i+k]-acc[i])
print(ans)

### FIXED CODE ###

from itertools import accumulate

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

# 期待値の前計算
expP = [(P[i]+1)/2 for i in range(n)]

# 累積和の計算
acc = [0]+ list(accumulate(expP)) # 0を忘れずに

# 隣接する K 項の和の計算
ans = 0
for i in range(n-k+1):
  ans = max(ans,acc[i+k]-acc[i])
print(ans)
N=int(input())
sen = N % 1000:

for N in 10000:
  if N % 1000 == 0：
  print(0)
else:
  atai = N - sen
  print(sen + atai )

### FIXED CODE ###

#! /usr/bin/python3

N = int(input())
1 <= N <= 10000

if N % 1000 == 0:
 print(0)
else:
  sen = N//1000
  sen2 = sen*1000
  atai = N-sen2
  atai2 = 1000-atai
  print(atai2)
e = input()
R = input()

if int(e) >= 10:
     print(R)
else :
     K = 100 * (10 - int(e))
     print(K)


### FIXED CODE ###

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

#print(a ,type(a))
if x<10:
    print(y+(100*(10-x)))
else:
    print(y)