Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

"""

http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0106&lang=jp

"""

import sys

def solve(amount):

    """

    :param amount: ?????\???????????°?????????

    :return: ?????????

    """

    best_price = (amount + 199) // 200 * 380

    for a in range(amount // 200 + 1):

        for b in range(amount // 300 + 1):

            for c in range(amount // 500 + 1):

                for a1 in range(amount // 1000 + 1):

                    for b1 in range(amount // 1200 + 1):

                        for c1 in range(amount // 1500 + 1):

                            if a*200 + b*300 + c*500 + a1*1000 + b1*1200 + c1*1500 == amount:

                                price = a*380 + b*550 + c*850 + a1*1520 + b1*1870 + c1*2244

                                if price < best_price:

                                    best_price = price

    return best_price

def main(args):

    while True:

        amount = int(eval(input()))

        if amount == 0:

            break

        result = solve(amount)

        print(result)

if __name__ == '__main__':

    main(sys.argv[1:])

# optimized version of the same code:

# -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0106&lang=jp
"""
import sys

def solve(amount):
    """
    :param amount: ?????\???????????°?????????
    :return: ?????????
    """
    best_price = (amount + 199) // 200 * 380
    for a in range(amount // 200 + 1):
        for b in range(amount // 300 + 1):
            for c in range(amount // 500 + 1):
                for a1 in range(amount // 1000 + 1):
                    for b1 in range(amount // 1200 + 1):
                        for c1 in range(amount // 1500 + 1):
                            if (
                                a * 200
                                + b * 300
                                + c * 500
                                + a1 * 1000
                                + b1 * 1200
                                + c1 * 1500
                                == amount
                            ):
                                price = (
                                    a * 380
                                    + b * 550
                                    + c * 850
                                    + a1 * 1520
                                    + b1 * 1870
                                    + c1 * 2244
                                )
                                if price < best_price:
                                    best_price = price
    return best_price

def main(args):
    while True:
        amount = int(eval(input()))
        if amount == 0:
            break
        result = solve(amount)
        print(result)

if __name__ == "__main__":
    main(sys.argv[1:])

+    cart = [[99999999] * (amount // 100 + 1) for _ in range(len(packages))]

+        for j in range(1, len(cart[0])):

+                cart[i][j] = cart[i - 1][j]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

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

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

def solve():

    a, b = mput()

    print((a*b))

    return 0

if __name__ == "__main__":

    solve()

# optimized version of the same code:

import math

def solve():

    a, b = input().split()

    a = int(a)

    b = float(b)

    print((int(a*b)))

    return 0

if __name__ == "__main__":

    solve()

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

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

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

def solve():
    a, b = mput()
    print((a * b))
    return 0

if __name__ == "__main__":
    solve()

import math

def solve():
    a, b = input().split()
    a = int(a)
    b = float(b)
    print((int(a * b)))
    return 0

if __name__ == "__main__":
    solve()

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


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

if (b - a) == (c - b):

    print("YES")

else:

    print("NO")

# optimized version of the same code:

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

if b - a == c - b:

    print("YES")

else:

    print("NO")


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import math

print((math.factorial(int(eval(input())))%1000000007))

# optimized version of the same code:

num = int(eval(input()))

result = 1

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

    result = result *i % 1000000007

print(result)

import math

print((math.factorial(int(eval(input()))) % 1000000007))

num = int(eval(input()))
result = 1
for i in range(1, num + 1):
    result = result * i % 1000000007
print(result)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

count = 0

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

    j = str(i)

    if j==''.join(reversed(j)):

        count += 1

print(count)

# optimized version of the same code:

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

n = [i for i in map(str, list(range(a,b+1))) if i==i[::-1]]

print((len(n)))

a, b = list(map(int, input().split()))
count = 0
for i in range(a, b + 1):
    j = str(i)
    if j == "".join(reversed(j)):
        count += 1
print(count)

a, b = list(map(int, input().split()))
n = [i for i in map(str, list(range(a, b + 1))) if i == i[::-1]]
print((len(n)))

+n = [i for i in map(str, list(range(a, b + 1))) if i == i[::-1]]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

from numpy import *

eval(input())

print((" ".join(map(str,argsort(list(map(int,input().split())))+1))))

# optimized version of the same code:

N = int(eval(input()))

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

B = N*[0]

for n in range(N):

  B[A[n]-1]=n+1

print((*B))

from numpy import *

eval(input())
print((" ".join(map(str, argsort(list(map(int, input().split()))) + 1))))

N = int(eval(input()))
A = list(map(int, input().split()))
B = N * [0]
for n in range(N):
    B[A[n] - 1] = n + 1
print((*B))

-print((" ".join(map(str, argsort(list(map(int, input().split()))) + 1))))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

from collections import Counter

import numpy as np

N = int(eval(input()))

A = np.array(input().split(), dtype=np.int64)

c = Counter(A.cumsum())

c[0] += 1 # np.cumsum(), 0start では無い為 0を加える

ans = sum(v*(v-1)//2 for v in list(c.values()))

print(ans)

# optimized version of the same code:

from itertools import accumulate

from collections import defaultdict

def resolve():

    N = int(eval(input()))

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

    Acum = [0] + list(accumulate(A))

    dic = defaultdict(int)

    ans = 0

    for i in range(N + 1):

        ans += dic[Acum[i]]

        dic[Acum[i]] += 1

    print(ans)

if __name__ == "__main__":

    resolve()

from collections import Counter
import numpy as np

N = int(eval(input()))
A = np.array(input().split(), dtype=np.int64)
c = Counter(A.cumsum())
c[0] += 1  # np.cumsum(), 0start では無い為 0を加える
ans = sum(v * (v - 1) // 2 for v in list(c.values()))
print(ans)

-A = np.array(input().split(), dtype=np.int64)

-c[0] += 1  # np.cumsum(), 0start では無い為 0を加える

-ans = sum(v * (v - 1) // 2 for v in list(c.values()))

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


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

#!/usr/bin/env pypy3

import math

print((math.factorial(int(eval(input()))) % 1000000007))

# optimized version of the same code:

n = int(eval(input()))

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

	n *= i

	n %= 10**9 + 7

print(n)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

"""

Created on Sat Apr 25 18:20:35 2020

"""

import sys

import numpy as np

sys.setrecursionlimit(10 ** 9)

#def input():

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

mod = 10**9+7

#N = int(input())

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

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

dp = [True for i in range(K + A[-1] + 1)]

for i in range(K):

    if dp[i]:

        for a in A:

            dp[i + a] = False

#    print(i, dp[i],A+i,dp[A+i])

#print(dp)

if dp[K]:

    ans = 'Second'

else:

    ans = 'First'

print(ans)

# optimized version of the same code:

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

"""

Created on Sat Apr 25 18:20:35 2020

"""

import sys

import numpy as np

sys.setrecursionlimit(10 ** 9)

#def input():

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

mod = 10**9+7

#N = int(input())

#N, K = map(int,input().split())

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

N, K, *A = list(map(int, open(0).read().split()))

dp = [True for i in range(K + A[-1] + 1)]

for i in range(K):

    if dp[i]:

        for a in A:

            dp[i + a] = False

#    print(i, dp[i],A+i,dp[A+i])

#print(dp)

if dp[K]:

    ans = 'Second'

else:

    ans = 'First'

print(ans)

# -*- coding: utf-8 -*-
"""
Created on Sat Apr 25 18:20:35 2020
"""
import sys
import numpy as np

sys.setrecursionlimit(10**9)
# def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9 + 7
# N = int(input())
N, K = list(map(int, input().split()))
A = np.array(list(map(int, input().split())))
dp = [True for i in range(K + A[-1] + 1)]
for i in range(K):
    if dp[i]:
        for a in A:
            dp[i + a] = False
#    print(i, dp[i],A+i,dp[A+i])
# print(dp)
if dp[K]:
    ans = "Second"
else:
    ans = "First"
print(ans)

# -*- coding: utf-8 -*-
"""
Created on Sat Apr 25 18:20:35 2020
"""
import sys
import numpy as np

sys.setrecursionlimit(10**9)
# def input():
#    return sys.stdin.readline()[:-1]
mod = 10**9 + 7
# N = int(input())
# N, K = map(int,input().split())
# A = np.array(list(map(int,input().split())))
N, K, *A = list(map(int, open(0).read().split()))
dp = [True for i in range(K + A[-1] + 1)]
for i in range(K):
    if dp[i]:
        for a in A:
            dp[i + a] = False
#    print(i, dp[i],A+i,dp[A+i])
# print(dp)
if dp[K]:
    ans = "Second"
else:
    ans = "First"
print(ans)

-A = np.array(list(map(int, input().split())))

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

+N, K, *A = list(map(int, open(0).read().split()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

(N, K), *AB = [list(map(int, s.split())) for s in open(0)]

for a, b in sorted(AB):

    K -= b

    if K <= 0:

        print(a)

        break

# optimized version of the same code:

N, K, *AB = list(map(int, open(0).read().split()))

li = [(a, b) for a, b in zip(*[iter(AB)] * 2)]

li.sort()

for a, b in li:

    if K > b:

        K -= b

    else:

        print(a)

        break

-(N, K), *AB = [list(map(int, s.split())) for s in open(0)]

+N, K, *AB = list(map(int, open(0).read().split()))

+li = [(a, b) for a, b in zip(*[iter(AB)] * 2)]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

mod = int(1e9+7)

n = int(eval(input()))

power = 1

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

    power = power * i % mod

print(power)

# optimized version of the same code:

import sys

MOD = 10 ** 9 + 7

n = int(sys.stdin.readline().rstrip())

def main():

    res = 1

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

        res *= i

        res %= MOD

    return res

if __name__ == '__main__':

    ans = main()

    print(ans)

mod = int(1e9 + 7)
n = int(eval(input()))
power = 1
for i in range(1, n + 1):
    power = power * i % mod
print(power)

import sys

MOD = 10**9 + 7
n = int(sys.stdin.readline().rstrip())

def main():
    res = 1
    for i in range(1, n + 1):
        res *= i
        res %= MOD
    return res

if __name__ == "__main__":
    ans = main()
    print(ans)

-mod = int(1e9 + 7)
-n = int(eval(input()))
-power = 1
-for i in range(1, n + 1):
-    power = power * i % mod
-print(power)
+import sys
+
+MOD = 10**9 + 7
+n = int(sys.stdin.readline().rstrip())
+
+
+def main():
+    res = 1
+    for i in range(1, n + 1):
+        res *= i
+        res %= MOD
+    return res
+
+
+if __name__ == "__main__":
+    ans = main()
+    print(ans)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

N=int(eval(input()))

def gcd(a,b):

    c=int(np.floor(a/b))

    return a-b*c

if gcd(N,2)==0:

    print(N)

else:

    print((2*N))

# optimized version of the same code:

N=int(eval(input()))

if N%2==0:

    print(N)

else:

    print((2*N))

import numpy as np

N = int(eval(input()))

def gcd(a, b):
    c = int(np.floor(a / b))
    return a - b * c

if gcd(N, 2) == 0:
    print(N)
else:
    print((2 * N))

N = int(eval(input()))
if N % 2 == 0:
    print(N)
else:
    print((2 * N))

-import numpy as np
-def gcd(a, b):
-    c = int(np.floor(a / b))
-    return a - b * c
-if gcd(N, 2) == 0:
+if N % 2 == 0:


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

L = [list(map(int, input().split())) for i in range(N)]

V = 0

for i in range(N):

  V += L[i][1]

dp = [[10**9+1] * (V + 1) for i in range(N+1)]

dp[0][0] = 0

for i in range(N):

    for j in range(V+1):

        if j - L[i][1] >= 0:

          dp[i+1][j] = min(dp[i][j], dp[i][j-L[i][1]] + L[i][0])

        else:

          dp[i+1][j] = dp[i][j]

ans = 0

for j in range(V+1):

    if  W >= dp[-1][j]:

        ans = max(ans, j)

print(ans)

# optimized version of the same code:

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

L = [list(map(int, input().split())) for i in range(N)]

V = 0

for i in range(N):

  V += L[i][1]

dp = [10**9+1] * (V + 1)

dp[0] = 0

for i in range(N):

    for j in range(V, -1, -1):

        dp[j] = min(dp[j], dp[j-L[i][1]] + L[i][0])

ans = 0

for j in range(V+1):

    if  W >= dp[j]:

        ans = max(ans, j)

print(ans)

N, W = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(N)]
V = 0
for i in range(N):
    V += L[i][1]
dp = [[10**9 + 1] * (V + 1) for i in range(N + 1)]
dp[0][0] = 0
for i in range(N):
    for j in range(V + 1):
        if j - L[i][1] >= 0:
            dp[i + 1][j] = min(dp[i][j], dp[i][j - L[i][1]] + L[i][0])
        else:
            dp[i + 1][j] = dp[i][j]
ans = 0
for j in range(V + 1):
    if W >= dp[-1][j]:
        ans = max(ans, j)
print(ans)

N, W = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(N)]
V = 0
for i in range(N):
    V += L[i][1]
dp = [10**9 + 1] * (V + 1)
dp[0] = 0
for i in range(N):
    for j in range(V, -1, -1):
        dp[j] = min(dp[j], dp[j - L[i][1]] + L[i][0])
ans = 0
for j in range(V + 1):
    if W >= dp[j]:
        ans = max(ans, j)
print(ans)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

s = eval(input())

start = -1

end = 0

for i in range(len(s)):

    if s[i] == 'A' and start < 0:

        start = i

    elif s[i] == 'Z':

        end = i

print((end - start + 1))

# optimized version of the same code:

s = eval(input())

start = 0

for i in range(len(s)):

    if s[i] == 'A':

        start = i

        break

end = 0

for i in reversed(list(range(len(s)))):

    if s[i] == 'Z':

        end = i

        break

print((end - start + 1))

s = eval(input())
start = -1
end = 0
for i in range(len(s)):
    if s[i] == "A" and start < 0:
        start = i
    elif s[i] == "Z":
        end = i
print((end - start + 1))

s = eval(input())
start = 0
for i in range(len(s)):
    if s[i] == "A":
        start = i
        break
end = 0
for i in reversed(list(range(len(s)))):
    if s[i] == "Z":
        end = i
        break
print((end - start + 1))

+for i in reversed(list(range(len(s)))):


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

while 1:

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

 if n+x==0:break

 print((len([1 for i in range(3,n+1)for j in range(2,x-i)if x-i-j<j<i])))

# optimized version of the same code:

while 1:

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

 if n+x==0:break

 print((len([1 for i in range(1,n-1)for j in range(i+1,n)if j<x-i-j<=n])))

while 1:
    n, x = list(map(int, input().split()))
    if n + x == 0:
        break
    print(
        (
            len(
                [
                    1
                    for i in range(3, n + 1)
                    for j in range(2, x - i)
                    if x - i - j < j < i
                ]
            )
        )
    )

while 1:
    n, x = list(map(int, input().split()))
    if n + x == 0:
        break
    print(
        (
            len(
                [
                    1
                    for i in range(1, n - 1)
                    for j in range(i + 1, n)
                    if j < x - i - j <= n
                ]
            )
        )
    )

-                    for i in range(3, n + 1)

-                    for j in range(2, x - i)

-                    if x - i - j < j < i

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

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

+                    if j < x - i - j <= n


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

A = np.zeros((3,3),int)

for i in range(3):

    A[i,:] = np.array([int(x) for x in input().split()])

N = int(eval(input()))

for _ in range(N):

    b = int(eval(input()))

    A[A==b] = 0

ans = 'No'

if np.sum(A[0,:])==0 or np.sum(A[1,:])==0 or np.sum(A[2,:])==0 or np.sum(A[:,0])==0 or np.sum(A[:,1])==0 or np.sum(A[:,2])==0 or np.sum(A[0,0]+A[1,1]+A[2,2])==0 or np.sum(A[0,2]+A[1,1]+A[2,0])==0:

   ans = 'Yes'

print(ans)

# optimized version of the same code:

# B - Bingo

import numpy as np

A = np.zeros((3,3), dtype=np.int64)

for i in range(3):

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

N = int(input())

for _ in range(N):

    b = int(input())

    A = np.where(A==b, 0, A)

if sum(A[0])==0 or sum(A[1])==0 or sum(A[2])==0 or \

    sum(A[:,0])==0 or sum(A[:,1])==0 or sum(A[:,2])==0 or \

    A[0,0]+A[1,1]+A[2,2]==0 or \

    A[2,0]+A[1,1]+A[0,2]==0:

    print('Yes')

else:

    print('No')

import numpy as np

A = np.zeros((3, 3), int)
for i in range(3):
    A[i, :] = np.array([int(x) for x in input().split()])
N = int(eval(input()))
for _ in range(N):
    b = int(eval(input()))
    A[A == b] = 0
ans = "No"
if (
    np.sum(A[0, :]) == 0
    or np.sum(A[1, :]) == 0
    or np.sum(A[2, :]) == 0
    or np.sum(A[:, 0]) == 0
    or np.sum(A[:, 1]) == 0
    or np.sum(A[:, 2]) == 0
    or np.sum(A[0, 0] + A[1, 1] + A[2, 2]) == 0
    or np.sum(A[0, 2] + A[1, 1] + A[2, 0]) == 0
):
    ans = "Yes"
print(ans)

# B - Bingo
import numpy as np

A = np.zeros((3, 3), dtype=np.int64)
for i in range(3):
    A[i] = [int(x) for x in input().split()]
N = int(input())
for _ in range(N):
    b = int(input())
    A = np.where(A == b, 0, A)
if (
    sum(A[0]) == 0
    or sum(A[1]) == 0
    or sum(A[2]) == 0
    or sum(A[:, 0]) == 0
    or sum(A[:, 1]) == 0
    or sum(A[:, 2]) == 0
    or A[0, 0] + A[1, 1] + A[2, 2] == 0
    or A[2, 0] + A[1, 1] + A[0, 2] == 0
):
    print("Yes")
else:
    print("No")

-    A[i, :] = np.array([int(x) for x in input().split()])

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


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

def main():

    from sys import stdin

    input = stdin.readline

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

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

    for i in range(r):

        l[i] -= 1

    d = [[10**8] * n for _ in range(n)]

    for _ in range(m):

        i, j, k = list(map(int, input().split()))

        d[i-1][j-1] = k

        d[j-1][i-1] = k

    # Warshall-Floyd algorithm

    for k in range(n):

        for i in range(n):

            for j in range(n):

                if d[i][j] > d[i][k] + d[k][j]:

                    d[i][j] = d[i][k] + d[k][j]

    # full search

    # 8! = 40320

    from itertools import permutations

    answer = 10**8

    for i in permutations(l):

        ans = 0

        for j in range(r-1):

            ans += d[i[j]][i[j+1]]

        if ans < answer:

            answer = ans

    print(answer)

main()

# optimized version of the same code:

def main():

    from sys import stdin

    input = stdin.readline

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

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

    for i in range(r):

        l[i] -= 1

    d = [[10**8] * n for _ in range(n)]

    for _ in range(m):

        i, j, k = list(map(int, input().split()))

        d[i-1][j-1] = k

        d[j-1][i-1] = k

    # Warshall-Floyd algorithm

    for k in range(n):

        for i in range(n-1):

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

                if d[i][j] > d[i][k] + d[k][j]:

                    d[i][j] = d[i][k] + d[k][j]

                    d[j][i] = d[i][j]

    # full search

    # 8! = 40320

    from itertools import permutations

    answer = 10**8

    for i in permutations(l):

        ans = 0

        for j in range(r-1):

            ans += d[i[j]][i[j+1]]

        if ans < answer:

            answer = ans

    print(answer)

main()

def main():
    from sys import stdin

    input = stdin.readline
    n, m, r = list(map(int, input().split()))
    l = list(map(int, input().split()))
    for i in range(r):
        l[i] -= 1
    d = [[10**8] * n for _ in range(n)]
    for _ in range(m):
        i, j, k = list(map(int, input().split()))
        d[i - 1][j - 1] = k
        d[j - 1][i - 1] = k
    # Warshall-Floyd algorithm
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]
    # full search
    # 8! = 40320
    from itertools import permutations

    answer = 10**8
    for i in permutations(l):
        ans = 0
        for j in range(r - 1):
            ans += d[i[j]][i[j + 1]]
        if ans < answer:
            answer = ans
    print(answer)

main()

def main():
    from sys import stdin

    input = stdin.readline
    n, m, r = list(map(int, input().split()))
    l = list(map(int, input().split()))
    for i in range(r):
        l[i] -= 1
    d = [[10**8] * n for _ in range(n)]
    for _ in range(m):
        i, j, k = list(map(int, input().split()))
        d[i - 1][j - 1] = k
        d[j - 1][i - 1] = k
    # Warshall-Floyd algorithm
    for k in range(n):
        for i in range(n - 1):
            for j in range(i + 1, n):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]
                    d[j][i] = d[i][j]
    # full search
    # 8! = 40320
    from itertools import permutations

    answer = 10**8
    for i in permutations(l):
        ans = 0
        for j in range(r - 1):
            ans += d[i[j]][i[j + 1]]
        if ans < answer:
            answer = ans
    print(answer)

main()

-        for i in range(n):
-            for j in range(n):
+        for i in range(n - 1):
+            for j in range(i + 1, n):
+                    d[j][i] = d[i][j]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

from collections import Counter

S = input()[::-1]

memo = [0]

d = 0

mod = 2019

for s in S:

    tmp = int(s) * pow(10, d, mod) % mod

    tmp = memo[-1] + tmp

    memo.append(tmp % mod)

    d += 1

c = Counter(memo)

ans = sum(v * (v - 1) // 2 for v in list(c.values()))

print(ans)

# optimized version of the same code:

from collections import defaultdict

S = eval(input())

N = len(S)

memo = defaultdict(int)

memo[0] += 1

mod = 2019

d = 1

val = 0

for s in S[::-1]:

    s = int(s)

    val += s * d

    val %= mod

    memo[val] += 1

    d *= 10

    d %= mod

print((sum(v * (v - 1) // 2 for v in list(memo.values()))))

-    tmp = int(s) * pow(10, d, mod) % mod

-ans = sum(v * (v - 1) // 2 for v in list(c.values()))

+print((sum(v * (v - 1) // 2 for v in list(memo.values()))))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

a = eval(input())

print(('A' if not a.islower() else 'a'))

# optimized version of the same code:

print(('A' if input().isupper() else 'a'))

a = eval(input())
print(("A" if not a.islower() else "a"))

-print(("A" if not a.islower() else "a"))

+print(("A" if input().isupper() else "a"))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

N=int(eval(input()))

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

for i in range(N):

  for j in range(1,31):

    if a[i]%(2**j)!=0:

      a[i]=j-1

      break

print((sum(a)))

# optimized version of the same code:

import sys

input = sys.stdin.buffer.readline

N = int(eval(input()))

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

def f(n):

  res = 0

  while n % 2 == 0:

    n //= 2

    res += 1

  return res

answer = 0

for a in A:

  answer += f(a)

print(answer)

N = int(eval(input()))
a = list(map(int, input().split()))
for i in range(N):
    for j in range(1, 31):
        if a[i] % (2**j) != 0:
            a[i] = j - 1
            break
print((sum(a)))

+import sys
+
+input = sys.stdin.buffer.readline
-a = list(map(int, input().split()))
-for i in range(N):
-    for j in range(1, 31):
-        if a[i] % (2**j) != 0:
-            a[i] = j - 1
-            break
-print((sum(a)))
+A = list(map(int, input().split()))
+
+
+def f(n):
+    res = 0
+    while n % 2 == 0:
+        n //= 2
+        res += 1
+    return res
+
+
+answer = 0
+for a in A:
+    answer += f(a)
+print(answer)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

n,m = [int(i) for i in input().split()]

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

d = 2**18

f = np.zeros(d,dtype=int)

for i in a:

    f[i]+=1

tf = np.fft.fft(f)

f = np.fft.ifft(tf*tf)

f = [int(i+0.5) for i in f]

ans=0

for i in range(len(f)-1,0,-1):

    if f[i]<=m:

        ans+=i*f[i]

        m-=f[i]

    elif f[i]>m:

        ans+=i*m

        break

print(ans)

# optimized version of the same code:

import numpy as np

n,m = [int(i) for i in input().split()]

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

d = 2**18

f = np.zeros(d,dtype=int)

for i in a:

    f[i]+=1

tf = np.fft.rfft(f)

f = np.fft.irfft(tf*tf)

f = [int(i+0.5) for i in f]

ans=0

for i in range(len(f)-1,0,-1):

    if f[i]<=m:

        ans+=i*f[i]

        m-=f[i]

    elif f[i]>m:

        ans+=i*m

        break

print(ans)

import numpy as np

n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
d = 2**18
f = np.zeros(d, dtype=int)
for i in a:
    f[i] += 1
tf = np.fft.fft(f)
f = np.fft.ifft(tf * tf)
f = [int(i + 0.5) for i in f]
ans = 0
for i in range(len(f) - 1, 0, -1):
    if f[i] <= m:
        ans += i * f[i]
        m -= f[i]
    elif f[i] > m:
        ans += i * m
        break
print(ans)

import numpy as np

n, m = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
d = 2**18
f = np.zeros(d, dtype=int)
for i in a:
    f[i] += 1
tf = np.fft.rfft(f)
f = np.fft.irfft(tf * tf)
f = [int(i + 0.5) for i in f]
ans = 0
for i in range(len(f) - 1, 0, -1):
    if f[i] <= m:
        ans += i * f[i]
        m -= f[i]
    elif f[i] > m:
        ans += i * m
        break
print(ans)

-tf = np.fft.fft(f)
-f = np.fft.ifft(tf * tf)
+tf = np.fft.rfft(f)
+f = np.fft.irfft(tf * tf)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

cnt = 0

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

    i = str(i)

    if i[0] == i[-1] and i[1] == i[-2]:

        cnt += 1

print(cnt)

# optimized version of the same code:

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

cnt = 0

for i in range(10):

    for j in range(10):

        for k in range(10):

            c = 10000*i+1000*j+100*k+10*j+i

            if a <= c <= b:

                cnt += 1

print(cnt)

a, b = list(map(int, input().split()))
cnt = 0
for i in range(a, b + 1):
    i = str(i)
    if i[0] == i[-1] and i[1] == i[-2]:
        cnt += 1
print(cnt)

a, b = list(map(int, input().split()))
cnt = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            c = 10000 * i + 1000 * j + 100 * k + 10 * j + i
            if a <= c <= b:
                cnt += 1
print(cnt)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

cnt = 0

for i in range(k + 1):

    for j in range(k + 1):

        if i + j > s:

            break

        elif s - i - j <= k:

            cnt += 1

print(cnt)

# optimized version of the same code:

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

cnt = 0

for i in range(k + 1):

    for j in range(k + 1):

        if 0 <= s - i - j <= k:

            cnt += 1

print(cnt)

-        if i + j > s:
-            break
-        elif s - i - j <= k:
+        if 0 <= s - i - j <= k:


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

from collections import Counter

s = eval(input())

mod1 = 673

mod2 = 3

num1 = 0

num2 = 0

li1 = []

li2 = []

pw1 = 10

pw2 = 10

for i, e in enumerate(s, 1):

    num1 *= 10

    num1 += int(e)

    num1 %= mod1

    inv = pow(pw1, mod1 - 2, mod1)

    li1.append(num1 * inv % mod1)

    num2 *= 10

    num2 += int(e)

    num2 %= mod2

    inv = pow(pw2, mod2 - 2, mod2)

    li2.append(num2 * inv % mod2)

    pw1 *= 10

    pw1 %= mod1

    pw2 *= 10

    pw2 %= mod2

li = [0] + [10 * e1 + e2 for e1, e2 in zip(li1, li2)]

c = Counter(li)

ans = 0

for v in list(c.values()):

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

print(ans)

# optimized version of the same code:

from collections import Counter

def f(mod):

    ret = [0]

    power = 1

    num = 0

    for i, e in enumerate(s, 1):

        num *= 10

        num += int(e)

        num %= mod

        power *= 10

        power %= mod

        inv = pow(power, mod - 2, mod)

        ret.append(num * inv % mod)

    return ret

s = eval(input())

mod3 = f(3)

mod673 = f(673)

li = [10 * e673 + e3 for e3, e673 in zip(mod3, mod673)]

c = Counter(li)

ans = 0

for v in list(c.values()):

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

print(ans)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import sys

input = sys.stdin.readline

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

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

# N: 処理する区間の長さ

INF = 0

mx = 300001

LV = (mx-1).bit_length()

N0 = 2**LV

data = [INF]*(2*N0)

lazy = [None]*(2*N0)

# 伝搬対象の区間を求める

def gindex(l, r):

    L = (l + N0) >> 1; R = (r + N0) >> 1

    lc = 0 if l & 1 else (L & -L).bit_length()

    rc = 0 if r & 1 else (R & -R).bit_length()

    for i in range(LV):

        if rc <= i:

            yield R

        if L < R and lc <= i:

            yield L

        L >>= 1; R >>= 1

# 遅延伝搬処理

def propagates(*ids):

    for i in reversed(ids):

        v = lazy[i-1]

        if v is None:

            continue

        lazy[2*i-1] = data[2*i-1] = lazy[2*i] = data[2*i] = v

        lazy[i-1] = None

# 区間[l, r)をxで更新

def update(l, r, x):

    *ids, = gindex(l, r)

    propagates(*ids)

    L = N0 + l; R = N0 + r

    while L < R:

        if R & 1:

            R -= 1

            lazy[R-1] = data[R-1] = x

        if L & 1:

            lazy[L-1] = data[L-1] = x

            L += 1

        L >>= 1; R >>= 1

    for i in ids:

        data[i-1] = max(data[2*i-1], data[2*i])

# 区間[l, r)内の最小値を求める

def query(l, r):

    propagates(*gindex(l, r))

    L = N0 + l; R = N0 + r

    s = INF

    while L < R:

        if R & 1:

            R -= 1

            s = max(s, data[R-1])

        if L & 1:

            s = max(s, data[L-1])

            L += 1

        L >>= 1; R >>= 1

    return s

update(As[0],As[0]+1,1)

for i, a in enumerate(As[1:]):

    l = max(0,a-k)

    r = min(mx,a+k)

    upd = query(l,r+1)

    if upd == -1:continue

    # print("i",i,"a",a,"upd",upd,"l",l,"r",r)

    update(a, a+1, upd+1)

ans = 0

for a in set(As):

    ans = max(ans,query(a,a+1))

print(ans)

# optimized version of the same code:

import sys

input = sys.stdin.readline

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

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

# N: 処理する区間の長さ

INF = 0

mx = 300001

LV = (mx-1).bit_length()

N0 = 2**LV

data = [INF]*(2*N0)

lazy = [None]*(2*N0)

# 伝搬対象の区間を求める

def gindex(l, r):

    L = (l + N0) >> 1; R = (r + N0) >> 1

    lc = 0 if l & 1 else (L & -L).bit_length()

    rc = 0 if r & 1 else (R & -R).bit_length()

    for i in range(LV):

        if rc <= i:

            yield R

        if L < R and lc <= i:

            yield L

        L >>= 1; R >>= 1

# 遅延伝搬処理

def propagates(*ids):

    for i in reversed(ids):

        v = lazy[i-1]

        if v is None:

            continue

        lazy[2*i-1] = data[2*i-1] = lazy[2*i] = data[2*i] = v

        lazy[i-1] = None

# 区間[l, r)をxで更新

def update(l, r, x):

    *ids, = gindex(l, r)

    propagates(*ids)

    L = N0 + l; R = N0 + r

    while L < R:

        if R & 1:

            R -= 1

            lazy[R-1] = data[R-1] = x

        if L & 1:

            lazy[L-1] = data[L-1] = x

            L += 1

        L >>= 1; R >>= 1

    for i in ids:

        data[i-1] = max(data[2*i-1], data[2*i])

# 区間[l, r)内の最小値を求める

def query(l, r):

    propagates(*gindex(l, r))

    L = N0 + l; R = N0 + r

    s = INF

    while L < R:

        if R & 1:

            R -= 1

            s = max(s, data[R-1])

        if L & 1:

            s = max(s, data[L-1])

            L += 1

        L >>= 1; R >>= 1

    return s

ans = 0

update(As[0],As[0]+1,1)

for i, a in enumerate(As[1:]):

    l = max(0,a-k)

    r = min(mx,a+k)

    upd = query(l,r+1)

    if upd == -1:continue

    # print("i",i,"a",a,"upd",upd,"l",l,"r",r)

    update(a, a+1, upd+1)

    ans = max(ans, upd+1)

print(ans)

import sys

input = sys.stdin.readline
n, k = list(map(int, input().split()))
As = [int(eval(input())) for i in range(n)]
# N: 処理する区間の長さ
INF = 0
mx = 300001
LV = (mx - 1).bit_length()
N0 = 2**LV
data = [INF] * (2 * N0)
lazy = [None] * (2 * N0)
# 伝搬対象の区間を求める
def gindex(l, r):
    L = (l + N0) >> 1
    R = (r + N0) >> 1
    lc = 0 if l & 1 else (L & -L).bit_length()
    rc = 0 if r & 1 else (R & -R).bit_length()
    for i in range(LV):
        if rc <= i:
            yield R
        if L < R and lc <= i:
            yield L
        L >>= 1
        R >>= 1

# 遅延伝搬処理
def propagates(*ids):
    for i in reversed(ids):
        v = lazy[i - 1]
        if v is None:
            continue
        lazy[2 * i - 1] = data[2 * i - 1] = lazy[2 * i] = data[2 * i] = v
        lazy[i - 1] = None

# 区間[l, r)をxで更新
def update(l, r, x):
    (*ids,) = gindex(l, r)
    propagates(*ids)
    L = N0 + l
    R = N0 + r
    while L < R:
        if R & 1:
            R -= 1
            lazy[R - 1] = data[R - 1] = x
        if L & 1:
            lazy[L - 1] = data[L - 1] = x
            L += 1
        L >>= 1
        R >>= 1
    for i in ids:
        data[i - 1] = max(data[2 * i - 1], data[2 * i])

# 区間[l, r)内の最小値を求める
def query(l, r):
    propagates(*gindex(l, r))
    L = N0 + l
    R = N0 + r
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = max(s, data[R - 1])
        if L & 1:
            s = max(s, data[L - 1])
            L += 1
        L >>= 1
        R >>= 1
    return s

update(As[0], As[0] + 1, 1)
for i, a in enumerate(As[1:]):
    l = max(0, a - k)
    r = min(mx, a + k)
    upd = query(l, r + 1)
    if upd == -1:
        continue
    # print("i",i,"a",a,"upd",upd,"l",l,"r",r)
    update(a, a + 1, upd + 1)
ans = 0
for a in set(As):
    ans = max(ans, query(a, a + 1))
print(ans)

import sys

input = sys.stdin.readline
n, k = list(map(int, input().split()))
As = [int(eval(input())) for i in range(n)]
# N: 処理する区間の長さ
INF = 0
mx = 300001
LV = (mx - 1).bit_length()
N0 = 2**LV
data = [INF] * (2 * N0)
lazy = [None] * (2 * N0)
# 伝搬対象の区間を求める
def gindex(l, r):
    L = (l + N0) >> 1
    R = (r + N0) >> 1
    lc = 0 if l & 1 else (L & -L).bit_length()
    rc = 0 if r & 1 else (R & -R).bit_length()
    for i in range(LV):
        if rc <= i:
            yield R
        if L < R and lc <= i:
            yield L
        L >>= 1
        R >>= 1

# 遅延伝搬処理
def propagates(*ids):
    for i in reversed(ids):
        v = lazy[i - 1]
        if v is None:
            continue
        lazy[2 * i - 1] = data[2 * i - 1] = lazy[2 * i] = data[2 * i] = v
        lazy[i - 1] = None

# 区間[l, r)をxで更新
def update(l, r, x):
    (*ids,) = gindex(l, r)
    propagates(*ids)
    L = N0 + l
    R = N0 + r
    while L < R:
        if R & 1:
            R -= 1
            lazy[R - 1] = data[R - 1] = x
        if L & 1:
            lazy[L - 1] = data[L - 1] = x
            L += 1
        L >>= 1
        R >>= 1
    for i in ids:
        data[i - 1] = max(data[2 * i - 1], data[2 * i])

# 区間[l, r)内の最小値を求める
def query(l, r):
    propagates(*gindex(l, r))
    L = N0 + l
    R = N0 + r
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = max(s, data[R - 1])
        if L & 1:
            s = max(s, data[L - 1])
            L += 1
        L >>= 1
        R >>= 1
    return s

ans = 0
update(As[0], As[0] + 1, 1)
for i, a in enumerate(As[1:]):
    l = max(0, a - k)
    r = min(mx, a + k)
    upd = query(l, r + 1)
    if upd == -1:
        continue
    # print("i",i,"a",a,"upd",upd,"l",l,"r",r)
    update(a, a + 1, upd + 1)
    ans = max(ans, upd + 1)
print(ans)

+ans = 0
-ans = 0
-for a in set(As):
-    ans = max(ans, query(a, a + 1))
+    ans = max(ans, upd + 1)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

K, N = [int(i) for i in input().rstrip().split(' ')]

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

x = A[0]

y = K - A[-1]

n = [int(A[i+1] - A[i]) for i in range(N-1)]

n.append(x+y)

np_list = np.array(n)

n.pop(np_list.argmax())

print((sum(n)))

# optimized version of the same code:

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

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

dp = [0 for i in range(n)]

dp[0] = abs(k-a[-1]) + a[0]

for i in range(1,n):

    dp[i] = abs(a[i]-a[i-1])

print((sum(dp) - max(dp)))

import numpy as np

K, N = [int(i) for i in input().rstrip().split(" ")]
A = [int(i) for i in input().rstrip().split(" ")]
x = A[0]
y = K - A[-1]
n = [int(A[i + 1] - A[i]) for i in range(N - 1)]
n.append(x + y)
np_list = np.array(n)
n.pop(np_list.argmax())
print((sum(n)))

k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
dp = [0 for i in range(n)]
dp[0] = abs(k - a[-1]) + a[0]
for i in range(1, n):
    dp[i] = abs(a[i] - a[i - 1])
print((sum(dp) - max(dp)))

-K, N = [int(i) for i in input().rstrip().split(" ")]

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

-n = [int(A[i + 1] - A[i]) for i in range(N - 1)]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

from math import sqrt

from scipy.misc import comb

def cal_factors(num):

    factors = {}

    maxmod = int(sqrt(num)) + 1

    for mod in range(2, maxmod):

        i = 0

        while True:

            d, q = divmod(num, mod)

            if q == 0:

                num = d

                i += 1

                factors[mod] = i

            else:

                break

    if num > 1:

        factors[num] = 1

    return factors

n, m = [int(v) for v in input().split()]

mod = 1000000000 + 7

factors = cal_factors(m)

ans = 1

for v in list(factors.values()):

    ans *= comb(v + n - 1, v, exact=True) % mod

    ans %= mod

print(ans)

# optimized version of the same code:

from math import sqrt

def cal_factors(num):

    factors = {}

    maxmod = int(sqrt(num)) + 1

    for mod in range(2, maxmod):

        i = 0

        while True:

            d, q = divmod(num, mod)

            if q == 0:

                num = d

                i += 1

                factors[mod] = i

            else:

                break

    if num > 1:

        factors[num] = 1

    return factors

def comb(n, r, mod):

    result = 1

    r = min(r, n-r)

    for i in range(n, n-r, -1):

        result *= i

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

        result //= i

    return result % mod

n, m = [int(v) for v in input().split()]

mod = 1000000000 + 7

factors = cal_factors(m)

ans = 1

for v in list(factors.values()):

    ans *= comb(v + n - 1, v, mod)

    ans %= mod

print(ans)

from math import sqrt

def cal_factors(num):
    factors = {}
    maxmod = int(sqrt(num)) + 1
    for mod in range(2, maxmod):
        i = 0
        while True:
            d, q = divmod(num, mod)
            if q == 0:
                num = d
                i += 1
                factors[mod] = i
            else:
                break
    if num > 1:
        factors[num] = 1
    return factors

def comb(n, r, mod):
    result = 1
    r = min(r, n - r)
    for i in range(n, n - r, -1):
        result *= i
    for i in range(2, r + 1):
        result //= i
    return result % mod

n, m = [int(v) for v in input().split()]
mod = 1000000000 + 7
factors = cal_factors(m)
ans = 1
for v in list(factors.values()):
    ans *= comb(v + n - 1, v, mod)
    ans %= mod
print(ans)

-    ans *= comb(v + n - 1, v, exact=True) % mod


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

a, b, c, x, y = list(map(int, input().split(' ')))

c = int(c*2)

m = float('inf')

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

    m = min(m, a*max(0, x-i)+b*max(0,y-i)+c*i)

print(m)

# optimized version of the same code:

import math

a, b, c, x, y = list(map(int, input().split(' ')))

ans = float('inf')

c = c*2

for i in range(max(x, y)+1):

    if i > x:

        price = b*(y-i) + c*i

    elif i > y:

        price = a*(x-i) + c*i

    else:

        price = a*(x-i) + b*(y-i) + c*i

    if ans > price:

        ans = price

print(ans)

a, b, c, x, y = list(map(int, input().split(" ")))
c = int(c * 2)
m = float("inf")
for i in range(10**5 + 1):
    m = min(m, a * max(0, x - i) + b * max(0, y - i) + c * i)
print(m)

import math

a, b, c, x, y = list(map(int, input().split(" ")))
ans = float("inf")
c = c * 2
for i in range(max(x, y) + 1):
    if i > x:
        price = b * (y - i) + c * i
    elif i > y:
        price = a * (x - i) + c * i
    else:
        price = a * (x - i) + b * (y - i) + c * i
    if ans > price:
        ans = price
print(ans)

+        price = a * (x - i) + b * (y - i) + c * i


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

from scipy.sparse.csgraph import floyd_warshall

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

l=[list(map(int,input().split())) for i in range(m)]

ans=0

for i in range(m):

    ll=l[:i]+l[i+1:]

    d=[[float('inf')]*n for i in range(n)]

    for i in range(n):

        d[i][i]=0

    for j in ll:

        d[j[0]-1][j[1]-1]=1

        d[j[1]-1][j[0]-1]=1

    d=floyd_warshall(d)

    if float('inf') in d:

        ans+=1

print(ans)

# optimized version of the same code:

class UnionFind():

    def __init__(self, n):

        self.n = n

        self.parents = [-1] * n

    def find(self, x):

        if self.parents[x] < 0:

            return x

        else:

            self.parents[x] = self.find(self.parents[x])

            return self.parents[x]

    def union(self, x, y):

        x = self.find(x)

        y = self.find(y)

        if x == y:

            return

        if self.parents[x] > self.parents[y]:

            x, y = y, x

        self.parents[x] += self.parents[y]

        self.parents[y] = x

    def roots(self):

        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):

        return len(self.roots())

from copy import deepcopy

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

l=[list(map(int,input().split())) for i in range(m)]

cnt=0

for i in range(m):

  uf=UnionFind(n)

  ll=deepcopy(l)

  del ll[i]

  for a,b in ll:

    a-=1

    b-=1

    uf.union(a,b)

  if uf.group_count()>=2:

    cnt+=1

print(cnt)

from scipy.sparse.csgraph import floyd_warshall

n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
ans = 0
for i in range(m):
    ll = l[:i] + l[i + 1 :]
    d = [[float("inf")] * n for i in range(n)]
    for i in range(n):
        d[i][i] = 0
    for j in ll:
        d[j[0] - 1][j[1] - 1] = 1
        d[j[1] - 1][j[0] - 1] = 1
    d = floyd_warshall(d)
    if float("inf") in d:
        ans += 1
print(ans)

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

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

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

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

from copy import deepcopy

n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
cnt = 0
for i in range(m):
    uf = UnionFind(n)
    ll = deepcopy(l)
    del ll[i]
    for a, b in ll:
        a -= 1
        b -= 1
        uf.union(a, b)
    if uf.group_count() >= 2:
        cnt += 1
print(cnt)

-from scipy.sparse.csgraph import floyd_warshall

+            self.parents[x] = self.find(self.parents[x])

+        if self.parents[x] > self.parents[y]:

+        self.parents[x] += self.parents[y]

+        return [i for i, x in enumerate(self.parents) if x < 0]

-    d = [[float("inf")] * n for i in range(n)]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

a = [0]*n

b = [0]*m

c = [[0 for col in range(l)] for row in range(n)]

for i in range(n):

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

for i in range(m):

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

for i in range(n):

    for j in range(l):

        for k in range(m):

            c[i][j] += a[i][k]*b[k][j]

    print((*c[i]))

# optimized version of the same code:

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

a = [0]*n

b = [0]*m

c = [[0 for col in range(l)] for row in range(n)]

for i in range(n):

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

for i in range(m):

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

for i in range(n):

    for j in range(l):

        c[i][j] = sum([a[i][k]*b[k][j] for k in range(m)])

#        for k in range(m):

#            c[i][j] += a[i][k]*b[k][j]

    print((*c[i]))

n, m, l = list(map(int, input().split()))
a = [0] * n
b = [0] * m
c = [[0 for col in range(l)] for row in range(n)]
for i in range(n):
    a[i] = list(map(int, input().split()))
for i in range(m):
    b[i] = list(map(int, input().split()))
for i in range(n):
    for j in range(l):
        for k in range(m):
            c[i][j] += a[i][k] * b[k][j]
    print((*c[i]))

n, m, l = list(map(int, input().split()))
a = [0] * n
b = [0] * m
c = [[0 for col in range(l)] for row in range(n)]
for i in range(n):
    a[i] = list(map(int, input().split()))
for i in range(m):
    b[i] = list(map(int, input().split()))
for i in range(n):
    for j in range(l):
        c[i][j] = sum([a[i][k] * b[k][j] for k in range(m)])
    #        for k in range(m):
    #            c[i][j] += a[i][k]*b[k][j]
    print((*c[i]))

+        c[i][j] = sum([a[i][k] * b[k][j] for k in range(m)])


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

s=list(range(l,r+1))[:2019]

print((min(i*j%2019for i in s for j in s if i<j)))

# optimized version of the same code:

l,r=list(map(int,input().split()));s=list(range(l,r+1))[:673];print((min(i*j%2019for i in s for j in s if i<j)))

l, r = list(map(int, input().split()))
s = list(range(l, r + 1))[:2019]
print((min(i * j % 2019 for i in s for j in s if i < j)))

l, r = list(map(int, input().split()))
s = list(range(l, r + 1))[:673]
print((min(i * j % 2019 for i in s for j in s if i < j)))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

s = eval(input())

cnt = 0

for i in range(len(s) - 1):

    if s[i] == 'W' and s[i + 1] == 'B':

        cnt += 1

    if s[i] == 'B' and s[i + 1] == 'W':

        cnt += 1

print(cnt)

# optimized version of the same code:

S = eval(input())

tmp = S[0]

cnt = 0

for s in S[1:]:

    if tmp != s:

        cnt += 1

        tmp = s

print(cnt)

s = eval(input())
cnt = 0
for i in range(len(s) - 1):
    if s[i] == "W" and s[i + 1] == "B":
        cnt += 1
    if s[i] == "B" and s[i + 1] == "W":
        cnt += 1
print(cnt)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import math

mod = 10 ** 9 + 7

n = int(eval(input()))

print((math.factorial(n) % mod))

# optimized version of the same code:

mod = 10 ** 9 + 7

n = int(eval(input()))

ans = 1

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

    ans *= i

    ans %= mod

print(ans)

import math

mod = 10**9 + 7
n = int(eval(input()))
print((math.factorial(n) % mod))

mod = 10**9 + 7
n = int(eval(input()))
ans = 1
for i in range(1, n + 1):
    ans *= i
    ans %= mod
print(ans)

-import math
-print((math.factorial(n) % mod))
+ans = 1
+for i in range(1, n + 1):
+    ans *= i
+    ans %= mod
+print(ans)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

count = 0

for i in range(A, B+1):

    if(str(i) == str(i)[::-1]):

        count += 1

print(count)

# optimized version of the same code:

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

count = 0

for i in range(10):

    for j in range(10):

        for k in range(10):

            if(A <= 10000*i + 1000*j + 100*k + 10*j +i <= B):

                count += 1

print(count)

A, B = list(map(int, input().split()))
count = 0
for i in range(A, B + 1):
    if str(i) == str(i)[::-1]:
        count += 1
print(count)

A, B = list(map(int, input().split()))
count = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            if A <= 10000 * i + 1000 * j + 100 * k + 10 * j + i <= B:
                count += 1
print(count)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

Mod = 10**9+7

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

a = [int(eval(input())) for _ in range(M)]

b = [1]*(N+1)

for j in a:

    b[j] = 0

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

    if b[i] == 0:

        continue

    if i == 1:

        b[1] = 1

        continue

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

    if b[i] >= Mod:

        b[i] %= Mod

print((b[N]))

# optimized version of the same code:

# https://atcoder.jp/contests/abc129/submissions/5841482 を参考

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

A = [int(eval(input())) for _ in range(M)]

MOD = 10**9 + 7

F = [1]*(N+1)

for j in A:

    F[j-1] = 0

a = 1; b = 0

for i in range(N):

    if not F[i]:    #F[i] == 0

        a, b = 0, a

    else:

        a, b = ((a+b) % MOD), a

print(a)

Mod = 10**9 + 7
N, M = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(M)]
b = [1] * (N + 1)
for j in a:
    b[j] = 0
for i in range(1, N + 1):
    if b[i] == 0:
        continue
    if i == 1:
        b[1] = 1
        continue
    b[i] = b[i - 1] + b[i - 2]
    if b[i] >= Mod:
        b[i] %= Mod
print((b[N]))

# https://atcoder.jp/contests/abc129/submissions/5841482 を参考
N, M = list(map(int, input().split()))
A = [int(eval(input())) for _ in range(M)]
MOD = 10**9 + 7
F = [1] * (N + 1)
for j in A:
    F[j - 1] = 0
a = 1
b = 0
for i in range(N):
    if not F[i]:  # F[i] == 0
        a, b = 0, a
    else:
        a, b = ((a + b) % MOD), a
print(a)

-a = [int(eval(input())) for _ in range(M)]

+A = [int(eval(input())) for _ in range(M)]


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

n = int(eval(input()))

mx = n//3

ans = 0

mod = 10**9+7

import math

def combinations_count(n, r): #組み合わせ(nCr)

    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

    if i == 1:

        ans += 1

    else:

        ans += combinations_count(n-2*i-1,i-1) % mod

print((ans%mod))

# optimized version of the same code:

n = int(eval(input()))
mx = n // 3
ans = 0
mod = 10**9 + 7
import math

def combinations_count(n, r):  # 組み合わせ(nCr)
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

for i in range(1, mx + 1):
    if i == 1:
        ans += 1
    else:
        ans += combinations_count(n - 2 * i - 1, i - 1) % mod
print((ans % mod))

-def combinations_count(n, r):  # 組み合わせ(nCr)

-    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

-        ans += combinations_count(n - 2 * i - 1, i - 1) % mod


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

n = int(eval(input()))

a_list = np.array(list(map(int, input().split())))

counter = 0

while True:

    if np.sum(a_list % 2) > 0:

        break

    counter += 1

    a_list = a_list / 2

print(counter)

# optimized version of the same code:

n = int(eval(input()))

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

status = True

execute = 0

while status:

    for i in range(n):

        if a_list[i] % 2 == 1:

            status = False

            break

        else:

            a_list[i] = a_list[i] / 2

    if status:

        execute += 1

print(execute)

-a_list = np.array(list(map(int, input().split())))

+a_list = list(map(int, input().split()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import math

import string

def readints():

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

def nCr(n, r):

    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

def has_duplicates2(seq):

    seen = []

    for item in seq:

        if not(item in seen):

            seen.append(item)

    return len(seq) != len(seen)

def divisor(n):

    divisor = []

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

        if n % i == 0:

            divisor.append(i)

    return divisor

# coordinates

dx = [-1, -1, -1, 0, 0, 1, 1, 1]

dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n = int(eval(input()))

a = readints()

def func(l):

    if len(l) == n:

        for i in range(len(l)):

            if l[i] % 2 == 0:

                return 1

        return 0

    return func(l+[(a[len(l)])])+func(l+[(a[len(l)]-1)])+func(l+[(a[len(l)]+1)])

print((func([])))

# optimized version of the same code:

import math

import string

def readints():

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

def nCr(n, r):

    return math.factorial(n)//(math.factorial(n-r)*math.factorial(r))

def has_duplicates2(seq):

    seen = []

    for item in seq:

        if not(item in seen):

            seen.append(item)

    return len(seq) != len(seen)

def divisor(n):

    divisor = []

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

        if n % i == 0:

            divisor.append(i)

    return divisor

# coordinates

dx = [-1, -1, -1, 0, 0, 1, 1, 1]

dy = [-1, 0, 1, -1, 1, -1, 0, 1]

n = int(eval(input()))

a = readints()

sum = 1

for i in range(len(a)):

    if a[i] % 2 == 0:

        sum *= 2

    else:

        sum *= 1

print((3**len(a)-sum))

import math
import string

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

def nCr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not (item in seen):
            seen.append(item)
    return len(seq) != len(seen)

def divisor(n):
    divisor = []
    for i in range(1, n + 1):
        if n % i == 0:
            divisor.append(i)
    return divisor

# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(eval(input()))
a = readints()

def func(l):
    if len(l) == n:
        for i in range(len(l)):
            if l[i] % 2 == 0:
                return 1
        return 0
    return (
        func(l + [(a[len(l)])])
        + func(l + [(a[len(l)] - 1)])
        + func(l + [(a[len(l)] + 1)])
    )

print((func([])))

import math
import string

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

def nCr(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

def has_duplicates2(seq):
    seen = []
    for item in seq:
        if not (item in seen):
            seen.append(item)
    return len(seq) != len(seen)

def divisor(n):
    divisor = []
    for i in range(1, n + 1):
        if n % i == 0:
            divisor.append(i)
    return divisor

# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
n = int(eval(input()))
a = readints()
sum = 1
for i in range(len(a)):
    if a[i] % 2 == 0:
        sum *= 2
    else:
        sum *= 1
print((3 ** len(a) - sum))

-def func(l):
-    if len(l) == n:
-        for i in range(len(l)):
-            if l[i] % 2 == 0:
-                return 1
-        return 0
-    return (
-        func(l + [(a[len(l)])])
-        + func(l + [(a[len(l)] - 1)])
-        + func(l + [(a[len(l)] + 1)])
-    )
-print((func([])))
+sum = 1
+for i in range(len(a)):
+    if a[i] % 2 == 0:
+        sum *= 2
+    else:
+        sum *= 1
+print((3 ** len(a) - sum))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import math

N = int(eval(input()))

num = math.factorial(N)

k, r = divmod(num, 10**9 + 7)

print(r)

# optimized version of the same code:

N = int(eval(input()))

FACTOR = 10 ** 9 + 7

num = 1

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

    num *= i

    k, r = divmod(num, FACTOR)

    num = r

print(r)

N = int(eval(input()))
FACTOR = 10**9 + 7
num = 1
for i in range(1, N + 1):
    num *= i
    k, r = divmod(num, FACTOR)
    num = r
print(r)

-import math
-num = math.factorial(N)
-k, r = divmod(num, 10**9 + 7)
+FACTOR = 10**9 + 7
+num = 1
+for i in range(1, N + 1):
+    num *= i
+    k, r = divmod(num, FACTOR)
+    num = r


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

def main():

    N, M = (int(i) for i in input().split())

    def trial_division(n):

        divs = []

        for i in range(1, int(n**0.5)+1):

            if n % i == 0:

                divs.append(i)

                if i != n//i:

                    divs.append(n//i)

        divs.sort(reverse=True)

        return divs

    divs = trial_division(M)

    for d in divs:

        if d*N <= M:

            return print(d)

if __name__ == '__main__':

    main()

# optimized version of the same code:

def main():

    def trial_division(n):

        divs = []

        for i in range(1, int(n**0.5)+1):

            if n % i == 0:

                divs.append(i)

                if i != n//i:

                    divs.append(n//i)

        divs.sort(reverse=True)

        return divs

    N, M = (int(i) for i in input().split())

    divs = trial_division(M)

    for d in divs:

        if N*d <= M:

            return print(d)

if __name__ == '__main__':

    main()

def main():
    N, M = (int(i) for i in input().split())

    def trial_division(n):
        divs = []
        for i in range(1, int(n**0.5) + 1):
            if n % i == 0:
                divs.append(i)
                if i != n // i:
                    divs.append(n // i)
        divs.sort(reverse=True)
        return divs

    divs = trial_division(M)
    for d in divs:
        if d * N <= M:
            return print(d)

if __name__ == "__main__":
    main()

def main():
    def trial_division(n):
        divs = []
        for i in range(1, int(n**0.5) + 1):
            if n % i == 0:
                divs.append(i)
                if i != n // i:
                    divs.append(n // i)
        divs.sort(reverse=True)
        return divs

    N, M = (int(i) for i in input().split())
    divs = trial_division(M)
    for d in divs:
        if N * d <= M:
            return print(d)

if __name__ == "__main__":
    main()

-    N, M = (int(i) for i in input().split())

+    N, M = (int(i) for i in input().split())


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import math

N = int(eval(input()))

C = 10**9 + 7

print((math.factorial(N) % C))

# optimized version of the same code:

N = int(eval(input()))

C = 10**9+7

ans = 1

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

    ans *= i

    ans %= C

print(ans)

N = int(eval(input()))
C = 10**9 + 7
ans = 1
for i in range(1, N + 1):
    ans *= i
    ans %= C
print(ans)

-import math
-print((math.factorial(N) % C))
+ans = 1
+for i in range(1, N + 1):
+    ans *= i
+    ans %= C
+print(ans)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import sys

input = sys.stdin.readline

import bisect

n = int(eval(input()))

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

l = int(eval(input()))

U = 17

dp = [[0]*n for _ in range(U+1)]

for i, x in enumerate(X):

  t = bisect.bisect_left(X, x+l)

  dp[0][i] = bisect.bisect_right(X, x+l) - 1

for k in range(U):

  for i in range(n):

    dp[k+1][i] = dp[k][dp[k][i]]

def test(x, a, b):

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

    if x >> i & 1:

      a = dp[i][a]

  return a >= b

def solve(a, b):

  if a > b:

    a, b = b, a

  ng = 0

  ok = n-1

  while ok - ng > 1:

    mid = (ng + ok) // 2

    if test(mid, a, b):

      ok = mid

    else:

      ng = mid

  print(ok)

q = int(eval(input()))

for _ in range(q):

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

  a -= 1

  b -= 1

  solve(a, b)

# optimized version of the same code:

import sys

input = sys.stdin.readline

import bisect

n = int(eval(input()))

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

l = int(eval(input()))

U = 17

dp = [[0]*n for _ in range(U+1)]

for i, x in enumerate(X):

  t = bisect.bisect_left(X, x+l)

  dp[0][i] = bisect.bisect_right(X, x+l) - 1

for k in range(U):

  for i in range(n):

    dp[k+1][i] = dp[k][dp[k][i]]

q = int(eval(input()))

for _ in range(q):

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

  a -= 1

  b -= 1

  if a > b:

    a, b = b, a

  res = 1

  for k in range(U, -1, -1):

    if dp[k][a] < b:

      a = dp[k][a]

      res += (1<<k)

    if a == b:

      break

  print(res)

import sys

input = sys.stdin.readline
import bisect

n = int(eval(input()))
X = list(map(int, input().split()))
l = int(eval(input()))
U = 17
dp = [[0] * n for _ in range(U + 1)]
for i, x in enumerate(X):
    t = bisect.bisect_left(X, x + l)
    dp[0][i] = bisect.bisect_right(X, x + l) - 1
for k in range(U):
    for i in range(n):
        dp[k + 1][i] = dp[k][dp[k][i]]

def test(x, a, b):
    for i in range(U, -1, -1):
        if x >> i & 1:
            a = dp[i][a]
    return a >= b

def solve(a, b):
    if a > b:
        a, b = b, a
    ng = 0
    ok = n - 1
    while ok - ng > 1:
        mid = (ng + ok) // 2
        if test(mid, a, b):
            ok = mid
        else:
            ng = mid
    print(ok)

q = int(eval(input()))
for _ in range(q):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    solve(a, b)

import sys

input = sys.stdin.readline
import bisect

n = int(eval(input()))
X = list(map(int, input().split()))
l = int(eval(input()))
U = 17
dp = [[0] * n for _ in range(U + 1)]
for i, x in enumerate(X):
    t = bisect.bisect_left(X, x + l)
    dp[0][i] = bisect.bisect_right(X, x + l) - 1
for k in range(U):
    for i in range(n):
        dp[k + 1][i] = dp[k][dp[k][i]]
q = int(eval(input()))
for _ in range(q):
    a, b = list(map(int, input().split()))
    a -= 1
    b -= 1
    if a > b:
        a, b = b, a
    res = 1
    for k in range(U, -1, -1):
        if dp[k][a] < b:
            a = dp[k][a]
            res += 1 << k
        if a == b:
            break
    print(res)

-def test(x, a, b):
-    for i in range(U, -1, -1):
-        if x >> i & 1:
-            a = dp[i][a]
-    return a >= b
-def solve(a, b):
-    if a > b:
-        a, b = b, a
-    ng = 0
-    ok = n - 1
-    while ok - ng > 1:
-        mid = (ng + ok) // 2
-        if test(mid, a, b):
-            ok = mid
-        else:
-            ng = mid
-    print(ok)
-    solve(a, b)
+    if a > b:
+        a, b = b, a
+    res = 1
+    for k in range(U, -1, -1):
+        if dp[k][a] < b:
+            a = dp[k][a]
+            res += 1 << k
+        if a == b:
+            break
+    print(res)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

#!/usr/bin/env python3

def main():

    import numpy as np

    np.set_printoptions(linewidth=200)

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

    lst = [list(map(int, input().split())) for _ in range(N)]

    v_max = 10 ** 3 * 100 * 10

    w_max = 10 ** 9 * v_max

    # i以上の価値を持つときの最小重量

    dp = np.full(v_max, w_max, dtype=np.int64)

    # initialize

    dp[0] = 0

    for n in range(N):

        w, v = lst[n]

        dp[v:] = np.minimum(dp[v:], dp[:-v] + w)

    ans = 0

    for i, w in enumerate(dp):

        if w <= W:

            ans = i

    print(ans)

if __name__ == '__main__':

    main()

# optimized version of the same code:

#!/usr/bin/env python3

def main():

    import numpy as np

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

    lst = [list(map(int, input().split())) for _ in range(N)]

    v_max = 10 ** 3 * 100 * 10

    w_max = 10 ** 9 * v_max

    # i以上の価値を持つときの最小重量

    dp = np.full(v_max, w_max, dtype=np.int64)

    # initialize

    dp[0] = 0

    for w, v in lst:

        dp[v:] = np.minimum(dp[v:], dp[:-v] + w)

    print((np.asarray(dp <= W).nonzero()[0].max()))

if __name__ == '__main__':

    main()

#!/usr/bin/env python3
def main():
    import numpy as np

    np.set_printoptions(linewidth=200)
    N, W = list(map(int, input().split()))
    lst = [list(map(int, input().split())) for _ in range(N)]
    v_max = 10**3 * 100 * 10
    w_max = 10**9 * v_max
    # i以上の価値を持つときの最小重量
    dp = np.full(v_max, w_max, dtype=np.int64)
    # initialize
    dp[0] = 0
    for n in range(N):
        w, v = lst[n]
        dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
    ans = 0
    for i, w in enumerate(dp):
        if w <= W:
            ans = i
    print(ans)

if __name__ == "__main__":
    main()

#!/usr/bin/env python3
def main():
    import numpy as np

    N, W = list(map(int, input().split()))
    lst = [list(map(int, input().split())) for _ in range(N)]
    v_max = 10**3 * 100 * 10
    w_max = 10**9 * v_max
    # i以上の価値を持つときの最小重量
    dp = np.full(v_max, w_max, dtype=np.int64)
    # initialize
    dp[0] = 0
    for w, v in lst:
        dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
    print((np.asarray(dp <= W).nonzero()[0].max()))

if __name__ == "__main__":
    main()

+    print((np.asarray(dp <= W).nonzero()[0].max()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

arr = [like + i for i in range(n)]

arr.sort(key=lambda x:abs(x))

print((sum(arr[1:])))

# optimized version of the same code:

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

arr = [like + i for i in range(n)]

arr.sort(key=abs)

print((sum(arr[1:])))

n, like = list(map(int, input().split()))
arr = [like + i for i in range(n)]
arr.sort(key=lambda x: abs(x))
print((sum(arr[1:])))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

s=eval(input())

t=eval(input())

s*=2

next=[[-1]*26 for _ in range(len(s))]

alph=[[]for _ in range(26)]

for i in range(len(s)):

	alph[ord(s[i])-ord("a")].append(i)

from bisect import bisect_right

for i in range(len(s)//2):

	for j in range(26):

		if len(alph[j])>bisect_right(alph[j],i):

			next[i][j]=alph[j][bisect_right(alph[j],i)]

ans=1

now=len(s)//2-1

for x in t:

	r=ord(x)-ord("a")

	now=next[now][r]

	if now==-1:

		print((-1))

		exit()

	if now>=len(s)//2:

		ans+=len(s)//2

		now-=len(s)//2

print((ans+now-len(s)//2))

# optimized version of the same code:

#O(|S|log|s|)

def main():

	s=eval(input())

	t=eval(input())

	n=len(s)

	now=-1

	ans=1

	if not set(t)<=set(s):#tがsの部分集合でない

		print((-1))

		exit()

	for x in t:

		now=s.find(x,now+1)#nowより大きいところからxを探す

		if now==-1:#nowより大きいところでxが見つからなかったら

			ans+=n

			now=s.find(x)

	print((ans+now))

if __name__ == '__main__':

	main()

s = eval(input())
t = eval(input())
s *= 2
next = [[-1] * 26 for _ in range(len(s))]
alph = [[] for _ in range(26)]
for i in range(len(s)):
    alph[ord(s[i]) - ord("a")].append(i)
from bisect import bisect_right

for i in range(len(s) // 2):
    for j in range(26):
        if len(alph[j]) > bisect_right(alph[j], i):
            next[i][j] = alph[j][bisect_right(alph[j], i)]
ans = 1
now = len(s) // 2 - 1
for x in t:
    r = ord(x) - ord("a")
    now = next[now][r]
    if now == -1:
        print((-1))
        exit()
    if now >= len(s) // 2:
        ans += len(s) // 2
        now -= len(s) // 2
print((ans + now - len(s) // 2))

# O(|S|log|s|)
def main():
    s = eval(input())
    t = eval(input())
    n = len(s)
    now = -1
    ans = 1
    if not set(t) <= set(s):  # tがsの部分集合でない
        print((-1))
        exit()
    for x in t:
        now = s.find(x, now + 1)  # nowより大きいところからxを探す
        if now == -1:  # nowより大きいところでxが見つからなかったら
            ans += n
            now = s.find(x)
    print((ans + now))

if __name__ == "__main__":
    main()

-next = [[-1] * 26 for _ in range(len(s))]

-    alph[ord(s[i]) - ord("a")].append(i)

-        if len(alph[j]) > bisect_right(alph[j], i):

-            next[i][j] = alph[j][bisect_right(alph[j], i)]

+    if not set(t) <= set(s):  # tがsの部分集合でない

+        now = s.find(x, now + 1)  # nowより大きいところからxを探す

+        if now == -1:  # nowより大きいところでxが見つからなかったら


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

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

ans = float('inf')

for i in range(max(X,Y)+1):

    cost = 2 * C * i + max(0,X-i)*A +max(0,Y-i)*B

    ans = min(ans,cost)

print(ans)

# optimized version of the same code:

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

tmp = A*X + B*Y

if X >= Y:

    tmp = min(tmp,2*Y*C+(X-Y)*A)

else:

    tmp = min(tmp,2*X*C+(Y-X)*B)

tmp = min(tmp,max(X,Y)*2*C)

print(tmp)

A, B, C, X, Y = list(map(int, input().split()))
ans = float("inf")
for i in range(max(X, Y) + 1):
    cost = 2 * C * i + max(0, X - i) * A + max(0, Y - i) * B
    ans = min(ans, cost)
print(ans)

A, B, C, X, Y = list(map(int, input().split()))
tmp = A * X + B * Y
if X >= Y:
    tmp = min(tmp, 2 * Y * C + (X - Y) * A)
else:
    tmp = min(tmp, 2 * X * C + (Y - X) * B)
tmp = min(tmp, max(X, Y) * 2 * C)
print(tmp)

+    tmp = min(tmp, 2 * Y * C + (X - Y) * A)

+    tmp = min(tmp, 2 * X * C + (Y - X) * B)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

#coding: UTF-8

import math

N=int(eval(input()))

def prime_list(k):

    lis=[True for i in range(1,k+1)]

    lis[0]=False

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

        j=2

        while j*j<=i:

            if i%j==0:

                lis[i-1]=False

                break

            else:

                j+=1

    return lis

#    print(lis)

def p_fact(k,N):

    plist=prime_list(k)

    lis=[0]*N

    for i in range(0,k):

        n=0

        if plist[i]:

            while k%(i+1)==0:

                n+=1

                k=k/(i+1)

        lis[i]=n

    return lis

out_lis=[0]*N

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

    input_lis=p_fact(i,N)

    out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]

#print(out_lis)

out=1

for i in range(0,N):

    out=out*(out_lis[i]+1)

print((out%1000000007))

# optimized version of the same code:

#coding: UTF-8

import math

N=int(eval(input()))

def prime_list(k):

    lis=[True for i in range(1,k+1)]

    lis[0]=False

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

        j=2

        while j*j<=i:

            if i%j==0:

                lis[i-1]=False

                break

            else:

                j+=1

    return lis

#    print(lis)

def p_fact(k,N,plist):

#    plist=prime_list(k)

    lis=[0]*N

    for i in range(0,k):

        n=0

        if plist[i]:

            while k%(i+1)==0:

                n+=1

                k=k/(i+1)

        lis[i]=n

    return lis

#    print(lis)

out_lis=[0]*N

plist=prime_list(N)

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

    input_lis=p_fact(i,N,plist)

    out_lis=[out_lis[j]+input_lis[j] for j in range(0,N)]

#print(out_lis)

out=1

for i in range(0,N):

    out=out*(out_lis[i]+1)

#print(out%1000000007)

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

# coding: UTF-8
import math

N = int(eval(input()))

def prime_list(k):
    lis = [True for i in range(1, k + 1)]
    lis[0] = False
    for i in range(2, k + 1):
        j = 2
        while j * j <= i:
            if i % j == 0:
                lis[i - 1] = False
                break
            else:
                j += 1
    return lis

#    print(lis)
def p_fact(k, N):
    plist = prime_list(k)
    lis = [0] * N
    for i in range(0, k):
        n = 0
        if plist[i]:
            while k % (i + 1) == 0:
                n += 1
                k = k / (i + 1)
        lis[i] = n
    return lis

out_lis = [0] * N
for i in range(1, N + 1):
    input_lis = p_fact(i, N)
    out_lis = [out_lis[j] + input_lis[j] for j in range(0, N)]
# print(out_lis)
out = 1
for i in range(0, N):
    out = out * (out_lis[i] + 1)
print((out % 1000000007))

# coding: UTF-8
import math

N = int(eval(input()))

def prime_list(k):
    lis = [True for i in range(1, k + 1)]
    lis[0] = False
    for i in range(2, k + 1):
        j = 2
        while j * j <= i:
            if i % j == 0:
                lis[i - 1] = False
                break
            else:
                j += 1
    return lis

#    print(lis)
def p_fact(k, N, plist):
    #    plist=prime_list(k)
    lis = [0] * N
    for i in range(0, k):
        n = 0
        if plist[i]:
            while k % (i + 1) == 0:
                n += 1
                k = k / (i + 1)
        lis[i] = n
    return lis

#    print(lis)
out_lis = [0] * N
plist = prime_list(N)
for i in range(1, N + 1):
    input_lis = p_fact(i, N, plist)
    out_lis = [out_lis[j] + input_lis[j] for j in range(0, N)]
# print(out_lis)
out = 1
for i in range(0, N):
    out = out * (out_lis[i] + 1)
# print(out%1000000007)
print((out % (10**9 + 7)))

-def p_fact(k, N):
-    plist = prime_list(k)
+def p_fact(k, N, plist):
+    #    plist=prime_list(k)
+#    print(lis)
+plist = prime_list(N)
-    input_lis = p_fact(i, N)
+    input_lis = p_fact(i, N, plist)
-print((out % 1000000007))
+# print(out%1000000007)
+print((out % (10**9 + 7)))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import sys

import queue

N = 3

f= ''.join(sys.stdin.readline().split())

f+= ''.join(sys.stdin.readline().split())

f+= ''.join(sys.stdin.readline().split())

dd = [[-1, 0], [0, -1], [1, 0], [0, 1]]

Q = queue.Queue()

V = dict()

Q.put([f,f.index('0'),0])

V[f] = True

while not Q.empty():

    u = Q.get()

    if u[0] == '123456780':  break

    sx, sy = u[1]//N, u[1]%N

    for dx, dy in dd:

        tx, ty = sx+dx, sy+dy

        if tx<0 or ty<0 or tx>=N or ty>=N: continue

        v = u[:]

        n1, n2 = u[1], tx*N+ty

        v[1] = n2

        if n1>n2: n1, n2 = n2, n1

        v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]

        if not V.get(v[0], False):

            V[v[0]] = True

            v[2] += 1

            Q.put(v)

print((u[2]))

# optimized version of the same code:

import sys

import queue

N = 3

f = ''.join(sys.stdin.readline().split())

f += ''.join(sys.stdin.readline().split())

f += ''.join(sys.stdin.readline().split())

dd = [[-1, 0], [0, -1], [1, 0], [0, 1]]

Q = [[f,f.index('0'),0]]

V = { f: True }

while len(Q)>0:

    u = Q.pop(0)

    if u[0] == '123456780':  break

    sx, sy = u[1]//N, u[1]%N

    for dx, dy in dd:

        tx, ty = sx+dx, sy+dy

        if tx<0 or ty<0 or tx>=N or ty>=N: continue

        v = u[:]

        n1, n2 = u[1], tx*N+ty

        v[1] = n2

        if n1>n2: n1, n2 = n2, n1

        v[0] = v[0][0:n1]+v[0][n2]+v[0][n1+1:n2]+v[0][n1]+v[0][n2+1:]

        if not V.get(v[0], False):

            V[v[0]] = True

            v[2] += 1 # dir[r]

            Q.append(v)

print((u[2]))

import sys
import queue

N = 3
f = "".join(sys.stdin.readline().split())
f += "".join(sys.stdin.readline().split())
f += "".join(sys.stdin.readline().split())
dd = [[-1, 0], [0, -1], [1, 0], [0, 1]]
Q = queue.Queue()
V = dict()
Q.put([f, f.index("0"), 0])
V[f] = True
while not Q.empty():
    u = Q.get()
    if u[0] == "123456780":
        break
    sx, sy = u[1] // N, u[1] % N
    for dx, dy in dd:
        tx, ty = sx + dx, sy + dy
        if tx < 0 or ty < 0 or tx >= N or ty >= N:
            continue
        v = u[:]
        n1, n2 = u[1], tx * N + ty
        v[1] = n2
        if n1 > n2:
            n1, n2 = n2, n1
        v[0] = v[0][0:n1] + v[0][n2] + v[0][n1 + 1 : n2] + v[0][n1] + v[0][n2 + 1 :]
        if not V.get(v[0], False):
            V[v[0]] = True
            v[2] += 1
            Q.put(v)
print((u[2]))

import sys
import queue

N = 3
f = "".join(sys.stdin.readline().split())
f += "".join(sys.stdin.readline().split())
f += "".join(sys.stdin.readline().split())
dd = [[-1, 0], [0, -1], [1, 0], [0, 1]]
Q = [[f, f.index("0"), 0]]
V = {f: True}
while len(Q) > 0:
    u = Q.pop(0)
    if u[0] == "123456780":
        break
    sx, sy = u[1] // N, u[1] % N
    for dx, dy in dd:
        tx, ty = sx + dx, sy + dy
        if tx < 0 or ty < 0 or tx >= N or ty >= N:
            continue
        v = u[:]
        n1, n2 = u[1], tx * N + ty
        v[1] = n2
        if n1 > n2:
            n1, n2 = n2, n1
        v[0] = v[0][0:n1] + v[0][n2] + v[0][n1 + 1 : n2] + v[0][n1] + v[0][n2 + 1 :]
        if not V.get(v[0], False):
            V[v[0]] = True
            v[2] += 1  # dir[r]
            Q.append(v)
print((u[2]))

-Q = queue.Queue()
-V = dict()
-Q.put([f, f.index("0"), 0])
-V[f] = True
-while not Q.empty():
-    u = Q.get()
+Q = [[f, f.index("0"), 0]]
+V = {f: True}
+while len(Q) > 0:
+    u = Q.pop(0)
-            v[2] += 1
-            Q.put(v)
+            v[2] += 1  # dir[r]
+            Q.append(v)


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import numpy as np

N = int(input())

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

x = np.argsort(A)

x += 1

for i in range(N):

    print(x[i], end=" ")

print()

# optimized version of the same code:

N = int(eval(input()))

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

B = [0]*N

for i in range(N):

    B[A[i]-1] = i+1

for i in range(N):

    print((B[i]))

N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [0] * N
for i in range(N):
    B[A[i] - 1] = i + 1
for i in range(N):
    print((B[i]))

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


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

def main():

    S = eval(input())

    w1 = 'dream'[::-1]

    w2 = 'dreamer'[::-1]

    w3 = 'erase'[::-1]

    w4 = 'eraser'[::-1]

    # print(w1,w2,w3,w4)

    S = S[::-1]

    # print(S)

    # words = ['dream', 'dreamer', 'erase', 'eraser']

    words = [w1, w2, w3, w4]

    T = ''

    while S != T:

        cand = []

        for w in words:

            new_t = T + w

            cand.append(new_t)

        # print('cand', cand)

        ans = False

        for c in cand:

            if c == S[:len(c)]:

                T = c

                ans = True

        if not ans:

            break

    if S == T:

        print('YES')

    else:

        print("NO")

if __name__ == "__main__":

    main()

# optimized version of the same code:

def main():

    S = eval(input())

    w1 = 'dream'[::-1]

    w2 = 'dreamer'[::-1]

    w3 = 'erase'[::-1]

    w4 = 'eraser'[::-1]

    S = S[::-1]

    words = [w1, w2, w3, w4]

    flag = False

    i = 0

    while i < len(S):

        for w in words:

            if S[i:].startswith(w):

                i += len(w)

                flag = True

                break

        if not flag:

            print("NO")

            exit()

        flag = False

    print("YES")

if __name__ == "__main__":

    main()

def main():
    S = eval(input())
    w1 = "dream"[::-1]
    w2 = "dreamer"[::-1]
    w3 = "erase"[::-1]
    w4 = "eraser"[::-1]
    # print(w1,w2,w3,w4)
    S = S[::-1]
    # print(S)
    # words = ['dream', 'dreamer', 'erase', 'eraser']
    words = [w1, w2, w3, w4]
    T = ""
    while S != T:
        cand = []
        for w in words:
            new_t = T + w
            cand.append(new_t)
        # print('cand', cand)
        ans = False
        for c in cand:
            if c == S[: len(c)]:
                T = c
                ans = True
        if not ans:
            break
    if S == T:
        print("YES")
    else:
        print("NO")

if __name__ == "__main__":
    main()

def main():
    S = eval(input())
    w1 = "dream"[::-1]
    w2 = "dreamer"[::-1]
    w3 = "erase"[::-1]
    w4 = "eraser"[::-1]
    S = S[::-1]
    words = [w1, w2, w3, w4]
    flag = False
    i = 0
    while i < len(S):
        for w in words:
            if S[i:].startswith(w):
                i += len(w)
                flag = True
                break
        if not flag:
            print("NO")
            exit()
        flag = False
    print("YES")

if __name__ == "__main__":
    main()

-    # words = ['dream', 'dreamer', 'erase', 'eraser']


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

N,MA,MB = list(map(int,input().split()))

src = [tuple(map(int,input().split())) for i in range(N)]

INF = 10**9

dp = [[INF for j in range(401)] for i in range(401)]

dp[0][0] = 0

maxa = maxb = 0

for a,b,c in src:

    for ai in range(maxa,-1,-1):

        for bi in range(maxb,-1,-1):

            dp[ai+a][bi+b] = min(dp[ai+a][bi+b], dp[ai][bi] + c)

    maxa += a

    maxb += b

ans = INF

for i in range(1,401):

    if MA*i > 400 or MB*i > 400: break

    ans = min(ans, dp[MA*i][MB*i])

print((-1 if ans == INF else ans))

# optimized version of the same code:

N,MA,MB = list(map(int,input().split()))

src = [tuple(map(int,input().split())) for i in range(N)]

INF = 10**9

MAX = 401

dp = [[INF] * MAX for i in range(MAX)]

dp[0][0] = 0

amax = bmax = 0

for a,b,n in src:

    for i in reversed(list(range(bmax+1))):

        for j in range(amax+1):

            if dp[i][j] == INF: continue

            dp[i+b][j+a] = min(dp[i+b][j+a], dp[i][j] + n)

    amax += a

    bmax += b

ans = INF

for i in range(1,MAX):

    if i*MA >= MAX or i*MB >= MAX: break

    ans = min(ans, dp[i*MB][i*MA])

print((-1 if ans == INF else ans))

N, MA, MB = list(map(int, input().split()))
src = [tuple(map(int, input().split())) for i in range(N)]
INF = 10**9
dp = [[INF for j in range(401)] for i in range(401)]
dp[0][0] = 0
maxa = maxb = 0
for a, b, c in src:
    for ai in range(maxa, -1, -1):
        for bi in range(maxb, -1, -1):
            dp[ai + a][bi + b] = min(dp[ai + a][bi + b], dp[ai][bi] + c)
    maxa += a
    maxb += b
ans = INF
for i in range(1, 401):
    if MA * i > 400 or MB * i > 400:
        break
    ans = min(ans, dp[MA * i][MB * i])
print((-1 if ans == INF else ans))

N, MA, MB = list(map(int, input().split()))
src = [tuple(map(int, input().split())) for i in range(N)]
INF = 10**9
MAX = 401
dp = [[INF] * MAX for i in range(MAX)]
dp[0][0] = 0
amax = bmax = 0
for a, b, n in src:
    for i in reversed(list(range(bmax + 1))):
        for j in range(amax + 1):
            if dp[i][j] == INF:
                continue
            dp[i + b][j + a] = min(dp[i + b][j + a], dp[i][j] + n)
    amax += a
    bmax += b
ans = INF
for i in range(1, MAX):
    if i * MA >= MAX or i * MB >= MAX:
        break
    ans = min(ans, dp[i * MB][i * MA])
print((-1 if ans == INF else ans))

-dp = [[INF for j in range(401)] for i in range(401)]

-            dp[ai + a][bi + b] = min(dp[ai + a][bi + b], dp[ai][bi] + c)

+    for i in reversed(list(range(bmax + 1))):


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

MOD = 10**9+7

fac = [1, 1]     # 元テーブル

f_inv = [1, 1]   # 逆元テーブル

inv = [0, 1]     # 逆元テーブル計算用テーブル

def prepare(n, mod):

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

        fac.append((fac[-1] * i) % mod)

        inv.append((-inv[mod % i] * (mod//i)) % mod)

        f_inv.append((f_inv[-1] * inv[-1]) % mod)

def cmb(n, r, mod):

    if n < 0 or r < 0:

        return 0

    if r > n:

        return 0

    return fac[n] * f_inv[r] * f_inv[n-r] % mod

def prime_factorization(n):

    d = []

    i, e = 2, 0  # factor, exponent

    while i * i <= n:

        while n % i == 0:

            n //= i

            e += 1

        if e > 0:

            d.append((i, e))

        i += 1

        e = 0

    if n > 1:

        d.append((n, 1))

    return d

def main():

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

    prepare(N+100, MOD)

    d = prime_factorization(M)

    ans = 1

    for i, e in d:

        ans *= cmb(N-1+e, e, MOD)

        ans %= MOD

    print(ans)

if __name__ == "__main__":

    main()

# optimized version of the same code:

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

MOD = 10**9+7

fac = [1, 1]     # 元テーブル

f_inv = [1, 1]   # 逆元テーブル

inv = [0, 1]     # 逆元テーブル計算用テーブル

def prepare(n, mod):

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

        fac.append((fac[-1] * i) % mod)

def cmb(n, r, mod):

    if n < 0 or r < 0:

        return 0

    if r > n:

        return 0

    return fac[n] * pow(fac[r],MOD-2,MOD) * pow(fac[n-r],MOD-2,MOD) % mod

def prime_factorization(n):

    d = []

    i, e = 2, 0  # factor, exponent

    while i * i <= n:

        while n % i == 0:

            n //= i

            e += 1

        if e > 0:

            d.append((i, e))

        i += 1

        e = 0

    if n > 1:

        d.append((n, 1))

    return d

def main():

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

    prepare(N+100, MOD)

    d = prime_factorization(M)

    ans = 1

    for i, e in d:

        ans *= cmb(N-1+e, e, MOD)

        ans %= MOD

    print(ans)

if __name__ == "__main__":

    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9 + 7
fac = [1, 1]  # 元テーブル
f_inv = [1, 1]  # 逆元テーブル
inv = [0, 1]  # 逆元テーブル計算用テーブル

def prepare(n, mod):
    for i in range(2, n + 1):
        fac.append((fac[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod // i)) % mod)
        f_inv.append((f_inv[-1] * inv[-1]) % mod)

def cmb(n, r, mod):
    if n < 0 or r < 0:
        return 0
    if r > n:
        return 0
    return fac[n] * f_inv[r] * f_inv[n - r] % mod

def prime_factorization(n):
    d = []
    i, e = 2, 0  # factor, exponent
    while i * i <= n:
        while n % i == 0:
            n //= i
            e += 1
        if e > 0:
            d.append((i, e))
        i += 1
        e = 0
    if n > 1:
        d.append((n, 1))
    return d

def main():
    N, M = list(map(int, readline().split()))
    prepare(N + 100, MOD)
    d = prime_factorization(M)
    ans = 1
    for i, e in d:
        ans *= cmb(N - 1 + e, e, MOD)
        ans %= MOD
    print(ans)

if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9 + 7
fac = [1, 1]  # 元テーブル
f_inv = [1, 1]  # 逆元テーブル
inv = [0, 1]  # 逆元テーブル計算用テーブル

def prepare(n, mod):
    for i in range(2, n + 1):
        fac.append((fac[-1] * i) % mod)

def cmb(n, r, mod):
    if n < 0 or r < 0:
        return 0
    if r > n:
        return 0
    return fac[n] * pow(fac[r], MOD - 2, MOD) * pow(fac[n - r], MOD - 2, MOD) % mod

def prime_factorization(n):
    d = []
    i, e = 2, 0  # factor, exponent
    while i * i <= n:
        while n % i == 0:
            n //= i
            e += 1
        if e > 0:
            d.append((i, e))
        i += 1
        e = 0
    if n > 1:
        d.append((n, 1))
    return d

def main():
    N, M = list(map(int, readline().split()))
    prepare(N + 100, MOD)
    d = prime_factorization(M)
    ans = 1
    for i, e in d:
        ans *= cmb(N - 1 + e, e, MOD)
        ans %= MOD
    print(ans)

if __name__ == "__main__":
    main()

-        inv.append((-inv[mod % i] * (mod // i)) % mod)

-        f_inv.append((f_inv[-1] * inv[-1]) % mod)

-    return fac[n] * f_inv[r] * f_inv[n - r] % mod

+    return fac[n] * pow(fac[r], MOD - 2, MOD) * pow(fac[n - r], MOD - 2, MOD) % mod


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

s = eval(input())

a = s.find('A')

z = s[::-1].find('Z')

ans = len(s)-a-z

print(ans)

#print(*ans, sep='\n')

# optimized version of the same code:

def solve():

  S = eval(input())

  a = S.find('A')

  z = S[::-1].find('Z')

  ans = len(S)-a-z

  return ans

print((solve()))

s = eval(input())
a = s.find("A")
z = s[::-1].find("Z")
ans = len(s) - a - z
print(ans)
# print(*ans, sep='\n')

def solve():
    S = eval(input())
    a = S.find("A")
    z = S[::-1].find("Z")
    ans = len(S) - a - z
    return ans

print((solve()))

-s = eval(input())
-a = s.find("A")
-z = s[::-1].find("Z")
-ans = len(s) - a - z
-print(ans)
-# print(*ans, sep='\n')
+def solve():
+    S = eval(input())
+    a = S.find("A")
+    z = S[::-1].find("Z")
+    ans = len(S) - a - z
+    return ans
+
+
+print((solve()))


Input:
# slower version:

s = input()
for i in range(len(s)):
  if i%2 == 0:
    print(s[i], end = '')

# optimized version of the same code:

s = input()
ans = ''
for i in range(len(s)):
  if i % 2 == 0:
    ans += s[i]
print(ans)

# slower version:

_,t=open(0);n=eval(t.replace(' ','|'));print((len(bin(n&-n))-3))

# optimized version of the same code:

_, t = open(0)
n = eval(t.replace(" ", "|"))
print((len(bin(n & -n)) - 3))