Input:
# -*- coding: utf-8 -*-

# 標準入力の取得

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

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

A, B = [], []

for m in range(M):

    A_m, B_m = list(map(int, input().split()))

    A.append(A_m)

    B.append(B_m)

# 求解処理

observatory = [True for n in range(N)]

for A_m, B_m in zip(A, B):

    lower_observatory = int()

    if H[A_m-1] < H[B_m-1]:

        observatory[A_m-1] = False

    elif H[A_m-1] > H[B_m-1]:

        observatory[B_m-1] = False

    else:

        observatory[A_m-1] = False

        observatory[B_m-1] = False

result = sum(observatory)

# 結果出力

print(result)

# -*- coding: utf-8 -*-

# 標準入力の取得

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

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

A, B = [], []

for m in range(M):

    A_m, B_m = list(map(int, input().split()))

    A.append(A_m)

    B.append(B_m)

def main() -> None:

    """Entry point

    """

    # 求解処理

    # 道ごとに「良い展望台」ではない展望台を削除し、残りの展望台の数を計算する。

    observatory = [True for n in range(N)]  # 初期状態はすべて「良い展望台」

    for A_m, B_m in zip(A, B):

        A_m -= 1  # インデックス番号に変換

        B_m -= 1  # インデックス番号に変換

        if H[A_m] < H[B_m]:

            observatory[A_m] = False

        elif H[A_m] > H[B_m]:

            observatory[B_m] = False

        else:

            observatory[A_m] = False

            observatory[B_m] = False

    result = sum(observatory)

    # 結果出力

    print(result)

if __name__ == "__main__":

    main()

# -*- coding: utf-8 -*-
# 標準入力の取得
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
A, B = [], []
for m in range(M):
    A_m, B_m = list(map(int, input().split()))
    A.append(A_m)
    B.append(B_m)
# 求解処理
observatory = [True for n in range(N)]
for A_m, B_m in zip(A, B):
    lower_observatory = int()
    if H[A_m - 1] < H[B_m - 1]:
        observatory[A_m - 1] = False
    elif H[A_m - 1] > H[B_m - 1]:
        observatory[B_m - 1] = False
    else:
        observatory[A_m - 1] = False
        observatory[B_m - 1] = False
result = sum(observatory)
# 結果出力
print(result)

# -*- coding: utf-8 -*-
# 標準入力の取得
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
A, B = [], []
for m in range(M):
    A_m, B_m = list(map(int, input().split()))
    A.append(A_m)
    B.append(B_m)

def main() -> None:
    """Entry point"""
    # 求解処理
    # 道ごとに「良い展望台」ではない展望台を削除し、残りの展望台の数を計算する。
    observatory = [True for n in range(N)]  # 初期状態はすべて「良い展望台」
    for A_m, B_m in zip(A, B):
        A_m -= 1  # インデックス番号に変換
        B_m -= 1  # インデックス番号に変換
        if H[A_m] < H[B_m]:
            observatory[A_m] = False
        elif H[A_m] > H[B_m]:
            observatory[B_m] = False
        else:
            observatory[A_m] = False
            observatory[B_m] = False
    result = sum(observatory)
    # 結果出力
    print(result)

if __name__ == "__main__":
    main()

+    # 道ごとに「良い展望台」ではない展望台を削除し、残りの展望台の数を計算する。

+    observatory = [True for n in range(N)]  # 初期状態はすべて「良い展望台」

+        A_m -= 1  # インデックス番号に変換

+        B_m -= 1  # インデックス番号に変換


Input:
import numpy as np

from bisect import bisect_left

def primes():

    p = []

    c = np.ones(10**5 + 10)

    c[0] = c[1] = 0

    for i, f in enumerate(c):

        if f:

            p.append(i)

            c[2 * i:10**5 + 10:i] = 0

    return p

def solve(string):

    x = int(string)

    ps = primes()

    return str(ps[bisect_left(ps, x)])

if __name__ == '__main__':

    import sys

    print((solve(sys.stdin.read().strip())))

def solve(string):

    x = int(string)

    for i in range(x, 2 * x):

        for j in range(2, int(i**0.5)):

            if i % j == 0:

                break

        else:

            return str(i)

if __name__ == '__main__':

    import sys

    print((solve(sys.stdin.read().strip())))

import numpy as np
from bisect import bisect_left

def primes():
    p = []
    c = np.ones(10**5 + 10)
    c[0] = c[1] = 0
    for i, f in enumerate(c):
        if f:
            p.append(i)
            c[2 * i : 10**5 + 10 : i] = 0
    return p

def solve(string):
    x = int(string)
    ps = primes()
    return str(ps[bisect_left(ps, x)])

if __name__ == "__main__":
    import sys

    print((solve(sys.stdin.read().strip())))

def solve(string):
    x = int(string)
    for i in range(x, 2 * x):
        for j in range(2, int(i**0.5)):
            if i % j == 0:
                break
        else:
            return str(i)

if __name__ == "__main__":
    import sys

    print((solve(sys.stdin.read().strip())))

+        for j in range(2, int(i**0.5)):


Input:
#!usr/bin/env python3

from collections import defaultdict

def main():

    #Read stdin

    fl = input().split(" ")

    V = int(fl[0])

    E = int(fl[1])

    R = int(fl[2])

    #Adjacency list

    G = defaultdict(list)

    for i in range(int(E)):

        s, t, w = [int(x) for x in input().split(" ")]

        G[s].append((t,w))

    #initialized

    d = {}

    INF = float('inf')

    #INF = 10001

    for i in range(V):

        d[i] = INF

    d[R] = 0

    q = [R]

    while q:

        u = q.pop(0)

        for v in G[u]:

            if d[v[0]] > d[u] + v[1]:

                d[v[0]] = d[u] + v[1]

                q.append(v[0])

    for k in range(V):

        if d[k] == float('inf'):

            print("INF")

        else:

            print((d[k]))

if __name__ == '__main__':

    main()

from collections import defaultdict

from collections import deque

#import time

def main():

    # Read stdin

    #start = time.clock()

    fl = input().split(" ")

    V = int(fl[0])

    E = int(fl[1])

    R = int(fl[2])

    # Adjacency list

    G = defaultdict(list)

    for i in range(int(E)):

        s, t, w = [int(x) for x in input().split(" ")]

        G[s].append((t, w))

    # initialized

    d = {}

    INF = float('inf')

    # INF = 10001

    for i in range(V):

        d[i] = INF

    d[R] = 0

    q = deque([R])

    while q:

        # u = heappop(q)

        u = q.popleft()

        for v in G[u]:

            if d[v[0]] > d[u] + v[1]:

                d[v[0]] = d[u] + v[1]

                # heappush(q, v[0])

                q.append(v[0])

    #end = time.clock() - start

    for k in range(V):

        if d[k] == float('inf'):

            print("INF")

        else:

            print((d[k]))

    #print('Computation time : {}'.format(end))

if __name__ == '__main__':

    main()

#!usr/bin/env python3
from collections import defaultdict

def main():
    # Read stdin
    fl = input().split(" ")
    V = int(fl[0])
    E = int(fl[1])
    R = int(fl[2])
    # Adjacency list
    G = defaultdict(list)
    for i in range(int(E)):
        s, t, w = [int(x) for x in input().split(" ")]
        G[s].append((t, w))
    # initialized
    d = {}
    INF = float("inf")
    # INF = 10001
    for i in range(V):
        d[i] = INF
    d[R] = 0
    q = [R]
    while q:
        u = q.pop(0)
        for v in G[u]:
            if d[v[0]] > d[u] + v[1]:
                d[v[0]] = d[u] + v[1]
                q.append(v[0])
    for k in range(V):
        if d[k] == float("inf"):
            print("INF")
        else:
            print((d[k]))

if __name__ == "__main__":
    main()

from collections import defaultdict
from collections import deque

# import time
def main():
    # Read stdin
    # start = time.clock()
    fl = input().split(" ")
    V = int(fl[0])
    E = int(fl[1])
    R = int(fl[2])
    # Adjacency list
    G = defaultdict(list)
    for i in range(int(E)):
        s, t, w = [int(x) for x in input().split(" ")]
        G[s].append((t, w))
    # initialized
    d = {}
    INF = float("inf")
    # INF = 10001
    for i in range(V):
        d[i] = INF
    d[R] = 0
    q = deque([R])
    while q:
        # u = heappop(q)
        u = q.popleft()
        for v in G[u]:
            if d[v[0]] > d[u] + v[1]:
                d[v[0]] = d[u] + v[1]
                # heappush(q, v[0])
                q.append(v[0])
    # end = time.clock() - start
    for k in range(V):
        if d[k] == float("inf"):
            print("INF")
        else:
            print((d[k]))
    # print('Computation time : {}'.format(end))

if __name__ == "__main__":
    main()

+    # print('Computation time : {}'.format(end))


Input:
from decimal import *

import re

def solve2(m, n):

    maxlen = 160

    PREC=200

    getcontext().prec = PREC

    x = Decimal(m) / Decimal(n)

    s = x.to_eng_string()

    if len(s) < PREC:

        return(s[2:],'')

    rep = 1

    while True:

        r = r'(.{%d})\1{%d,}' % (rep, int(maxlen/rep)-1)  #ex. '(.{6})\\1{12,}'

        a=re.search(r, s)

        if a:

            break

        rep += 1

        if rep > maxlen:

            raise ValueError('This cannot happen.rep=%d' % rep)

    u = s[2:a.start()+len(a.group(1))]

    v = (' '*PREC + '^'*len(a.group(1)))[-len(u):]

    return(u,v)

while True:

    try:

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

        s,t = solve2(m, n)

        print(s)

        if t!='':

            print(t)

    except EOFError:

        break

from decimal import *

import re

def solve2(m, n):

    maxlen = 80

    PREC=200

    getcontext().prec = PREC

    x = Decimal(m) / Decimal(n)

    s = x.to_eng_string()

    if len(s) < PREC:

        return(s[2:],'')

    rep = 1

    while True:

        r = r'(.{%d})\1{%d,}' % (rep, int(maxlen/rep))  #ex. '(.{6})\\1{12,}'

        a=re.search(r, s)

        if a:

            break

        rep += 1

        if rep > maxlen:

            raise ValueError('This cannot happen.rep=%d' % rep)

    u = s[2:a.start()+len(a.group(1))]

    v = (' '*PREC + '^'*len(a.group(1)))[-len(u):]

    return(u,v)

while True:

    try:

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

        s,t = solve2(m, n)

        print(s)

        if t!='':

            print(t)

    except EOFError:

        break

from decimal import *
import re

def solve2(m, n):
    maxlen = 160
    PREC = 200
    getcontext().prec = PREC
    x = Decimal(m) / Decimal(n)
    s = x.to_eng_string()
    if len(s) < PREC:
        return (s[2:], "")
    rep = 1
    while True:
        r = r"(.{%d})\1{%d,}" % (rep, int(maxlen / rep) - 1)  # ex. '(.{6})\\1{12,}'
        a = re.search(r, s)
        if a:
            break
        rep += 1
        if rep > maxlen:
            raise ValueError("This cannot happen.rep=%d" % rep)
    u = s[2 : a.start() + len(a.group(1))]
    v = (" " * PREC + "^" * len(a.group(1)))[-len(u) :]
    return (u, v)

while True:
    try:
        m, n = list(map(int, input().strip().split()))
        s, t = solve2(m, n)
        print(s)
        if t != "":
            print(t)
    except EOFError:
        break

from decimal import *
import re

def solve2(m, n):
    maxlen = 80
    PREC = 200
    getcontext().prec = PREC
    x = Decimal(m) / Decimal(n)
    s = x.to_eng_string()
    if len(s) < PREC:
        return (s[2:], "")
    rep = 1
    while True:
        r = r"(.{%d})\1{%d,}" % (rep, int(maxlen / rep))  # ex. '(.{6})\\1{12,}'
        a = re.search(r, s)
        if a:
            break
        rep += 1
        if rep > maxlen:
            raise ValueError("This cannot happen.rep=%d" % rep)
    u = s[2 : a.start() + len(a.group(1))]
    v = (" " * PREC + "^" * len(a.group(1)))[-len(u) :]
    return (u, v)

while True:
    try:
        m, n = list(map(int, input().strip().split()))
        s, t = solve2(m, n)
        print(s)
        if t != "":
            print(t)
    except EOFError:
        break


Input:
# import sys

# input = sys.stdin.readline

N = int(eval(input()))

Slist = []

for i in range(N):

    Slist.append(eval(input()))

    # if S in Slist.keys():

    #     Slist[S] += 1

    #     if Slist[S] > maxNum:

    #         maxNum = Slist[S]

    # else:

    #     Slist[S] = 1

Slist.sort()

max_cnt = 1

cnt = 1

s_old = Slist[0]

max_Slist = []

for i in range(1,N):

    if Slist[i] == s_old:

        cnt += 1

    else:

        if cnt > max_cnt:

            max_cnt = cnt

            max_Slist = [s_old]

        elif cnt == max_cnt:

            max_Slist.append(s_old)

        s_old = Slist[i]

        cnt = 1

if Slist[N-1] == s_old:

    if cnt > max_cnt:

        max_Slist = [s_old]

    elif cnt == max_cnt:

        max_Slist.append(s_old)

for str in max_Slist:

    print(str)

import sys

input = sys.stdin.readline

N = int(eval(input()))

Slist = []

for i in range(N):

    Slist.append(eval(input()))

    # if S in Slist.keys():

    #     Slist[S] += 1

    #     if Slist[S] > maxNum:

    #         maxNum = Slist[S]

    # else:

    #     Slist[S] = 1

Slist.sort()

max_cnt = 1

cnt = 1

s_old = Slist[0]

max_Slist = []

for i in range(1,N):

    if Slist[i] == s_old:

        cnt += 1

    else:

        if cnt > max_cnt:

            max_cnt = cnt

            max_Slist = [s_old]

        elif cnt == max_cnt:

            max_Slist.append(s_old)

        s_old = Slist[i]

        cnt = 1

if Slist[N-1] == s_old:

    if cnt > max_cnt:

        max_Slist = [s_old]

    elif cnt == max_cnt:

        max_Slist.append(s_old)

for str in max_Slist:

    print(str)

# import sys
# input = sys.stdin.readline
N = int(eval(input()))
Slist = []
for i in range(N):
    Slist.append(eval(input()))
    # if S in Slist.keys():
    #     Slist[S] += 1
    #     if Slist[S] > maxNum:
    #         maxNum = Slist[S]
    # else:
    #     Slist[S] = 1
Slist.sort()
max_cnt = 1
cnt = 1
s_old = Slist[0]
max_Slist = []
for i in range(1, N):
    if Slist[i] == s_old:
        cnt += 1
    else:
        if cnt > max_cnt:
            max_cnt = cnt
            max_Slist = [s_old]
        elif cnt == max_cnt:
            max_Slist.append(s_old)
        s_old = Slist[i]
        cnt = 1
if Slist[N - 1] == s_old:
    if cnt > max_cnt:
        max_Slist = [s_old]
    elif cnt == max_cnt:
        max_Slist.append(s_old)
for str in max_Slist:
    print(str)

import sys

input = sys.stdin.readline
N = int(eval(input()))
Slist = []
for i in range(N):
    Slist.append(eval(input()))
    # if S in Slist.keys():
    #     Slist[S] += 1
    #     if Slist[S] > maxNum:
    #         maxNum = Slist[S]
    # else:
    #     Slist[S] = 1
Slist.sort()
max_cnt = 1
cnt = 1
s_old = Slist[0]
max_Slist = []
for i in range(1, N):
    if Slist[i] == s_old:
        cnt += 1
    else:
        if cnt > max_cnt:
            max_cnt = cnt
            max_Slist = [s_old]
        elif cnt == max_cnt:
            max_Slist.append(s_old)
        s_old = Slist[i]
        cnt = 1
if Slist[N - 1] == s_old:
    if cnt > max_cnt:
        max_Slist = [s_old]
    elif cnt == max_cnt:
        max_Slist.append(s_old)
for str in max_Slist:
    print(str)

-# import sys
-# input = sys.stdin.readline
+import sys
+
+input = sys.stdin.readline


Input:
N = int(eval(input()))

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

blist = []

for i in range(N):

    blist.append(alist[i]-i-1)

blist.sort()

mid = blist[len(blist)//2]

ans = 0

for i in range(N):

    ans += abs(blist[i]-mid)

print(ans)

N = int(eval(input()))

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

blist = []

for i in range(N):

    blist.append(alist[i]-i-1)

blist.sort()

mid = blist[N//2]

print((sum([abs(b-mid) for b in blist])))

N = int(eval(input()))
alist = list(map(int, input().split()))
blist = []
for i in range(N):
    blist.append(alist[i] - i - 1)
blist.sort()
mid = blist[len(blist) // 2]
ans = 0
for i in range(N):
    ans += abs(blist[i] - mid)
print(ans)

N = int(eval(input()))
alist = list(map(int, input().split()))
blist = []
for i in range(N):
    blist.append(alist[i] - i - 1)
blist.sort()
mid = blist[N // 2]
print((sum([abs(b - mid) for b in blist])))

+print((sum([abs(b - mid) for b in blist])))


Input:
n = int(eval(input()))

a = [[]]*n

for i in range(n):

  a[i] = list(map(int, input().split()))

a.sort()

print((a[-1][0]+a[-1][1]))

def main():

  n = int(eval(input()))

  a = [[]]*n

  for i in range(n):

    a[i] = list(map(int, input().split()))

  a.sort()

  print((a[-1][0]+a[-1][1]))

main()

def main():
    n = int(eval(input()))
    a = [[]] * n
    for i in range(n):
        a[i] = list(map(int, input().split()))
    a.sort()
    print((a[-1][0] + a[-1][1]))

main()

-    a[i] = list(map(int, input().split()))

+        a[i] = list(map(int, input().split()))


Input:
n = int(eval(input()))

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

ans = 0

while not any(i&1 for i in a):

    ans += 1

    a = [i//2 for i in a]

print(ans)

n = int(eval(input()))

a = {int(i) for i in input().split()}

ans = 0

while not any(i&1 for i in a):

    ans += 1

    a = {i//2 for i in a}

print(ans)

n = int(eval(input()))
a = [int(i) for i in input().split()]
ans = 0
while not any(i & 1 for i in a):
    ans += 1
    a = [i // 2 for i in a]
print(ans)

n = int(eval(input()))
a = {int(i) for i in input().split()}
ans = 0
while not any(i & 1 for i in a):
    ans += 1
    a = {i // 2 for i in a}
print(ans)

-a = [int(i) for i in input().split()]
+a = {int(i) for i in input().split()}
-    a = [i // 2 for i in a]
+    a = {i // 2 for i in a}


Input:
def solve():

    for _ in range(int(eval(input()))):

        if int(eval(input())) & 1:

            return "first"

    return "second "

print((solve()))

import sys

readline = sys.stdin.readline

from itertools import product

def solve():

    for _ in range(int(eval(input()))):

        if int(readline()) & 1:

            return "first"

    return "second "

print((solve()))

+import sys
+
+readline = sys.stdin.readline
+from itertools import product
+
+
-        if int(eval(input())) & 1:
+        if int(readline()) & 1:


Input:
A, B = list(map( int, input().split()))

C = [ A + B, A - B, A * B]

print((max(C)))

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

print((max( A + B, A - B, A * B)))

A, B = list(map(int, input().split()))
C = [A + B, A - B, A * B]
print((max(C)))

A, B = list(map(int, input().split()))
print((max(A + B, A - B, A * B)))

-C = [A + B, A - B, A * B]
-print((max(C)))
+print((max(A + B, A - B, A * B)))


Input:
def main():

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

    S = [ int(s) for s in list(eval(input()))][::-1]

    if P == 2 or P == 5:

        ans = 0

        for i in range(N):

            if S[i]%P == 0:

                ans += N-i

        print(ans)

        return

    L = [0]*P

    L[0] = 1

    t = 0

    for i in range(N):

        t = (S[i]*pow(10,i,P)+t)%P

        L[t] += 1

    ans = 0

    for l in L:

        ans += l*(l-1)//2

    print(ans)

if __name__ == '__main__':

    main()

def main():

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

    S = [ int(s) for s in list(eval(input()))][::-1]

    if P == 2 or P == 5:

        ans = 0

        for i in range(N):

            if S[i]%P == 0:

                ans += N-i

        print(ans)

        return

    L = [0]*P

    L[0] = 1

    t = 0

    s = 1

    for i in range(N):

        t = (S[i]*s+t)%P

        L[t] += 1

        s *= 10

        s %= P

    ans = 0

    for l in L:

        ans += l*(l-1)//2

    print(ans)

if __name__ == '__main__':

    main()

def main():
    N, P = list(map(int, input().split()))
    S = [int(s) for s in list(eval(input()))][::-1]
    if P == 2 or P == 5:
        ans = 0
        for i in range(N):
            if S[i] % P == 0:
                ans += N - i
        print(ans)
        return
    L = [0] * P
    L[0] = 1
    t = 0
    for i in range(N):
        t = (S[i] * pow(10, i, P) + t) % P
        L[t] += 1
    ans = 0
    for l in L:
        ans += l * (l - 1) // 2
    print(ans)

if __name__ == "__main__":
    main()

def main():
    N, P = list(map(int, input().split()))
    S = [int(s) for s in list(eval(input()))][::-1]
    if P == 2 or P == 5:
        ans = 0
        for i in range(N):
            if S[i] % P == 0:
                ans += N - i
        print(ans)
        return
    L = [0] * P
    L[0] = 1
    t = 0
    s = 1
    for i in range(N):
        t = (S[i] * s + t) % P
        L[t] += 1
        s *= 10
        s %= P
    ans = 0
    for l in L:
        ans += l * (l - 1) // 2
    print(ans)

if __name__ == "__main__":
    main()


Input:
n,m=list(map(int,input().split()))

stair_m=[True]*(110000)

for i in range(m):

    a=int(eval(input()))

    stair_m[a]=False

dp=[0]*(110000)

dp[0]=1

for i in range(1,n+1):

    if stair_m[i]:

        dp[i]=dp[i-1]+dp[i-2]

    else:

        dp[i]=0

print((dp[n]%1000000007))

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

stair=[False]*(n+1)

for i in range(m):

    a=int(eval(input()))

    stair[a]=True

dp=[0]*(n+1)

dp[0]=1

for i in range(1,n+1):

    if stair[i]:

        dp[i]=0

    else:

        dp[i]=(dp[i-1]+dp[i-2])%(10**9+7)

print((dp[n]))

n, m = list(map(int, input().split()))
stair_m = [True] * (110000)
for i in range(m):
    a = int(eval(input()))
    stair_m[a] = False
dp = [0] * (110000)
dp[0] = 1
for i in range(1, n + 1):
    if stair_m[i]:
        dp[i] = dp[i - 1] + dp[i - 2]
    else:
        dp[i] = 0
print((dp[n] % 1000000007))

n, m = list(map(int, input().split()))
stair = [False] * (n + 1)
for i in range(m):
    a = int(eval(input()))
    stair[a] = True
dp = [0] * (n + 1)
dp[0] = 1
for i in range(1, n + 1):
    if stair[i]:
        dp[i] = 0
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % (10**9 + 7)
print((dp[n]))


Input:
# coding: utf-8

# Your code here!

S = eval(input())

N = len(S)

S = S[::-1]

#print(S)

L = ['maerd', 'remaerd', 'esare', 'resare']

while len(S) > 0:

    if S[:5] in L:

        S = S[5:]

    elif S[:6] in L:

        S = S[6:]

    elif S[:7] in L:

        S = S[7:]

    else:

        print('NO')

        break

if len(S) == 0:

    print('YES')

# coding: utf-8

import math

#n = int(input())

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

#A = list(map(int,input().split()))

ans = 0

s = eval(input())

n = len(s)

s=s[::-1]

i=0

flg=True

while True:

    if i>=n:

        break

    if s[i:i+7]=="remaerd":

        i+=7

    elif s[i:i+6]=="resare":

        i+=6

    elif s[i:i+5]=="maerd" or s[i:i+5]=="esare":

        i+=5

    else:

        flg=False

        break

if flg:

    print("YES")

else:

    print("NO")

# coding: utf-8
# Your code here!
S = eval(input())
N = len(S)
S = S[::-1]
# print(S)
L = ["maerd", "remaerd", "esare", "resare"]
while len(S) > 0:
    if S[:5] in L:
        S = S[5:]
    elif S[:6] in L:
        S = S[6:]
    elif S[:7] in L:
        S = S[7:]
    else:
        print("NO")
        break
if len(S) == 0:
    print("YES")

# coding: utf-8
import math

# n = int(input())
# x, y = map(int,input().split())
# A = list(map(int,input().split()))
ans = 0
s = eval(input())
n = len(s)
s = s[::-1]
i = 0
flg = True
while True:
    if i >= n:
        break
    if s[i : i + 7] == "remaerd":
        i += 7
    elif s[i : i + 6] == "resare":
        i += 6
    elif s[i : i + 5] == "maerd" or s[i : i + 5] == "esare":
        i += 5
    else:
        flg = False
        break
if flg:
    print("YES")
else:
    print("NO")

-L = ["maerd", "remaerd", "esare", "resare"]

+    elif s[i : i + 5] == "maerd" or s[i : i + 5] == "esare":


Input:
def main():

  import sys

  input = sys.stdin.readline

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

  mod=pow(10,9)+7

  ans=[1]*(n+1)

  for _ in [0]*m:

    ans[int(eval(input()))]=0

  for i in range(n+1):

    ans[i]=ans[i] if ans[i]==0 or i<2 else (ans[i-1]+ans[i-2])%mod

  print((ans[-1]))

if __name__ == '__main__':

    main()

def main():

  import sys

  input = sys.stdin.readline

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

  mod=pow(10,9)+7

  ans=[1]*(n+1)

  for _ in [0]*m:

    ans[int(eval(input()))]=0

  for i in range(2,n+1):

    if ans[i]>0:

      ans[i]=(ans[i-1]+ans[i-2])%mod

  print((ans[-1]))

if __name__ == '__main__':

    main()

def main():
    import sys

    input = sys.stdin.readline
    n, m = list(map(int, input().split()))
    mod = pow(10, 9) + 7
    ans = [1] * (n + 1)
    for _ in [0] * m:
        ans[int(eval(input()))] = 0
    for i in range(n + 1):
        ans[i] = ans[i] if ans[i] == 0 or i < 2 else (ans[i - 1] + ans[i - 2]) % mod
    print((ans[-1]))

if __name__ == "__main__":
    main()

def main():
    import sys

    input = sys.stdin.readline
    n, m = list(map(int, input().split()))
    mod = pow(10, 9) + 7
    ans = [1] * (n + 1)
    for _ in [0] * m:
        ans[int(eval(input()))] = 0
    for i in range(2, n + 1):
        if ans[i] > 0:
            ans[i] = (ans[i - 1] + ans[i - 2]) % mod
    print((ans[-1]))

if __name__ == "__main__":
    main()

-        ans[i] = ans[i] if ans[i] == 0 or i < 2 else (ans[i - 1] + ans[i - 2]) % mod


Input:
from bisect import bisect_left

q = int(eval(input()))

for _ in [0]*q:

    s1, s2 = eval(input()), eval(input())

    l1, l2 = len(s1), len(s2)

    p = []

    for i, c in enumerate(s1):

        s = 0

        while True:

            j = s2[s:].find(c)

            if j == -1:

                break

            p.append((i, s+j))

            s += j+1

    lis = []

    for _, y in sorted(p, key=lambda x: (x[0], -x[1])):

        i = bisect_left(lis, y)

        if len(lis) <= i:

            lis.append(y)

        else:

            lis[i] = y

    print((len(lis)))

def lcs_hs(s1, s2):

    from bisect import bisect_left

    p = []

    append_p = p.append

    for i, c in enumerate(s1):

        j = s2.find(c)+1

        while j:

            append_p((i, -j))

            j = s2.find(c, j)+1

    lis, result = [], 0

    append_lis = lis.append

    for _, y in sorted(p):

        i = bisect_left(lis, -y)

        if i >= result:

            append_lis(-y)

            result += 1

        else:

            lis[i] = -y

    return result

print(*(lcs_hs(input(), input()) for _ in [0]*int(input())), sep="\n")

from bisect import bisect_left

q = int(eval(input()))
for _ in [0] * q:
    s1, s2 = eval(input()), eval(input())
    l1, l2 = len(s1), len(s2)
    p = []
    for i, c in enumerate(s1):
        s = 0
        while True:
            j = s2[s:].find(c)
            if j == -1:
                break
            p.append((i, s + j))
            s += j + 1
    lis = []
    for _, y in sorted(p, key=lambda x: (x[0], -x[1])):
        i = bisect_left(lis, y)
        if len(lis) <= i:
            lis.append(y)
        else:
            lis[i] = y
    print((len(lis)))

def lcs_hs(s1, s2):
    from bisect import bisect_left

    p = []
    append_p = p.append
    for i, c in enumerate(s1):
        j = s2.find(c) + 1
        while j:
            append_p((i, -j))
            j = s2.find(c, j) + 1
    lis, result = [], 0
    append_lis = lis.append
    for _, y in sorted(p):
        i = bisect_left(lis, -y)
        if i >= result:
            append_lis(-y)
            result += 1
        else:
            lis[i] = -y
    return result

print(*(lcs_hs(input(), input()) for _ in [0] * int(input())), sep="\n")

-    s1, s2 = eval(input()), eval(input())

-    for _, y in sorted(p, key=lambda x: (x[0], -x[1])):

+print(*(lcs_hs(input(), input()) for _ in [0] * int(input())), sep="\n")


Input:
def solve():

  while True:

    m, n  = int(eval(input())), int(eval(input()))

    if not m:

      break

    ices = [[0] + list(map(int,input().split())) + [0] for _ in range(n)]

    ices.insert(0, [0] * (m + 2),)

    ices.append([0] * (m + 2))

    score = [[0] * (m + 2) for _ in range(n + 2)]

    for x in range(1, n + 1):

      for y in range(1, m + 1):

        score[x][y] = ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1]

    def search(x, y, imap, acc):

      imap[x][y] = 0

      acc += 1

      a = b = c = d = 0

      if imap[x - 1][y]:

        a = search(x - 1, y, imap, acc)

      if imap[x + 1][y]:

        b = search(x + 1, y, imap, acc)

      if imap[x][y - 1]:

        c = search(x, y - 1, imap, acc)

      if imap[x][y + 1]:

        d = search(x, y + 1, imap, acc)

      imap[x][y] = 1

      return max(acc, a, b, c, d)

    ans = 0

    for x in range(1, n + 1):

      for y in range(1, m + 1):

        if score[x][y] in [1, 2] and ices[x][y]:

          a = search(x, y, ices, 0)

          if ans < a:

            ans = a

    print(ans)

solve()

def solve():

  while True:

    m, n  = int(eval(input())), int(eval(input()))

    if not m:

      break

    ices = [[0] + list(map(int,input().split())) + [0] for _ in range(n)]

    ices.insert(0, [0] * (m + 2),)

    ices.append([0] * (m + 2))

    score = [[0] * (m + 2) for _ in range(n + 2)]

    for x in range(1, n + 1):

      for y in range(1, m + 1):

        score[x][y] = ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1]

    def search(x, y, imap, acc):

      imap[x][y] = 0

      acc += 1

      ret = acc

      a = b = c = d = 0

      if imap[x - 1][y]:

        a = search(x - 1, y, imap, acc)

        if ret < a:

          ret = a

      if imap[x + 1][y]:

        b = search(x + 1, y, imap, acc)

        if ret < b:

          ret = b

      if imap[x][y - 1]:

        c = search(x, y - 1, imap, acc)

        if ret < c:

          ret = c

      if imap[x][y + 1]:

        d = search(x, y + 1, imap, acc)

        if ret < d:

          ret = d

      imap[x][y] = 1

      return ret

    ans = 0

    for x in range(1, n + 1):

      for y in range(1, m + 1):

        if score[x][y] in [1, 2] and ices[x][y]:

          a = search(x, y, ices, 0)

          if ans < a:

            ans = a

    print(ans)

solve()

def solve():
    while True:
        m, n = int(eval(input())), int(eval(input()))
        if not m:
            break
        ices = [[0] + list(map(int, input().split())) + [0] for _ in range(n)]
        ices.insert(
            0,
            [0] * (m + 2),
        )
        ices.append([0] * (m + 2))
        score = [[0] * (m + 2) for _ in range(n + 2)]
        for x in range(1, n + 1):
            for y in range(1, m + 1):
                score[x][y] = (
                    ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1]
                )

        def search(x, y, imap, acc):
            imap[x][y] = 0
            acc += 1
            a = b = c = d = 0
            if imap[x - 1][y]:
                a = search(x - 1, y, imap, acc)
            if imap[x + 1][y]:
                b = search(x + 1, y, imap, acc)
            if imap[x][y - 1]:
                c = search(x, y - 1, imap, acc)
            if imap[x][y + 1]:
                d = search(x, y + 1, imap, acc)
            imap[x][y] = 1
            return max(acc, a, b, c, d)

        ans = 0
        for x in range(1, n + 1):
            for y in range(1, m + 1):
                if score[x][y] in [1, 2] and ices[x][y]:
                    a = search(x, y, ices, 0)
                    if ans < a:
                        ans = a
        print(ans)

solve()

def solve():
    while True:
        m, n = int(eval(input())), int(eval(input()))
        if not m:
            break
        ices = [[0] + list(map(int, input().split())) + [0] for _ in range(n)]
        ices.insert(
            0,
            [0] * (m + 2),
        )
        ices.append([0] * (m + 2))
        score = [[0] * (m + 2) for _ in range(n + 2)]
        for x in range(1, n + 1):
            for y in range(1, m + 1):
                score[x][y] = (
                    ices[x - 1][y] + ices[x + 1][y] + ices[x][y - 1] + ices[x][y + 1]
                )

        def search(x, y, imap, acc):
            imap[x][y] = 0
            acc += 1
            ret = acc
            a = b = c = d = 0
            if imap[x - 1][y]:
                a = search(x - 1, y, imap, acc)
                if ret < a:
                    ret = a
            if imap[x + 1][y]:
                b = search(x + 1, y, imap, acc)
                if ret < b:
                    ret = b
            if imap[x][y - 1]:
                c = search(x, y - 1, imap, acc)
                if ret < c:
                    ret = c
            if imap[x][y + 1]:
                d = search(x, y + 1, imap, acc)
                if ret < d:
                    ret = d
            imap[x][y] = 1
            return ret

        ans = 0
        for x in range(1, n + 1):
            for y in range(1, m + 1):
                if score[x][y] in [1, 2] and ices[x][y]:
                    a = search(x, y, ices, 0)
                    if ans < a:
                        ans = a
        print(ans)

solve()

-            return max(acc, a, b, c, d)


Input:
N = int(eval(input()))

D, E = [], []

t,l = 0, 0

res = 0

for _ in range(N):

    S = input().rstrip()

    x,y = 0,0

    for s in S:

        if s=="(": x+=1

        else: x=max(x-1,0)

    for s in reversed(S):

        if s==")": y+=1

        else: y=max(y-1,0)

    D.append((x,y))

D.sort(key=lambda x:x[1])

t = 0

for x,y in D:

    if x-y>=0:

        if t>=y: t+=x-y

        else: print("No"); exit()

D.sort(key=lambda x:x[0])

s = 0

for x,y in D:

    if y-x>=0:

        if s>=x: s+=y-x

        else: print("No"); exit()

if t!=s: print("No")

else: print("Yes")

import sys

input = sys.stdin.readline

N = int(eval(input()))

D, E = [], []

t,l = 0, 0

res = 0

for _ in range(N):

    S = input().rstrip()

    x,y = 0,0

    for s in S:

        if s=="(": x+=1

        else: x=max(x-1,0)

    for s in reversed(S):

        if s==")": y+=1

        else: y=max(y-1,0)

    D.append((x,y))

D.sort(key=lambda x:x[1])

t = 0

for x,y in D:

    if x-y>=0:

        if t>=y: t+=x-y

        else: print("No"); exit()

D.sort(key=lambda x:x[0])

s = 0

for x,y in D:

    if y-x>=0:

        if s>=x: s+=y-x

        else: print("No"); exit()

if t!=s: print("No")

else: print("Yes")

import sys

input = sys.stdin.readline
N = int(eval(input()))
D, E = [], []
t, l = 0, 0
res = 0
for _ in range(N):
    S = input().rstrip()
    x, y = 0, 0
    for s in S:
        if s == "(":
            x += 1
        else:
            x = max(x - 1, 0)
    for s in reversed(S):
        if s == ")":
            y += 1
        else:
            y = max(y - 1, 0)
    D.append((x, y))
D.sort(key=lambda x: x[1])
t = 0
for x, y in D:
    if x - y >= 0:
        if t >= y:
            t += x - y
        else:
            print("No")
            exit()
D.sort(key=lambda x: x[0])
s = 0
for x, y in D:
    if y - x >= 0:
        if s >= x:
            s += y - x
        else:
            print("No")
            exit()
if t != s:
    print("No")
else:
    print("Yes")

+import sys
+
+input = sys.stdin.readline


Input:
n,a,b = list(map(int,input().split()))

if (n%(a+b)) == 0:

    print(((n//(a+b))*a))

else:

    if (n%(a+b)) < a:

        print((((n//(a+b))*a)+(n%(a+b))))

    else:

        print((((n//(a+b))*a)+a))

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

AB = A+B

shou = N//AB

amari = N%AB

ans = shou*A+min(A,amari)

print(ans)

N, A, B = list(map(int, input().split()))
AB = A + B
shou = N // AB
amari = N % AB
ans = shou * A + min(A, amari)
print(ans)

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

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


Input:
n = int(input())

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

ais = [int(input()) for _ in range(n)]

def f(ai,d):

	return 1 + (d-1)/(ai)

print(x + sum([f(ai,d) for ai in ais] or [0]))

n = int(input())

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

def f(ai,d): return 1 + (d-1)/(ai)

print(x + sum([f(int(input()),d)  for _ in range(n)] or [0]))

n = int(input())
d, x = list(map(int, input().split()))
ais = [int(input()) for _ in range(n)]

def f(ai, d):
    return 1 + (d - 1) / (ai)

print(x + sum([f(ai, d) for ai in ais] or [0]))

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

def f(ai, d):
    return 1 + (d - 1) / (ai)

print(x + sum([f(int(input()), d) for _ in range(n)] or [0]))

-print(x + sum([f(ai, d) for ai in ais] or [0]))

+print(x + sum([f(int(input()), d) for _ in range(n)] or [0]))


Input:
N=int(eval(input()))

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

bin_A=[bin(c) for c in A]

flags=[True]*N

count=0

for keta in range(60):

   count_0=0

   count_1=0

   for i in range(N):

      if flags[i]:

         if bin_A[i][-1*(keta+1)]=="b":

            count_0+=1

            flags[i]=False

         elif bin_A[i][-1*(keta+1)]=="0":

            count_0+=1

         else:

            count_1+=1

      elif flags[i]==False:

         count_0+=1

   count+=count_0*count_1*2**keta

print((count%(10**9+7)))

from sys import stdin

import numpy as np

def main():

    #入力

    readline=stdin.readline

    mod=10**9+7

    n=int(readline())

    a=list(map(int,readline().split()))

    a=np.array(a,dtype=np.int64)

    b=np.array([((a>>i)&1).sum() for i in range(61)],dtype=np.int64)

    c=np.full(61,n,dtype=np.int64)-b

    d=b*c

    d%=mod

    ans=0

    now=1

    for i in range(60):

        ans+=d[i]*now

        ans%=mod

        now*=2

        now%=mod

    print(ans)

if __name__=="__main__":

    main()

N = int(eval(input()))
A = list(map(int, input().split()))
bin_A = [bin(c) for c in A]
flags = [True] * N
count = 0
for keta in range(60):
    count_0 = 0
    count_1 = 0
    for i in range(N):
        if flags[i]:
            if bin_A[i][-1 * (keta + 1)] == "b":
                count_0 += 1
                flags[i] = False
            elif bin_A[i][-1 * (keta + 1)] == "0":
                count_0 += 1
            else:
                count_1 += 1
        elif flags[i] == False:
            count_0 += 1
    count += count_0 * count_1 * 2**keta
print((count % (10**9 + 7)))

from sys import stdin
import numpy as np

def main():
    # 入力
    readline = stdin.readline
    mod = 10**9 + 7
    n = int(readline())
    a = list(map(int, readline().split()))
    a = np.array(a, dtype=np.int64)
    b = np.array([((a >> i) & 1).sum() for i in range(61)], dtype=np.int64)
    c = np.full(61, n, dtype=np.int64) - b
    d = b * c
    d %= mod
    ans = 0
    now = 1
    for i in range(60):
        ans += d[i] * now
        ans %= mod
        now *= 2
        now %= mod
    print(ans)

if __name__ == "__main__":
    main()

-    count += count_0 * count_1 * 2**keta

+    a = list(map(int, readline().split()))

+    b = np.array([((a >> i) & 1).sum() for i in range(61)], dtype=np.int64)

+    c = np.full(61, n, dtype=np.int64) - b


Input:
# -*- coding: utf-8 -*-

import bisect

import heapq

import math

import random

import sys

from collections import Counter, defaultdict, deque

from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal

from functools import lru_cache, reduce

from itertools import combinations, combinations_with_replacement, product, permutations

from operator import add, mul, sub

sys.setrecursionlimit(100000)

def read_int():

    return int(input())

def read_int_n():

    return list(map(int, input().split()))

def read_float():

    return float(input())

def read_float_n():

    return list(map(float, input().split()))

def read_str():

    return input().strip()

def read_str_n():

    return list(map(str, input().split()))

def error_print(*args):

    print(*args, file=sys.stderr)

def mt(f):

    import time

    def wrap(*args, **kwargs):

        s = time.time()

        ret = f(*args, **kwargs)

        e = time.time()

        error_print(e - s, 'sec')

        return ret

    return wrap

class Mod:

    def __init__(self, m):

        self.m = m

    def add(self, a, b):

        return (a + b ) % self.m

    def sub(self, a, b):

        return (a - b) % self.m

    def mul(self, a, b):

        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):

        return self.mul(a, self.pow(b, self.m-2))

    def pow(self, x, y):

        if y == 0:

            return 1

        elif y == 1:

            return x % self.m

        elif y % 2 == 0:

            return self.pow(x, y//2)**2 % self.m

        else:

            return self.pow(x, y//2)**2 * x % self.m

@mt

def slv(N):

    if N==3:

        return 61

    m = Mod(10**9+7)

    dp = {}

    iv = [

        'agc',

        'acg',

        'gac',

        'aggc'

        'acgc',

        'atgc',

        'agac',

        'aggc',

        'agtc',

    ]

    for s in product('agct', repeat=4):

        s = ''.join(s)

        if not any(map(lambda x: x in s, iv)):

            dp[s] = 1

    for _ in range(N-4):

        dp_ = Counter()

        for k, v in dp.items():

            for c in 'agct':

                s = k + c

                if not any(map(lambda x: x in s, iv)):

                    dp_[s[1:]] = m.add(v, dp_[s[1:]])

        dp = dp_

    ans = 0

    for k, v in dp.items():

        ans = m.add(ans, v)

    return ans

def main():

    N = read_int()

    print(slv(N))

if __name__ == '__main__':

    main()

# -*- coding: utf-8 -*-

import bisect

import heapq

import math

import random

import sys

from collections import Counter, defaultdict, deque

from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal

from functools import lru_cache, reduce

from itertools import combinations, combinations_with_replacement, product, permutations

from operator import add, mul, sub

sys.setrecursionlimit(100000)

def read_int():

    return int(input())

def read_int_n():

    return list(map(int, input().split()))

def read_float():

    return float(input())

def read_float_n():

    return list(map(float, input().split()))

def read_str():

    return input().strip()

def read_str_n():

    return list(map(str, input().split()))

def error_print(*args):

    print(*args, file=sys.stderr)

def mt(f):

    import time

    def wrap(*args, **kwargs):

        s = time.time()

        ret = f(*args, **kwargs)

        e = time.time()

        error_print(e - s, 'sec')

        return ret

    return wrap

class Mod:

    def __init__(self, m):

        self.m = m

    def add(self, a, b):

        return (a + b ) % self.m

    def sub(self, a, b):

        return (a - b) % self.m

    def mul(self, a, b):

        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):

        return self.mul(a, self.pow(b, self.m-2))

    def pow(self, x, y):

        if y == 0:

            return 1

        elif y == 1:

            return x % self.m

        elif y % 2 == 0:

            return self.pow(x, y//2)**2 % self.m

        else:

            return self.pow(x, y//2)**2 * x % self.m

@mt

def slv(N):

    if N==3:

        return 61

    m = Mod(10**9+7)

    dp = {}

    iv = [

        'agc',

        'acg',

        'gac',

        'aggc'

        'acgc',

        'atgc',

        'agac',

        'aggc',

        'agtc',

    ]

    for s in product('agct', repeat=4):

        s = ''.join(s)

        if not any(map(lambda x: x in s, iv)):

            dp[s] = 1

    for _ in range(N-4):

        dp_ = Counter()

        for k, v in dp.items():

            for c in 'agct':

                s = k + c

                s = s[1:]

                if s in dp:

                    dp_[s] = m.add(v, dp_[s])

        dp = dp_

    ans = 0

    for k, v in dp.items():

        ans = m.add(ans, v)

    return ans

def main():

    N = read_int()

    print(slv(N))

if __name__ == '__main__':

    main()

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)

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

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

def read_float():
    return float(input())

def read_float_n():
    return list(map(float, input().split()))

def read_str():
    return input().strip()

def read_str_n():
    return list(map(str, input().split()))

def error_print(*args):
    print(*args, file=sys.stderr)

def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()
        error_print(e - s, "sec")
        return ret

    return wrap

class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, self.pow(b, self.m - 2))

    def pow(self, x, y):
        if y == 0:
            return 1
        elif y == 1:
            return x % self.m
        elif y % 2 == 0:
            return self.pow(x, y // 2) ** 2 % self.m
        else:
            return self.pow(x, y // 2) ** 2 * x % self.m

@mt
def slv(N):
    if N == 3:
        return 61
    m = Mod(10**9 + 7)
    dp = {}
    iv = [
        "agc",
        "acg",
        "gac",
        "aggc" "acgc",
        "atgc",
        "agac",
        "aggc",
        "agtc",
    ]
    for s in product("agct", repeat=4):
        s = "".join(s)
        if not any(map(lambda x: x in s, iv)):
            dp[s] = 1
    for _ in range(N - 4):
        dp_ = Counter()
        for k, v in dp.items():
            for c in "agct":
                s = k + c
                if not any(map(lambda x: x in s, iv)):
                    dp_[s[1:]] = m.add(v, dp_[s[1:]])
        dp = dp_
    ans = 0
    for k, v in dp.items():
        ans = m.add(ans, v)
    return ans

def main():
    N = read_int()
    print(slv(N))

if __name__ == "__main__":
    main()

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)

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

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

def read_float():
    return float(input())

def read_float_n():
    return list(map(float, input().split()))

def read_str():
    return input().strip()

def read_str_n():
    return list(map(str, input().split()))

def error_print(*args):
    print(*args, file=sys.stderr)

def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()
        error_print(e - s, "sec")
        return ret

    return wrap

class Mod:
    def __init__(self, m):
        self.m = m

    def add(self, a, b):
        return (a + b) % self.m

    def sub(self, a, b):
        return (a - b) % self.m

    def mul(self, a, b):
        return ((a % self.m) * (b % self.m)) % self.m

    def div(self, a, b):
        return self.mul(a, self.pow(b, self.m - 2))

    def pow(self, x, y):
        if y == 0:
            return 1
        elif y == 1:
            return x % self.m
        elif y % 2 == 0:
            return self.pow(x, y // 2) ** 2 % self.m
        else:
            return self.pow(x, y // 2) ** 2 * x % self.m

@mt
def slv(N):
    if N == 3:
        return 61
    m = Mod(10**9 + 7)
    dp = {}
    iv = [
        "agc",
        "acg",
        "gac",
        "aggc" "acgc",
        "atgc",
        "agac",
        "aggc",
        "agtc",
    ]
    for s in product("agct", repeat=4):
        s = "".join(s)
        if not any(map(lambda x: x in s, iv)):
            dp[s] = 1
    for _ in range(N - 4):
        dp_ = Counter()
        for k, v in dp.items():
            for c in "agct":
                s = k + c
                s = s[1:]
                if s in dp:
                    dp_[s] = m.add(v, dp_[s])
        dp = dp_
    ans = 0
    for k, v in dp.items():
        ans = m.add(ans, v)
    return ans

def main():
    N = read_int()
    print(slv(N))

if __name__ == "__main__":
    main()

-                if not any(map(lambda x: x in s, iv)):


Input:
n = int(eval(input()))

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

ans = 0

size = sum(H)

while(size > 0):

    count = 0

    temp = 0

    for h in H:

        if(h == 0 and temp > 0):

            ans += 1

            break

        elif(h != 0):

            temp += 1

            H[count] -= 1

            size -= 1

            if(count == n-1):

                ans += 1

        count += 1

print(ans)

n = int(eval(input()))

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

ans = 0

lst = 0

for h in H:

    if(h > lst):

        ans += h-lst

    lst = h

print(ans)

n = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
size = sum(H)
while size > 0:
    count = 0
    temp = 0
    for h in H:
        if h == 0 and temp > 0:
            ans += 1
            break
        elif h != 0:
            temp += 1
            H[count] -= 1
            size -= 1
            if count == n - 1:
                ans += 1
        count += 1
print(ans)

n = int(eval(input()))
H = list(map(int, input().split()))
ans = 0
lst = 0
for h in H:
    if h > lst:
        ans += h - lst
    lst = h
print(ans)

-size = sum(H)
-while size > 0:
-    count = 0
-    temp = 0
-    for h in H:
-        if h == 0 and temp > 0:
-            ans += 1
-            break
-        elif h != 0:
-            temp += 1
-            H[count] -= 1
-            size -= 1
-            if count == n - 1:
-                ans += 1
-        count += 1
+lst = 0
+for h in H:
+    if h > lst:
+        ans += h - lst
+    lst = h


Input:
N = int(eval(input()))

S = eval(input())

count = 0

for i in range(0, 10):

    if str(i) in S:

        idx = S.index(str(i))

        for j in range(0, 10):

            if str(j) in S[idx+1:]:

                idx2 = S[idx+1:].index(str(j)) + idx + 1

                for k in range(0, 10):

                    if str(k) in S[idx2+1:]:

                        count += 1

print(count)

N = int(eval(input()))

S = eval(input())

count = 0

D = 3

def find_number(digits, series):

    global count

    if digits > 1:

        for i in range(0, 10):

            if str(i) in series:

                idx = series.index(str(i))

                find_number(digits - 1, series[idx+1:])

    elif digits == 1:

        for j in range(0, 10):

            if str(j) in series:

                count += 1

    return count

print((find_number(D, S)))

N = int(eval(input()))
S = eval(input())
count = 0
for i in range(0, 10):
    if str(i) in S:
        idx = S.index(str(i))
        for j in range(0, 10):
            if str(j) in S[idx + 1 :]:
                idx2 = S[idx + 1 :].index(str(j)) + idx + 1
                for k in range(0, 10):
                    if str(k) in S[idx2 + 1 :]:
                        count += 1
print(count)

N = int(eval(input()))
S = eval(input())
count = 0
D = 3

def find_number(digits, series):
    global count
    if digits > 1:
        for i in range(0, 10):
            if str(i) in series:
                idx = series.index(str(i))
                find_number(digits - 1, series[idx + 1 :])
    elif digits == 1:
        for j in range(0, 10):
            if str(j) in series:
                count += 1
    return count

print((find_number(D, S)))

+                idx = series.index(str(i))

+                find_number(digits - 1, series[idx + 1 :])

-                idx2 = S[idx + 1 :].index(str(j)) + idx + 1

-                    if str(k) in S[idx2 + 1 :]:


Input:
def resolve():

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

    l=[int(eval(input())) for i in range(n)]

    l.sort()

    print((min(l[i+k-1]-l[i] for i in range(n-k+1))))

resolve()

import sys

def input(): return sys.stdin.readline().strip()

def resolve():

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

    l=[int(eval(input())) for i in range(n)]

    l.sort()

    ans=10**18

    for i in range(0,n-k+1):

        ans=min(ans,l[i+k-1]-l[i])

    print(ans)

resolve()

def resolve():
    n, k = list(map(int, input().split()))
    l = [int(eval(input())) for i in range(n)]
    l.sort()
    print((min(l[i + k - 1] - l[i] for i in range(n - k + 1))))

resolve()

import sys

def input():
    return sys.stdin.readline().strip()

def resolve():
    n, k = list(map(int, input().split()))
    l = [int(eval(input())) for i in range(n)]
    l.sort()
    ans = 10**18
    for i in range(0, n - k + 1):
        ans = min(ans, l[i + k - 1] - l[i])
    print(ans)

resolve()

+    return sys.stdin.readline().strip()

-    print((min(l[i + k - 1] - l[i] for i in range(n - k + 1))))

+        ans = min(ans, l[i + k - 1] - l[i])


Input:
from heapq import heapify,heappush, heappop

N=eval(input())

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

q=A[:N]

heapify(q)

q_sum=sum(q)

B=[ float("-inf") for i in range(3*N)]

B[N-1]=q_sum

for i in range(N,2*N):

	x=A[i]

	if x>q[0]:

		tmp=heappop(q)

		q_sum-=tmp

		q_sum+=x

		heappush(q,x)

	B[i]=q_sum

q=[x*-1 for x in A[2*N:]]

heapify(q)

q_sum=sum(q)*-1

B[2*N-1]-=q_sum

for i in range(2*N-1,N-1,-1):

	x=A[i]*-1

	if q[0]<x:

		tmp=heappop(q)

		q_sum-=tmp*-1

		q_sum+=x*-1

		heappush(q,x)

	B[i-1]-=q_sum

print(max(B))

from heapq import heapify,heappush, heappop

N=eval(input())

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

hq1=A[:N]

heapify(hq1)

sum1=sum(hq1)

T1=[]

T1.append(sum1)

for i in range(N, 2*N):

	x=A[i]

	if hq1[0]<x:

		u=heappop(hq1)

		heappush(hq1,x)

		sum1+=(x-u)

	T1.append(sum1)

hq2=[x*-1 for x in A[2*N:]]

sum2=-1*sum(hq2)

heapify(hq2)

T2=[]

T2.append(sum2)

for i in range(2*N-1,N-1,-1):

	x=A[i]

	if x*-1 > hq2[0]<x:

			u=heappop(hq2)

			heappush(hq2,x*-1)

			sum2+=u+x

	T2.append(sum2)

T2.reverse()

ans=float("-inf")

for x, y in zip(T1, T2):

	ans=max(ans , x-y)

print(ans)

from heapq import heapify, heappush, heappop

N = eval(input())
A = list(map(int, input().split()))
q = A[:N]
heapify(q)
q_sum = sum(q)
B = [float("-inf") for i in range(3 * N)]
B[N - 1] = q_sum
for i in range(N, 2 * N):
    x = A[i]
    if x > q[0]:
        tmp = heappop(q)
        q_sum -= tmp
        q_sum += x
        heappush(q, x)
    B[i] = q_sum
q = [x * -1 for x in A[2 * N :]]
heapify(q)
q_sum = sum(q) * -1
B[2 * N - 1] -= q_sum
for i in range(2 * N - 1, N - 1, -1):
    x = A[i] * -1
    if q[0] < x:
        tmp = heappop(q)
        q_sum -= tmp * -1
        q_sum += x * -1
        heappush(q, x)
    B[i - 1] -= q_sum
print(max(B))

from heapq import heapify, heappush, heappop

N = eval(input())
A = list(map(int, input().split()))
hq1 = A[:N]
heapify(hq1)
sum1 = sum(hq1)
T1 = []
T1.append(sum1)
for i in range(N, 2 * N):
    x = A[i]
    if hq1[0] < x:
        u = heappop(hq1)
        heappush(hq1, x)
        sum1 += x - u
    T1.append(sum1)
hq2 = [x * -1 for x in A[2 * N :]]
sum2 = -1 * sum(hq2)
heapify(hq2)
T2 = []
T2.append(sum2)
for i in range(2 * N - 1, N - 1, -1):
    x = A[i]
    if x * -1 > hq2[0] < x:
        u = heappop(hq2)
        heappush(hq2, x * -1)
        sum2 += u + x
    T2.append(sum2)
T2.reverse()
ans = float("-inf")
for x, y in zip(T1, T2):
    ans = max(ans, x - y)
print(ans)

-B = [float("-inf") for i in range(3 * N)]


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

r,s,p=list(map(int,input().split()))

t=list(eval(input()))

# d={'r':0,'s':0,'p':0}

d={}

ans=0

c=0

for i in t:

    if c >= k:

        x =d[c-k]

        y = c+k

        if i =='r':

            if x == 'p':

                if  y < n and t[y] == 's':

                    d[c]='s'

                else:

                    d[c]='r'

            else:

                ans += p ; d[c]='p'

        elif i == 's':

            if x == 'r':

               if y < n and t[y] == 'p' :

                    d[c]='p'

               else:

                    d[c]='s'

            else:

                ans += r;d[c]='r'

        elif i == 'p':

            if x == 's':

               if  y < n and t[y] == 'r':

                    d[c]='r'

               else:

                    d[c]='p'

            else:

                ans += s;d[c]='s'

    else:

        if i =='r':

            ans += p ; d[c]='p'

        elif i == 's':

            ans += r;d[c]='r'

        elif i == 'p':

            ans += s;d[c]='s'

    c+=1

print(ans)

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

r,s,p=list(map(int,input().split()))

t=list(eval(input()))

res=0

for i in range(n):

  if i>k-1 and t[i-k]==t[i]:

    t[i]="n"

  if t[i]=="r":

    res+=p

  elif t[i]=="s":

    res+=r

  elif t[i]=="p":

    res+=s

print(res)

n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = list(eval(input()))
# d={'r':0,'s':0,'p':0}
d = {}
ans = 0
c = 0
for i in t:
    if c >= k:
        x = d[c - k]
        y = c + k
        if i == "r":
            if x == "p":
                if y < n and t[y] == "s":
                    d[c] = "s"
                else:
                    d[c] = "r"
            else:
                ans += p
                d[c] = "p"
        elif i == "s":
            if x == "r":
                if y < n and t[y] == "p":
                    d[c] = "p"
                else:
                    d[c] = "s"
            else:
                ans += r
                d[c] = "r"
        elif i == "p":
            if x == "s":
                if y < n and t[y] == "r":
                    d[c] = "r"
                else:
                    d[c] = "p"
            else:
                ans += s
                d[c] = "s"
    else:
        if i == "r":
            ans += p
            d[c] = "p"
        elif i == "s":
            ans += r
            d[c] = "r"
        elif i == "p":
            ans += s
            d[c] = "s"
    c += 1
print(ans)

n, k = list(map(int, input().split()))
r, s, p = list(map(int, input().split()))
t = list(eval(input()))
res = 0
for i in range(n):
    if i > k - 1 and t[i - k] == t[i]:
        t[i] = "n"
    if t[i] == "r":
        res += p
    elif t[i] == "s":
        res += r
    elif t[i] == "p":
        res += s
print(res)

-                if y < n and t[y] == "s":

-                if y < n and t[y] == "p":

-                if y < n and t[y] == "r":


Input:
n=int(eval(input()))

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

i=1

cnt=0

cnt_max=0

while i<n:

  if s[i]<=s[i-1]:

    cnt+=1

  else:

    cnt=0

  cnt_max=max(cnt,cnt_max)

  i+=1

print(cnt_max)

n=int(eval(input()))

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

ans=0

cnt=0

for i in range(1,n):

    if h[i]<=h[i-1]:

        cnt+=1

    else:

        ans=max(ans,cnt)

        cnt=0

print((max(ans,cnt)))

n = int(eval(input()))
s = list(map(int, input().split()))
i = 1
cnt = 0
cnt_max = 0
while i < n:
    if s[i] <= s[i - 1]:
        cnt += 1
    else:
        cnt = 0
    cnt_max = max(cnt, cnt_max)
    i += 1
print(cnt_max)

n = int(eval(input()))
h = list(map(int, input().split()))
ans = 0
cnt = 0
for i in range(1, n):
    if h[i] <= h[i - 1]:
        cnt += 1
    else:
        ans = max(ans, cnt)
        cnt = 0
print((max(ans, cnt)))

-s = list(map(int, input().split()))
-i = 1
+h = list(map(int, input().split()))
+ans = 0
-cnt_max = 0
-while i < n:
-    if s[i] <= s[i - 1]:
+for i in range(1, n):
+    if h[i] <= h[i - 1]:
+        ans = max(ans, cnt)
-    cnt_max = max(cnt, cnt_max)
-    i += 1
-print(cnt_max)
+print((max(ans, cnt)))


Input:
n = eval(input())

if n[-1] == "3":

    print("bon")

elif n[-1] in ["0", "1", "6", "8"]:

    print("pon")

else:

    print("hon")

n = input()[-1]

a = ["pon", "pon", "hon", "bon", "hon", "hon", "pon", "hon", "pon", "hon"]

print((a[int(n)]))


Input:
N,Z,W=list(map(int,input().split()))

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

INF=10**19

dp=[[0]*2 for i in range(N+1)]

for i in range(N-1,-1,-1):

    dp[i][0]=-INF

    if i: Y=a[i-1]

    else: Y=W

    dp[i][0]=max(dp[i][0],abs(Y-a[N-1]))

    for j in range(i+1,N): dp[i][0]=max(dp[i][0],dp[j][1])

    dp[i][1]=INF

    if i: X=a[i-1]

    else: X=Z

    dp[i][1]=min(dp[i][1],abs(X-a[N-1]))

    for j in range(i+1,N): dp[i][1]=min(dp[i][1],dp[j][0])

print((dp[0][0]))

N,Z,W=list(map(int,input().split()))

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

if N==1:

    print((abs(a[0]-W)))

else:

    print((max(abs(a[-1]-W),abs(a[-1]-a[-2]))))

N, Z, W = list(map(int, input().split()))
a = list(map(int, input().split()))
INF = 10**19
dp = [[0] * 2 for i in range(N + 1)]
for i in range(N - 1, -1, -1):
    dp[i][0] = -INF
    if i:
        Y = a[i - 1]
    else:
        Y = W
    dp[i][0] = max(dp[i][0], abs(Y - a[N - 1]))
    for j in range(i + 1, N):
        dp[i][0] = max(dp[i][0], dp[j][1])
    dp[i][1] = INF
    if i:
        X = a[i - 1]
    else:
        X = Z
    dp[i][1] = min(dp[i][1], abs(X - a[N - 1]))
    for j in range(i + 1, N):
        dp[i][1] = min(dp[i][1], dp[j][0])
print((dp[0][0]))

N, Z, W = list(map(int, input().split()))
a = list(map(int, input().split()))
if N == 1:
    print((abs(a[0] - W)))
else:
    print((max(abs(a[-1] - W), abs(a[-1] - a[-2]))))


Input:
D, T, S = list(map(int, input().split()))

a = T * S - D

if a >= 0:

    print('Yes')

else:

    print('No')

#!/usr/bin/env python3

import sys

YES = "Yes"  # type: str

NO = "No"  # type: str

def solve(D: int, T: int, S: int):

    if D <= T*S:

        return print('Yes')

    else:

        return print('No')

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

    D = int(next(tokens))  # type: int

    T = int(next(tokens))  # type: int

    S = int(next(tokens))  # type: int

    solve(D, T, S)

if __name__ == '__main__':

    main()

D, T, S = list(map(int, input().split()))
a = T * S - D
if a >= 0:
    print("Yes")
else:
    print("No")

#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str

def solve(D: int, T: int, S: int):
    if D <= T * S:
        return print("Yes")
    else:
        return print("No")

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    D = int(next(tokens))  # type: int
    T = int(next(tokens))  # type: int
    S = int(next(tokens))  # type: int
    solve(D, T, S)

if __name__ == "__main__":
    main()

-D, T, S = list(map(int, input().split()))

+# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)


Input:
n,m,r=list(map(int,input().split()))

a,b=sorted([n-1,r-m*n])

if a<1:print((0))

else:

 d=1

 for i in range(a):d*=i+1

 u=1

 for i in range(b,a+b):u*=i+1

 print((u//d))

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

r-=n*m

if r<0:print((0))

else:

 from math import*

 print((factorial(n+r-1)//factorial(r)//factorial(n-1)))

n, m, r = list(map(int, input().split()))
a, b = sorted([n - 1, r - m * n])
if a < 1:
    print((0))
else:
    d = 1
    for i in range(a):
        d *= i + 1
    u = 1
    for i in range(b, a + b):
        u *= i + 1
    print((u // d))

n, m, r = list(map(int, input().split()))
r -= n * m
if r < 0:
    print((0))
else:
    from math import *

    print((factorial(n + r - 1) // factorial(r) // factorial(n - 1)))

+    print((factorial(n + r - 1) // factorial(r) // factorial(n - 1)))


Input:
N = int(eval(input()))

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

R = list(range(N))

L = list(range(N))

I = [-1] * (N+1)

for i, p in enumerate(P):

    I[p] = i

ans = 0

for n, idx in enumerate(I[1:], 1):

    l = idx-1

    while l>=0 and l!=L[l]:

        l = L[l]

    r = idx+1

    while r<N and r!=R[r]:

        r = R[r]

    L[idx] = l

    R[idx] = r

    if l != -1:

        l2 = l-1

        while l2>=0 and l2!=L[l2]:

            l2 = L[l2]

        ans += n * (l-l2) * (r-idx)

    if r != N:

        r2 = r+1

        while r2<N and r2!=R[r2]:

            r2 = R[r2]

        ans += n * (idx-l) * (r2-r)

print(ans)

N = int(eval(input()))

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

R = list(range(N))

L = list(range(N))

I = [-1] * (N+1)

for i, p in enumerate(P):

    I[p] = i

ans = 0

for n, idx in enumerate(I[1:], 1):

    l = idx-1

    if l>=0:

        l = L[l]

    r = idx+1

    if r<N:

        r = R[r]

    L[r-1] = l

    R[l+1] = r

    if l>=0:

        l2 = l-1

        if l2>=0:

            l2 = L[l2]

        ans += n * (l-l2) * (r-idx)

    if r<N:

        r2 = r+1

        if r2<N:

            r2 = R[r2]

        ans += n * (idx-l) * (r2-r)

print(ans)

N = int(eval(input()))
P = list(map(int, input().split()))
R = list(range(N))
L = list(range(N))
I = [-1] * (N + 1)
for i, p in enumerate(P):
    I[p] = i
ans = 0
for n, idx in enumerate(I[1:], 1):
    l = idx - 1
    while l >= 0 and l != L[l]:
        l = L[l]
    r = idx + 1
    while r < N and r != R[r]:
        r = R[r]
    L[idx] = l
    R[idx] = r
    if l != -1:
        l2 = l - 1
        while l2 >= 0 and l2 != L[l2]:
            l2 = L[l2]
        ans += n * (l - l2) * (r - idx)
    if r != N:
        r2 = r + 1
        while r2 < N and r2 != R[r2]:
            r2 = R[r2]
        ans += n * (idx - l) * (r2 - r)
print(ans)

N = int(eval(input()))
P = list(map(int, input().split()))
R = list(range(N))
L = list(range(N))
I = [-1] * (N + 1)
for i, p in enumerate(P):
    I[p] = i
ans = 0
for n, idx in enumerate(I[1:], 1):
    l = idx - 1
    if l >= 0:
        l = L[l]
    r = idx + 1
    if r < N:
        r = R[r]
    L[r - 1] = l
    R[l + 1] = r
    if l >= 0:
        l2 = l - 1
        if l2 >= 0:
            l2 = L[l2]
        ans += n * (l - l2) * (r - idx)
    if r < N:
        r2 = r + 1
        if r2 < N:
            r2 = R[r2]
        ans += n * (idx - l) * (r2 - r)
print(ans)

-    while l >= 0 and l != L[l]:
+    if l >= 0:
-    while r < N and r != R[r]:
+    if r < N:
-    L[idx] = l
-    R[idx] = r
-    if l != -1:
+    L[r - 1] = l
+    R[l + 1] = r
+    if l >= 0:
-        while l2 >= 0 and l2 != L[l2]:
+        if l2 >= 0:
-    if r != N:
+    if r < N:
-        while r2 < N and r2 != R[r2]:
+        if r2 < N:


Input:
import sys

import math

from collections import defaultdict

from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)

def input():

    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(eval(input()))

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

def LIR(row,col):

    if row <= 0:

        return [[] for _ in range(col)]

    elif col == 1:

        return [I() for _ in range(row)]

    else:

        read_all = [LI() for _ in range(row)]

        return list(map(list, list(zip(*read_all))))

#################

A,B = list(map(str, input().split()))

A = int(A)

B = 100*int(B[0])+10*int(B[2])+int(B[3])

print((A*B//100))

import sys

import math

from collections import defaultdict

from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)

def input():

    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(eval(input()))

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

def LIR(row,col):

    if row <= 0:

        return [[] for _ in range(col)]

    elif col == 1:

        return [I() for _ in range(row)]

    else:

        read_all = [LI() for _ in range(row)]

        return list(map(list, list(zip(*read_all))))

#################

from decimal import getcontext,Decimal

getcontext().prec = 28

A,B = list(map(str, input().split()))

A = int(A)

B = Decimal(B)

print((int(A*B)))

import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I():
    return int(eval(input()))

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

def LIR(row, col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return list(map(list, list(zip(*read_all))))

#################
A, B = list(map(str, input().split()))
A = int(A)
B = 100 * int(B[0]) + 10 * int(B[2]) + int(B[3])
print((A * B // 100))

import sys
import math
from collections import defaultdict
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I():
    return int(eval(input()))

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

def LIR(row, col):
    if row <= 0:
        return [[] for _ in range(col)]
    elif col == 1:
        return [I() for _ in range(row)]
    else:
        read_all = [LI() for _ in range(row)]
        return list(map(list, list(zip(*read_all))))

#################
from decimal import getcontext, Decimal

getcontext().prec = 28
A, B = list(map(str, input().split()))
A = int(A)
B = Decimal(B)
print((int(A * B)))

+from decimal import getcontext, Decimal


Input:
def main():

    num = int(eval(input()))

    counter = [0] * (num + 1)

    # func(41, 41, 41) = 10086

    # func(99, 1, 1) = 10002

    for x in range(1, 100):

        for y in range(1, 100):

            for z in range(1, 123 - x - y + 1):

                tmp = (x + y + z) ** 2 - x * y - y * z - z * x

                if tmp <= num:

                    counter[tmp] += 1

    for count in counter[1:]:

        print(count)

if __name__ == '__main__':

    main()

def main():

    num = int(eval(input()))

    counter = [0] * (num + 1)

    # func(41, 41, 41) = 10086

    # func(99, 1, 1) = 10002

    for x in range(1, 100):

        for y in range(1, 100):

            for z in range(1, 123 - x - y + 1):

                tmp = (x + y + z) ** 2 - x * y - y * z - z * x

                if tmp > num:

                    break

                counter[tmp] += 1

    for count in counter[1:]:

        print(count)

if __name__ == '__main__':

    main()

def main():
    num = int(eval(input()))
    counter = [0] * (num + 1)
    # func(41, 41, 41) = 10086
    # func(99, 1, 1) = 10002
    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 123 - x - y + 1):
                tmp = (x + y + z) ** 2 - x * y - y * z - z * x
                if tmp <= num:
                    counter[tmp] += 1
    for count in counter[1:]:
        print(count)

if __name__ == "__main__":
    main()

def main():
    num = int(eval(input()))
    counter = [0] * (num + 1)
    # func(41, 41, 41) = 10086
    # func(99, 1, 1) = 10002
    for x in range(1, 100):
        for y in range(1, 100):
            for z in range(1, 123 - x - y + 1):
                tmp = (x + y + z) ** 2 - x * y - y * z - z * x
                if tmp > num:
                    break
                counter[tmp] += 1
    for count in counter[1:]:
        print(count)

if __name__ == "__main__":
    main()

-                if tmp <= num:
-                    counter[tmp] += 1
+                if tmp > num:
+                    break
+                counter[tmp] += 1


Input:
# 2019-11-17 10:52:21(JST)

import sys

# import collections

# import math

# from string import ascii_lowercase, ascii_uppercase, digits

# from bisect import bisect_left as bi_l, bisect_right as bi_r

# import itertools

# from functools import reduce

# import operator as op

# import re

# import heapq

# import array

# from scipy.misc import comb # (default: exact=False)

# import numpy as np

def main():

    n, q = [int(x) for x in sys.stdin.readline().split()]

    AB = [[] for _ in range(n+1)]

    for _ in range(n-1):

        a, b = [int(x) for x in sys.stdin.readline().split()]

        AB[a].append(b)

        AB[b].append(a)

    # 無向グラフとして考える

    ans = [0 for _ in range(n+1)]

    for _ in range(q):

        p, x = [int(x) for x in sys.stdin.readline().split()]

        ans[p] += x

    stack = [1]

    parent = [0 for _ in range(n+1)]

    while stack:

        x = stack.pop()

        for y in AB[x]:

            if y != parent[x]: # yがxの親でなければ

                parent[y] = x # xがyの親

                stack.append(y)

                ans[y] += ans[x]

    print((' '.join(map(str, ans[1:]))))

if __name__ == "__main__":

    main()

import sys

n, q = map(int, sys.stdin.readline().split())

g = [[] for _ in range(n+1)]

for _ in range(n-1):

    a, b = map(int, sys.stdin.readline().split())

    g[a].append(b)

    g[b].append(a)

px = zip(*[map(int, sys.stdin.read().split())] * 2)

def main():

    value = [0] * (n + 1)

    for p, x in px:

        value[p] += x

    stack = [1]

    par = [None] * (n + 1)

    while stack:

        u = stack.pop()

        for v in g[u]:

            if v != par[u]:

                par[v] = u

                value[v] += value[u]

                stack.append(v)

    return value[1:]

if __name__ == '__main__':

    ans = main()

    print(*ans, sep=' ')

# 2019-11-17 10:52:21(JST)
import sys

# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np
def main():
    n, q = [int(x) for x in sys.stdin.readline().split()]
    AB = [[] for _ in range(n + 1)]
    for _ in range(n - 1):
        a, b = [int(x) for x in sys.stdin.readline().split()]
        AB[a].append(b)
        AB[b].append(a)
    # 無向グラフとして考える
    ans = [0 for _ in range(n + 1)]
    for _ in range(q):
        p, x = [int(x) for x in sys.stdin.readline().split()]
        ans[p] += x
    stack = [1]
    parent = [0 for _ in range(n + 1)]
    while stack:
        x = stack.pop()
        for y in AB[x]:
            if y != parent[x]:  # yがxの親でなければ
                parent[y] = x  # xがyの親
                stack.append(y)
                ans[y] += ans[x]
    print((" ".join(map(str, ans[1:]))))

if __name__ == "__main__":
    main()

import sys

n, q = map(int, sys.stdin.readline().split())
g = [[] for _ in range(n + 1)]
for _ in range(n - 1):
    a, b = map(int, sys.stdin.readline().split())
    g[a].append(b)
    g[b].append(a)
px = zip(*[map(int, sys.stdin.read().split())] * 2)

def main():
    value = [0] * (n + 1)
    for p, x in px:
        value[p] += x
    stack = [1]
    par = [None] * (n + 1)
    while stack:
        u = stack.pop()
        for v in g[u]:
            if v != par[u]:
                par[v] = u
                value[v] += value[u]
                stack.append(v)
    return value[1:]

if __name__ == "__main__":
    ans = main()
    print(*ans, sep=" ")

-# from string import ascii_lowercase, ascii_uppercase, digits

-# from bisect import bisect_left as bi_l, bisect_right as bi_r

-# from scipy.misc import comb # (default: exact=False)

+n, q = map(int, sys.stdin.readline().split())

+    a, b = map(int, sys.stdin.readline().split())

+px = zip(*[map(int, sys.stdin.read().split())] * 2)

-    n, q = [int(x) for x in sys.stdin.readline().split()]

-        a, b = [int(x) for x in sys.stdin.readline().split()]

-    # 無向グラフとして考える

-        p, x = [int(x) for x in sys.stdin.readline().split()]

-            if y != parent[x]:  # yがxの親でなければ

-    print((" ".join(map(str, ans[1:]))))


Input:
n = int(eval(input()))

a,b,c = [sorted(list(map(int,input().split())),reverse=True) for i in range(3)]

comp1 = []

i,j = 0,0

cnt = 0

while i<n:

    while j<n and b[j]>a[i]:

        cnt+=1

        j+=1

    comp1.append(cnt)

    i+=1

comp2 = []

i,j = 0,0

cnt = 0

while i<n:

    while j<n and c[j]>b[i]:

        cnt+=1

        j+=1

    comp2.append(cnt)

    i+=1

x = [0]

for i in range(n):

    x.append(x[i]+comp2[i])

ans = 0

for i in comp1:

    ans += x[i]

print(ans)

import bisect

n = int(eval(input()))

a,b,c = [sorted(list(map(int,input().split()))) for i in range(3)]

ans = 0

cnt = [0]

[cnt.append(cnt[i]+bisect.bisect_left(a,b[i])) for i in range(n)]

for i in range(n):

    index = bisect.bisect_left(b,c[i])

    ans += cnt[index]

print(ans)

n = int(eval(input()))
a, b, c = [sorted(list(map(int, input().split())), reverse=True) for i in range(3)]
comp1 = []
i, j = 0, 0
cnt = 0
while i < n:
    while j < n and b[j] > a[i]:
        cnt += 1
        j += 1
    comp1.append(cnt)
    i += 1
comp2 = []
i, j = 0, 0
cnt = 0
while i < n:
    while j < n and c[j] > b[i]:
        cnt += 1
        j += 1
    comp2.append(cnt)
    i += 1
x = [0]
for i in range(n):
    x.append(x[i] + comp2[i])
ans = 0
for i in comp1:
    ans += x[i]
print(ans)

import bisect

n = int(eval(input()))
a, b, c = [sorted(list(map(int, input().split()))) for i in range(3)]
ans = 0
cnt = [0]
[cnt.append(cnt[i] + bisect.bisect_left(a, b[i])) for i in range(n)]
for i in range(n):
    index = bisect.bisect_left(b, c[i])
    ans += cnt[index]
print(ans)

-a, b, c = [sorted(list(map(int, input().split())), reverse=True) for i in range(3)]

+a, b, c = [sorted(list(map(int, input().split()))) for i in range(3)]

+[cnt.append(cnt[i] + bisect.bisect_left(a, b[i])) for i in range(n)]

+    index = bisect.bisect_left(b, c[i])


Input:
I=N=9**9

P,M,L,R,U,*D='x+y,','x-y,',[],[],[]

for t in[*open(0)][1:]:*z,u=t.split();exec(u+'+=[*map(int,z)],')

for*A,S in(D,U,'x,y,'),(L,R,'y,x,'),(U,R,P+M),(L,D,P+M),(L,U,M+P),(D,R,M+P):

 n=p=-I

 for x,y,r in eval('sorted((%sQ)for Q,P in enumerate(A)for x,y in P)'%S):

  if r:n,p=x,y

  elif x==n:N=min(N,y-p)

print((N%I*5or'SAFE'))

I=N=9**9

d=[[],[],[],[]]

for t in[*open(0)][1:]:

  *z,u=t.split()

  d[ord(u)%5]+=[*list(map(int,z))],

f=lambda x,y:x

g=lambda x,y:y

h=lambda x,y:x+y

i=lambda x,y:x-y

for*A,f,g in(3,0,f,g),(1,2,g,f),(0,2,h,i),(1,3,h,i),(1,0,i,h),(3,2,i,h):

  n=p=-I

  for x,y,r in sorted((f(x,y),g(x,y),Q)for Q,P in enumerate(A)for x,y in d[P]):

    if r:n,p=x,y

    elif x==n:N=min(N,y-p)

print((N%I*5or'SAFE'))

I = N = 9**9
P, M, L, R, U, *D = "x+y,", "x-y,", [], [], []
for t in [*open(0)][1:]:
    *z, u = t.split()
    exec(u + "+=[*map(int,z)],")
for *A, S in (
    (D, U, "x,y,"),
    (L, R, "y,x,"),
    (U, R, P + M),
    (L, D, P + M),
    (L, U, M + P),
    (D, R, M + P),
):
    n = p = -I
    for x, y, r in eval("sorted((%sQ)for Q,P in enumerate(A)for x,y in P)" % S):
        if r:
            n, p = x, y
        elif x == n:
            N = min(N, y - p)
print((N % I * 5 or "SAFE"))

I = N = 9**9
d = [[], [], [], []]
for t in [*open(0)][1:]:
    *z, u = t.split()
    d[ord(u) % 5] += ([*list(map(int, z))],)
f = lambda x, y: x
g = lambda x, y: y
h = lambda x, y: x + y
i = lambda x, y: x - y
for *A, f, g in (
    (3, 0, f, g),
    (1, 2, g, f),
    (0, 2, h, i),
    (1, 3, h, i),
    (1, 0, i, h),
    (3, 2, i, h),
):
    n = p = -I
    for x, y, r in sorted(
        (f(x, y), g(x, y), Q) for Q, P in enumerate(A) for x, y in d[P]
    ):
        if r:
            n, p = x, y
        elif x == n:
            N = min(N, y - p)
print((N % I * 5 or "SAFE"))

-    for x, y, r in eval("sorted((%sQ)for Q,P in enumerate(A)for x,y in P)" % S):

+        (f(x, y), g(x, y), Q) for Q, P in enumerate(A) for x, y in d[P]


Input:
from collections import deque

def getinputdata():

    array_result = []

    data = eval(input())

    array_result.append(data.split(" "))

    flg = True

    try:

        while flg:

            data = eval(input())

            if(data != ""):

                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False

    finally:

        return array_result

arr_data = getinputdata()

x=arr_data[0][0]

b = deque([])

for v in x:

    if v=="S":

        b.appendleft(v)

    elif v=="T" and (len(b)==0 or b[0]=="T"):

        b.appendleft(v)

    else:

        b.popleft()

print((len(b)))

def getinputdata():

    array_result = []

    data = eval(input())

    array_result.append(data.split(" "))

    flg = True

    try:

        while flg:

            data = eval(input())

            if(data != ""):

                array_result.append(data.split(" "))

                flg = True

            else:

                flg = False

    finally:

        return array_result

arr_data = getinputdata()

x=arr_data[0][0]

arr=[]

for v in x:

#    sの場合

    if v=="S":

        arr.append("S")

#    tの場合 直前がTあるいは初めての場合

    elif v=="T" and (len(arr)==0 or arr[-1]=="T"):

        arr.append("T")

    else:

        del arr[-1]

print((len(arr)))

from collections import deque

def getinputdata():
    array_result = []
    data = eval(input())
    array_result.append(data.split(" "))
    flg = True
    try:
        while flg:
            data = eval(input())
            if data != "":
                array_result.append(data.split(" "))
                flg = True
            else:
                flg = False
    finally:
        return array_result

arr_data = getinputdata()
x = arr_data[0][0]
b = deque([])
for v in x:
    if v == "S":
        b.appendleft(v)
    elif v == "T" and (len(b) == 0 or b[0] == "T"):
        b.appendleft(v)
    else:
        b.popleft()
print((len(b)))

def getinputdata():
    array_result = []
    data = eval(input())
    array_result.append(data.split(" "))
    flg = True
    try:
        while flg:
            data = eval(input())
            if data != "":
                array_result.append(data.split(" "))
                flg = True
            else:
                flg = False
    finally:
        return array_result

arr_data = getinputdata()
x = arr_data[0][0]
arr = []
for v in x:
    #    sの場合
    if v == "S":
        arr.append("S")
    #    tの場合 直前がTあるいは初めての場合
    elif v == "T" and (len(arr) == 0 or arr[-1] == "T"):
        arr.append("T")
    else:
        del arr[-1]
print((len(arr)))

+    #    sの場合

+    #    tの場合 直前がTあるいは初めての場合

+    elif v == "T" and (len(arr) == 0 or arr[-1] == "T"):


Input:
import sys

sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7

def resolve():

    S = eval(input())

    X, Y = list(map(int, input().split()))

    S = list(map(len, S.split("T")))

    init_x = S[0]

    is_x = 0

    to_x, to_y = [], []

    for i in range(1, len(S)):

        if S[i]:

            to_x.append(S[i]) if is_x else to_y.append(S[i])

        is_x ^= 1

    now_x = {init_x}

    for x in to_x:

        tmp = set()

        for now in now_x:

            tmp.add(now - x)

            tmp.add(now + x)

        now_x = tmp

    now_y = {0}

    for y in to_y:

        tmp = set()

        for now in now_y:

            tmp.add(now - y)

            tmp.add(now + y)

        now_y = tmp

    print(("Yes" if X in now_x and Y in now_y else "No"))

if __name__ == '__main__':

    resolve()

import sys

sys.setrecursionlimit(10 ** 7)

f_inf = float('inf')

mod = 10 ** 9 + 7

def resolve():

    S = list(input().split("T"))

    gx, gy = list(map(int, input().split()))

    to_X = 0

    init_x = len(S[0])

    S.pop(0)

    X, Y = [], []

    for s in S:

        X.append(len(s)) if to_X else Y.append(len(s))

        to_X ^= 1

    now_x = {init_x}

    for x in X:

        tmp = set()

        for prev_x in now_x:

            tmp.add(prev_x + x)

            tmp.add(prev_x - x)

        now_x = tmp

    now_y = {0}

    for y in Y:

        tmp = set()

        for prev_y in now_y:

            tmp.add(prev_y + y)

            tmp.add(prev_y - y)

        now_y = tmp

    print(("Yes" if gx in now_x and gy in now_y else "No"))

if __name__ == '__main__':

    resolve()

import sys

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7

def resolve():
    S = eval(input())
    X, Y = list(map(int, input().split()))
    S = list(map(len, S.split("T")))
    init_x = S[0]
    is_x = 0
    to_x, to_y = [], []
    for i in range(1, len(S)):
        if S[i]:
            to_x.append(S[i]) if is_x else to_y.append(S[i])
        is_x ^= 1
    now_x = {init_x}
    for x in to_x:
        tmp = set()
        for now in now_x:
            tmp.add(now - x)
            tmp.add(now + x)
        now_x = tmp
    now_y = {0}
    for y in to_y:
        tmp = set()
        for now in now_y:
            tmp.add(now - y)
            tmp.add(now + y)
        now_y = tmp
    print(("Yes" if X in now_x and Y in now_y else "No"))

if __name__ == "__main__":
    resolve()

import sys

sys.setrecursionlimit(10**7)
f_inf = float("inf")
mod = 10**9 + 7

def resolve():
    S = list(input().split("T"))
    gx, gy = list(map(int, input().split()))
    to_X = 0
    init_x = len(S[0])
    S.pop(0)
    X, Y = [], []
    for s in S:
        X.append(len(s)) if to_X else Y.append(len(s))
        to_X ^= 1
    now_x = {init_x}
    for x in X:
        tmp = set()
        for prev_x in now_x:
            tmp.add(prev_x + x)
            tmp.add(prev_x - x)
        now_x = tmp
    now_y = {0}
    for y in Y:
        tmp = set()
        for prev_y in now_y:
            tmp.add(prev_y + y)
            tmp.add(prev_y - y)
        now_y = tmp
    print(("Yes" if gx in now_x and gy in now_y else "No"))

if __name__ == "__main__":
    resolve()

-    X, Y = list(map(int, input().split()))

-            to_x.append(S[i]) if is_x else to_y.append(S[i])

+    gx, gy = list(map(int, input().split()))

+        X.append(len(s)) if to_X else Y.append(len(s))

-    print(("Yes" if X in now_x and Y in now_y else "No"))

+    print(("Yes" if gx in now_x and gy in now_y else "No"))


Input:
import collections

n=int(eval(input()))

S=collections.Counter(list(eval(input())))

S0=list(S.items())

L=len(S0)

for i in range(L):

    S0[i]=list(S0[i])

for i in range(1,n):

    temp=list(eval(input()))

    for j in range(L):

        h=temp.count(S0[j][0])

        if h<S0[j][1]:

            S0[j][1]=h

ans=[]

for i in range(L):

    if S0[i][1]!=0:

        for j in range(S0[i][1]):

            ans.append(S0[i][0])

ans.sort()

print(("".join(ans)))

n=int(eval(input()))

abc="abcdefghijklmnopqrstuvwxyz"

cnt=[[0]*n for _ in range(26)]

for i in range(n):

    temp=eval(input())

    for j in range(26):

        cnt[j][i]=temp.count(abc[j])

ans=[]

for i in range(26):

    for j in range(min(cnt[i])):

        ans.append(abc[i])

print(("".join(ans)))

import collections

n = int(eval(input()))
S = collections.Counter(list(eval(input())))
S0 = list(S.items())
L = len(S0)
for i in range(L):
    S0[i] = list(S0[i])
for i in range(1, n):
    temp = list(eval(input()))
    for j in range(L):
        h = temp.count(S0[j][0])
        if h < S0[j][1]:
            S0[j][1] = h
ans = []
for i in range(L):
    if S0[i][1] != 0:
        for j in range(S0[i][1]):
            ans.append(S0[i][0])
ans.sort()
print(("".join(ans)))

n = int(eval(input()))
abc = "abcdefghijklmnopqrstuvwxyz"
cnt = [[0] * n for _ in range(26)]
for i in range(n):
    temp = eval(input())
    for j in range(26):
        cnt[j][i] = temp.count(abc[j])
ans = []
for i in range(26):
    for j in range(min(cnt[i])):
        ans.append(abc[i])
print(("".join(ans)))


Input:
def main():

    N = int(eval(input()))

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

    from collections import Counter

    c = Counter(A)

    even = len([v for v in list(c.values()) if v % 2 == 0])

    ans = len(list(c.keys()))

    if even % 2 == 1:

        ans -= 1

    print(ans)

if __name__ == '__main__':

    main()

def main():

    """

    奇数枚の余りは1に、偶数枚の余りは2にできる

    偶数枚が偶数個余っていたら種類は減らないが、奇数個であれあ一つ種類が減る

    """

    _ = int(eval(input()))

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

    from collections import Counter

    c = Counter(A)

    even = len([v for v in list(c.values()) if v % 2 == 0])

    ans = len(list(c.keys()))

    if even % 2 == 1:

        ans -= 1

    print(ans)

if __name__ == '__main__':

    main()

def main():
    N = int(eval(input()))
    A = [int(i) for i in input().split()]
    from collections import Counter

    c = Counter(A)
    even = len([v for v in list(c.values()) if v % 2 == 0])
    ans = len(list(c.keys()))
    if even % 2 == 1:
        ans -= 1
    print(ans)

if __name__ == "__main__":
    main()

def main():
    """
    奇数枚の余りは1に、偶数枚の余りは2にできる
    偶数枚が偶数個余っていたら種類は減らないが、奇数個であれあ一つ種類が減る
    """
    _ = int(eval(input()))
    A = [int(i) for i in input().split()]
    from collections import Counter

    c = Counter(A)
    even = len([v for v in list(c.values()) if v % 2 == 0])
    ans = len(list(c.keys()))
    if even % 2 == 1:
        ans -= 1
    print(ans)

if __name__ == "__main__":
    main()

+    奇数枚の余りは1に、偶数枚の余りは2にできる

+    偶数枚が偶数個余っていたら種類は減らないが、奇数個であれあ一つ種類が減る


Input:
from collections import Counter

n = int(eval(input()))

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

d_c = Counter(d)

m = int(eval(input()))

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

# print(d_c)

for i in range(m):

    if t[i] in d_c:

        d_c[t[i]] -= 1

        if d_c[t[i]]<0:

            print("NO")

            exit()

    else:

        print("NO")

        exit()

# print(d_c)

print("YES")

from collections import Counter

n = int(eval(input()))

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

d_c = Counter(d)

m = int(eval(input()))

t = sorted(list(map(int, input().split())), reverse=True)

for i in range(m):

    if d_c[t[i]] > 0:

        d_c[t[i]] -= 1

    else:

        print('NO')

        exit()

print('YES')

from collections import Counter

n = int(eval(input()))
d = list(map(int, input().split()))
d_c = Counter(d)
m = int(eval(input()))
t = list(map(int, input().split()))
# print(d_c)
for i in range(m):
    if t[i] in d_c:
        d_c[t[i]] -= 1
        if d_c[t[i]] < 0:
            print("NO")
            exit()
    else:
        print("NO")
        exit()
# print(d_c)
print("YES")

from collections import Counter

n = int(eval(input()))
d = list(map(int, input().split()))
d_c = Counter(d)
m = int(eval(input()))
t = sorted(list(map(int, input().split())), reverse=True)
for i in range(m):
    if d_c[t[i]] > 0:
        d_c[t[i]] -= 1
    else:
        print("NO")
        exit()
print("YES")

+t = sorted(list(map(int, input().split())), reverse=True)


Input:
n,m=list(map(int,input().split()))

N=[list(eval(input())) for _ in range(n)]

M=[list(eval(input())) for _ in range(m)]

for i in range(n-m+1):

  for j in range(n-m+1):

    count = 0

    for k in range(m):

      for l in range(m):

        if N[i+k][j+l] == M[k][l]:

          count += 1

    if count == m**2:

      print("Yes")

      exit()

print("No")

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

N=[list(eval(input())) for _ in range(n)]

M=[list(eval(input())) for _ in range(m)]

for i in range(n-m+1):

  for j in range(n-m+1):

    count = 0

    for k in range(m):

      if N[i+k][j:j+m] == M[k][:]:

        count += 1

    if count == m:

      print("Yes")

      exit()

print("No")

n, m = list(map(int, input().split()))
N = [list(eval(input())) for _ in range(n)]
M = [list(eval(input())) for _ in range(m)]
for i in range(n - m + 1):
    for j in range(n - m + 1):
        count = 0
        for k in range(m):
            for l in range(m):
                if N[i + k][j + l] == M[k][l]:
                    count += 1
        if count == m**2:
            print("Yes")
            exit()
print("No")

n, m = list(map(int, input().split()))
N = [list(eval(input())) for _ in range(n)]
M = [list(eval(input())) for _ in range(m)]
for i in range(n - m + 1):
    for j in range(n - m + 1):
        count = 0
        for k in range(m):
            if N[i + k][j : j + m] == M[k][:]:
                count += 1
        if count == m:
            print("Yes")
            exit()
print("No")


Input:
S = eval(input())

A = ''.join([str(i % 2) for i in range(len(S))])

B = ''.join([str((i + 1) % 2)  for i in range(len(S))])

ans1 = ans2 = 0

for a, b in zip(S, A):

    if a != b:

        ans1 += 1

for a, b in zip(S, B):

    if a != b:

        ans2 += 1

print((min(ans1, ans2)))

S = eval(input())

A = ''.join([str(i % 2) for i in range(len(S))])

B = ''.join([str((i + 1) % 2)  for i in range(len(S))])

ans1 = ans2 = 0

for s, a, b, in zip(S, A, B):

    if s != a:

        ans1 += 1

    if s != b:

        ans2 += 1

print((min(ans1, ans2)))

S = eval(input())
A = "".join([str(i % 2) for i in range(len(S))])
B = "".join([str((i + 1) % 2) for i in range(len(S))])
ans1 = ans2 = 0
for a, b in zip(S, A):
    if a != b:
        ans1 += 1
for a, b in zip(S, B):
    if a != b:
        ans2 += 1
print((min(ans1, ans2)))

S = eval(input())
A = "".join([str(i % 2) for i in range(len(S))])
B = "".join([str((i + 1) % 2) for i in range(len(S))])
ans1 = ans2 = 0
for (
    s,
    a,
    b,
) in zip(S, A, B):
    if s != a:
        ans1 += 1
    if s != b:
        ans2 += 1
print((min(ans1, ans2)))

-for a, b in zip(S, A):
-    if a != b:
+for (
+    s,
+    a,
+    b,
+) in zip(S, A, B):
+    if s != a:
-for a, b in zip(S, B):
-    if a != b:
+    if s != b:


Input:
from collections import Counter

N = int(eval(input()))

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

b = Counter(a)

ans = 0

for x in b:

    if b[x] > x:

        ans += b[x] - x

    elif b[x] < x:

        ans += b[x]

print(ans)

from collections import Counter

N = int(eval(input()))

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

ans = 0

m = Counter(a)

for x, y in list(m.items()):

    if x == y:

        continue

    elif x < y:

        ans += abs(y-x)

    else:

        ans += y

print(ans)

from collections import Counter

N = int(eval(input()))
a = [int(i) for i in input().split()]
ans = 0
m = Counter(a)
for x, y in list(m.items()):
    if x == y:
        continue
    elif x < y:
        ans += abs(y - x)
    else:
        ans += y
print(ans)

-b = Counter(a)
-for x in b:
-    if b[x] > x:
-        ans += b[x] - x
-    elif b[x] < x:
-        ans += b[x]
+m = Counter(a)
+for x, y in list(m.items()):
+    if x == y:
+        continue
+    elif x < y:
+        ans += abs(y - x)
+    else:
+        ans += y


Input:
import sys

def input(): return sys.stdin.readline().strip()

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

sys.setrecursionlimit(10**9)

N, K = mapint()

from collections import Counter

As = list(mapint())

count = Counter(As)

mod = 10**9+7

maxi = 0

cum = 0

pos = {}

neg = {}

pos[0] = 1

neg[0] = 1

As = sorted(list(set(As)))

for i in range(1, 10**5+5):

    pos[i] = pos[i-1]*i%mod

    neg[i] = pow(pos[i], mod-2, mod)

for a in As:

    cum += count[a]

    if cum<K:

        continue

    for i in range(1, min(K, count[a])+1):

        if cum-count[a]-K+i<0: continue

        maxi += a*pos[count[a]]*neg[i]*neg[count[a]-i]*pos[cum-count[a]]*neg[K-i]*neg[cum-count[a]-K+i]

        maxi %= mod

mini = 0

cum = 0

for a in As[::-1]:

    cum += count[a]

    if cum<K:

        continue

    for i in range(1, min(K, count[a])+1):

        if cum-count[a]-K+i<0: continue

        mini += a*pos[count[a]]*neg[i]*neg[count[a]-i]*pos[cum-count[a]]*neg[K-i]*neg[cum-count[a]-K+i]

        mini %= mod

print(((maxi-mini)%mod))

import sys

def input(): return sys.stdin.readline().strip()

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

sys.setrecursionlimit(10**9)

N, K = mapint()

As = list(mapint())

mod = 10**9+7

As.sort()

pos = {}

neg = {}

pos[0] = 1

neg[0] = 1

for i in range(1, 10**5+3):

    pos[i] = (pos[i-1]*i)%mod

    neg[i] = pow(pos[i], mod-2, mod)

mini = 0

maxi = 0

for i, a in enumerate(As):

    if i<=N-K:

        mini += a*pos[(N-i-1)]*neg[K-1]*neg[N-i-K]

        mini %= mod

    if i>=K-1:

        maxi += a*pos[i]*neg[K-1]*neg[i-K+1]

        maxi %= mod

print(((maxi-mini)%mod))

import sys

def input():
    return sys.stdin.readline().strip()

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

sys.setrecursionlimit(10**9)
N, K = mapint()
from collections import Counter

As = list(mapint())
count = Counter(As)
mod = 10**9 + 7
maxi = 0
cum = 0
pos = {}
neg = {}
pos[0] = 1
neg[0] = 1
As = sorted(list(set(As)))
for i in range(1, 10**5 + 5):
    pos[i] = pos[i - 1] * i % mod
    neg[i] = pow(pos[i], mod - 2, mod)
for a in As:
    cum += count[a]
    if cum < K:
        continue
    for i in range(1, min(K, count[a]) + 1):
        if cum - count[a] - K + i < 0:
            continue
        maxi += (
            a
            * pos[count[a]]
            * neg[i]
            * neg[count[a] - i]
            * pos[cum - count[a]]
            * neg[K - i]
            * neg[cum - count[a] - K + i]
        )
        maxi %= mod
mini = 0
cum = 0
for a in As[::-1]:
    cum += count[a]
    if cum < K:
        continue
    for i in range(1, min(K, count[a]) + 1):
        if cum - count[a] - K + i < 0:
            continue
        mini += (
            a
            * pos[count[a]]
            * neg[i]
            * neg[count[a] - i]
            * pos[cum - count[a]]
            * neg[K - i]
            * neg[cum - count[a] - K + i]
        )
        mini %= mod
print(((maxi - mini) % mod))

import sys

def input():
    return sys.stdin.readline().strip()

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

sys.setrecursionlimit(10**9)
N, K = mapint()
As = list(mapint())
mod = 10**9 + 7
As.sort()
pos = {}
neg = {}
pos[0] = 1
neg[0] = 1
for i in range(1, 10**5 + 3):
    pos[i] = (pos[i - 1] * i) % mod
    neg[i] = pow(pos[i], mod - 2, mod)
mini = 0
maxi = 0
for i, a in enumerate(As):
    if i <= N - K:
        mini += a * pos[(N - i - 1)] * neg[K - 1] * neg[N - i - K]
        mini %= mod
    if i >= K - 1:
        maxi += a * pos[i] * neg[K - 1] * neg[i - K + 1]
        maxi %= mod
print(((maxi - mini) % mod))

-    for i in range(1, min(K, count[a]) + 1):

-            * neg[cum - count[a] - K + i]

+        maxi += a * pos[i] * neg[K - 1] * neg[i - K + 1]

-            * neg[cum - count[a] - K + i]


Input:
l,r,d=[int(i) for i in input().split()]

count=0

for i in range(l,r+1):

    if i%d==0:

        count+=1

print(count)

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

ans=r//d-(l-1)//d

print(ans)

l, r, d = [int(i) for i in input().split()]
count = 0
for i in range(l, r + 1):
    if i % d == 0:
        count += 1
print(count)

l, r, d = list(map(int, input().split()))
ans = r // d - (l - 1) // d
print(ans)

-l, r, d = [int(i) for i in input().split()]

+l, r, d = list(map(int, input().split()))


Input:
def dic(s):

  dics,ans=[],""

  for i in range(len(s)):dics.append(s[i])

  dics.sort()

  for i in dics:ans+=i

  return ans

n=int(eval(input()))

s=[dic(eval(input()))for _ in range(n)]

s.sort()

a=b=1

c=""

for i in range(n):

  if c!=s[i]:

    b+=a*(a-1)//2

    a=1

    c=s[i]

  else:a+=1

b+=a*(a-1)//2

print((b-1))

n=int(eval(input()))

def f(s):

  return "".join(sorted(list(s)))

s=[f(eval(input()))for _ in range(n)]

from collections import Counter

d=Counter(s)

ans=0

for i in d:ans+=d[i]*(d[i]-1)//2

print(ans)

def dic(s):
    dics, ans = [], ""
    for i in range(len(s)):
        dics.append(s[i])
    dics.sort()
    for i in dics:
        ans += i
    return ans

n = int(eval(input()))
s = [dic(eval(input())) for _ in range(n)]
s.sort()
a = b = 1
c = ""
for i in range(n):
    if c != s[i]:
        b += a * (a - 1) // 2
        a = 1
        c = s[i]
    else:
        a += 1
b += a * (a - 1) // 2
print((b - 1))

n = int(eval(input()))

def f(s):
    return "".join(sorted(list(s)))

s = [f(eval(input())) for _ in range(n)]
from collections import Counter

d = Counter(s)
ans = 0
for i in d:
    ans += d[i] * (d[i] - 1) // 2
print(ans)

-s = [dic(eval(input())) for _ in range(n)]

+s = [f(eval(input())) for _ in range(n)]