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 = 5000 * 2 * 10 ** 5

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

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

    ans = min(ans, s)

print(ans)

# optimized version of the same code:

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

if X > Y:

    v = A

else:

    v = B

ans = min(A*X+B*Y, C*max(X, Y)*2, C*min(X,Y)*2+(max(X,Y)-min(X,Y))*v)

print(ans)

A, B, C, X, Y = list(map(int, input().split()))
ans = 5000 * 2 * 10**5
for i in range(10**5 + 1):
    s = i * 2 * C + max(0, X - i) * A + max(0, Y - i) * B
    ans = min(ans, s)
print(ans)

A, B, C, X, Y = list(map(int, input().split()))
if X > Y:
    v = A
else:
    v = B
ans = min(
    A * X + B * Y, C * max(X, Y) * 2, C * min(X, Y) * 2 + (max(X, Y) - min(X, Y)) * v
)
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

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

N = int(read())

x = N + (-N) % 1000

print((x - N))

# optimized version of the same code:

import math

N = int(eval(input()))

x = math.ceil(N/1000) * 1000

print((x-N))

import math

N = int(eval(input()))
x = math.ceil(N / 1000) * 1000
print((x - N))

-import sys
+import math
-read = sys.stdin.buffer.read
-readline = sys.stdin.buffer.readline
-readlines = sys.stdin.buffer.readlines
-N = int(read())
-x = N + (-N) % 1000
+N = int(eval(input()))
+x = math.ceil(N / 1000) * 1000


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

def resolve():

    MOD = 10 ** 9 + 7

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

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

    dp = np.array([1] * (n + 1))

    dp[a] = 0

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

        if dp[i] != 0:

            dp[i] = np.sum(dp[i - 2:i]) % MOD

    print((dp[n]))

resolve()

# optimized version of the same code:

def resolve():

    MOD = 10 ** 9 + 7

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

    # i段目に到達するまでのルートの総数

    dp = [1] * (n + 1)

    for _ in range(m):

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

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

        if dp[i] == 0:

            continue

        dp[i] = (dp[i - 1] + dp[i - 2]) % MOD

    print((dp[n]))

resolve()

import numpy as np

def resolve():
    MOD = 10**9 + 7
    n, m = list(map(int, input().split()))
    a = [int(eval(input())) for _ in range(m)]
    dp = np.array([1] * (n + 1))
    dp[a] = 0
    for i in range(2, n + 1):
        if dp[i] != 0:
            dp[i] = np.sum(dp[i - 2 : i]) % MOD
    print((dp[n]))

resolve()

def resolve():
    MOD = 10**9 + 7
    n, m = list(map(int, input().split()))
    # i段目に到達するまでのルートの総数
    dp = [1] * (n + 1)
    for _ in range(m):
        dp[int(eval(input()))] = 0
    for i in range(2, n + 1):
        if dp[i] == 0:
            continue
        dp[i] = (dp[i - 1] + dp[i - 2]) % MOD
    print((dp[n]))

resolve()

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

+    # i段目に到達するまでのルートの総数

-            dp[i] = np.sum(dp[i - 2 : i]) % 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:

def c_repsept():

    K = int(eval(input()))

    L = 9 * K // 7 if K % 7 == 0 else 9 * K

    if L % 2 == 0 or L % 5 == 0:

        return -1

    remainder = 1

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

        remainder = (10 * remainder) % L

        if remainder == 1:

            return n

    return -1

print((c_repsept()))

# optimized version of the same code:

def c_repsept_totient():

    def euler_phi(n):

        """正整数 n に対して、n と互いに素な n 以下の正整数の個数"""

        ret = n

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

            if n % i == 0:

                ret = ret // i * (i - 1)

                while n % i == 0:

                    n //= i

        if n > 1:

            ret -= ret // n

        return ret

    def divisor_list(n):

        """n の正の約数のリスト"""

        ret = set()

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

            if n % k == 0:

                ret.update({k, n // k})

        return sorted(ret)

    K = int(eval(input()))

    L = 9 * (K // 7 if K % 7 == 0 else K)

    for d in divisor_list(euler_phi(L)):

        if pow(10, d, L) == 1:

            return d

    return -1

print((c_repsept_totient()))

+        """正整数 n に対して、n と互いに素な n 以下の正整数の個数"""

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

+        """n の正の約数のリスト"""

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

+                ret.update({k, n // k})

-        remainder = (10 * remainder) % L

+    for d in divisor_list(euler_phi(L)):


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:

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

MOD = 10 ** 9 + 7

Hd = sum([d * (H - d) * (W ** 2) for d in range(H)])

Wd = sum([d * (W - d) * (H ** 2) for d in range(W)])

# 階乗 & 逆元計算

factorial = [1]

inverse = [1]

for i in range(1, H * W + 2):

    factorial.append(factorial[-1] * i % MOD)

    inverse.append(pow(factorial[-1], MOD - 2, MOD))

ans = (Hd + Wd) * factorial[H * W - 2] * inverse[K - 2] * inverse[H * W - K] % MOD

print(ans)

# optimized version of the same code:

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

MOD = 10 ** 9 + 7

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

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

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

for i in range(2, H * W + 1):

    factorial.append((factorial[-1] * i) % MOD)

    inverse_from.append((-inverse_from[MOD % i] * (MOD // i)) % MOD)

    inverse.append((inverse[-1] * inverse_from[-1]) % MOD)

def nCr(n, r):

    if n < r or r < 0:

        return 0

    elif r == 0:

        return 1

    return factorial[n] * inverse[r] * inverse[n - r] % MOD

ans = 0

# Hについて

for d in range(1, H):

    ans += d * (H - d) * pow(W, 2, MOD) * nCr(H * W - 2, K - 2) % MOD

    ans %= MOD

# Wについて

for d in range(1, W):

    ans += d * (W - d) * pow(H, 2, MOD) * nCr(H * W - 2, K - 2) % MOD

    ans %= MOD

print((ans % MOD))

H, W, K = list(map(int, input().split()))
MOD = 10**9 + 7
Hd = sum([d * (H - d) * (W**2) for d in range(H)])
Wd = sum([d * (W - d) * (H**2) for d in range(W)])
# 階乗 & 逆元計算
factorial = [1]
inverse = [1]
for i in range(1, H * W + 2):
    factorial.append(factorial[-1] * i % MOD)
    inverse.append(pow(factorial[-1], MOD - 2, MOD))
ans = (Hd + Wd) * factorial[H * W - 2] * inverse[K - 2] * inverse[H * W - K] % MOD
print(ans)

H, W, K = list(map(int, input().split()))
MOD = 10**9 + 7
factorial = [1, 1]  # 元テーブル
inverse = [1, 1]  # 逆元テーブル
inverse_from = [0, 1]  # 逆元テーブル計算用テーブル
for i in range(2, H * W + 1):
    factorial.append((factorial[-1] * i) % MOD)
    inverse_from.append((-inverse_from[MOD % i] * (MOD // i)) % MOD)
    inverse.append((inverse[-1] * inverse_from[-1]) % MOD)

def nCr(n, r):
    if n < r or r < 0:
        return 0
    elif r == 0:
        return 1
    return factorial[n] * inverse[r] * inverse[n - r] % MOD

ans = 0
# Hについて
for d in range(1, H):
    ans += d * (H - d) * pow(W, 2, MOD) * nCr(H * W - 2, K - 2) % MOD
    ans %= MOD
# Wについて
for d in range(1, W):
    ans += d * (W - d) * pow(H, 2, MOD) * nCr(H * W - 2, K - 2) % MOD
    ans %= MOD
print((ans % MOD))

-Hd = sum([d * (H - d) * (W**2) for d in range(H)])

-Wd = sum([d * (W - d) * (H**2) for d in range(W)])

-# 階乗 & 逆元計算

-    factorial.append(factorial[-1] * i % MOD)

-    inverse.append(pow(factorial[-1], MOD - 2, MOD))

-ans = (Hd + Wd) * factorial[H * W - 2] * inverse[K - 2] * inverse[H * W - K] % MOD

+    factorial.append((factorial[-1] * i) % MOD)

+    inverse_from.append((-inverse_from[MOD % i] * (MOD // i)) % MOD)

+    inverse.append((inverse[-1] * inverse_from[-1]) % MOD)

+    return factorial[n] * inverse[r] * inverse[n - r] % 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:

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

x, y, z, k = list(map(int, input().split()))

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

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

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

a.sort(reverse=True)

b.sort(reverse=True)

c.sort(reverse=True)

abc = []

for i, _a in enumerate(a):

    for j, _b in enumerate(b):

        if (i+1) * (j+1) > k:

            break

        for l, _c in enumerate(c):

            if (i+1) * (j+1) * (l+1) > k:

                break

            abc.append(_a + _b + _c)

abc.sort(reverse=True)

for x in abc[:k]:

    print(x)

# optimized version of the same code:

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

import heapq

x, y, z, k = list(map(int, input().split()))

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

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

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

la, lb, lc = len(a), len(b), len(c)

a.sort(reverse=True)

b.sort(reverse=True)

c.sort(reverse=True)

fix = set()

q = [(-(a[0]+b[0]+c[0]), 0, 0, 0)]

for _ in range(k):

    abc, i, j, l = heapq.heappop(q)

    print((-abc))

    if i+1 < la and (i+1, j, l) not in fix:

        heapq.heappush(q, (-(a[i+1]+b[j]+c[l]), i+1, j, l))

        fix.add((i+1, j, l))

    if j+1 < lb and (i, j+1, l) not in fix:

        heapq.heappush(q, (-(a[i]+b[j+1]+c[l]), i, j+1, l))

        fix.add((i, j+1, l))

    if l+1 < lc and (i, j, l+1) not in fix:

        heapq.heappush(q, (-(a[i]+b[j]+c[l+1]), i, j, l+1))

        fix.add((i, j, l+1))

# -*- coding: utf-8 -*-
x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
abc = []
for i, _a in enumerate(a):
    for j, _b in enumerate(b):
        if (i + 1) * (j + 1) > k:
            break
        for l, _c in enumerate(c):
            if (i + 1) * (j + 1) * (l + 1) > k:
                break
            abc.append(_a + _b + _c)
abc.sort(reverse=True)
for x in abc[:k]:
    print(x)

# -*- coding: utf-8 -*-
import heapq

x, y, z, k = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
la, lb, lc = len(a), len(b), len(c)
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
fix = set()
q = [(-(a[0] + b[0] + c[0]), 0, 0, 0)]
for _ in range(k):
    abc, i, j, l = heapq.heappop(q)
    print((-abc))
    if i + 1 < la and (i + 1, j, l) not in fix:
        heapq.heappush(q, (-(a[i + 1] + b[j] + c[l]), i + 1, j, l))
        fix.add((i + 1, j, l))
    if j + 1 < lb and (i, j + 1, l) not in fix:
        heapq.heappush(q, (-(a[i] + b[j + 1] + c[l]), i, j + 1, l))
        fix.add((i, j + 1, l))
    if l + 1 < lc and (i, j, l + 1) not in fix:
        heapq.heappush(q, (-(a[i] + b[j] + c[l + 1]), i, j, l + 1))
        fix.add((i, j, l + 1))

+    if i + 1 < la and (i + 1, j, l) not in fix:

+    if j + 1 < lb and (i, j + 1, l) not in fix:

+    if l + 1 < lc and (i, j, l + 1) not in fix:


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()))

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

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

A.sort()

C.sort()

ans = 0

from bisect import bisect, bisect_left

for b in B:

    i = bisect_left(A, b)

    j = bisect(C, b)

    ans += i * (N-j)

print(ans)

# optimized version of the same code:

N = int(eval(input()))

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

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

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

A.sort()

C.sort()

from bisect import bisect_left, bisect

ans = 0

for b in B:

    i = bisect_left(A,b)

    j = bisect(C,b)

    ans += i * (N-j)

print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
ans = 0
from bisect import bisect, bisect_left

for b in B:
    i = bisect_left(A, b)
    j = bisect(C, b)
    ans += i * (N - j)
print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
from bisect import bisect_left, bisect

ans = 0
for b in B:
    i = bisect_left(A, b)
    j = bisect(C, b)
    ans += i * (N - j)
print(ans)

+from bisect import bisect_left, bisect
+
-from bisect import bisect, bisect_left


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()))

D = {i: [0] for i in range(1, n+1)}

for i in range(n+1):

  D[a[i]][0] += 1

  D[a[i]].append(i)

pl, pr = 0, 0

for i in D:

  if D[i][0] == 2:

    pl = D[i][1]

    pr = D[i][2]

    break

L = pl

M = pr - pl - 1

N = n - pr

mod = int(1e9) + 7 # <-- input modulo

maxf = n+11          # <-- input factional limitation

def make_fact(n, k):

    tmp = n

    perm = [i for i in range(k)]

    L = [0 for _ in range(k)]

    for i in range(k):

        L[i] = tmp % (i + 1)

        tmp //= i + 1

    LL = [0 for _ in range(k)]

    for i in range(k):

        LL[i] = perm[L[-i-1]]

        for j in range(L[-i-1]+1, k):

            perm[j-1] = perm[j]

    return LL

def doubling(n, m, modulo=mod):

    y = 1

    base = n

    tmp = m

    while tmp != 0:

        if tmp % 2 == 1:

            y *= base

            if modulo > 0:

                y %= modulo

        base *= base

        if modulo > 0:

            base %= modulo

        tmp //= 2

    return y

def inved(a, modulo=mod):

    x, y, u, v, k, l = 1, 0, 0, 1, a, modulo

    while l != 0:

        x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)

        k, l = l, k % l

    return x % modulo

fact = [1 for _ in range(maxf+1)]

invf = [1 for _ in range(maxf+1)]

for i in range(maxf):

    fact[i+1] = (fact[i] * (i+1)) % mod

invf[-1] = inved(fact[-1])

for i in range(maxf, 0, -1):

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

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

  S = fact[n]*invf[i-1]*invf[n-i+1]%mod

  if i <= n-1:

    S += fact[n-1]*invf[i]*invf[n-1-i]%mod

    S %= mod

  if i <= n-M:

    S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod

    S %= mod

  if i <= n:

    S += fact[n-1]*invf[i-1]*invf[n-i]%mod

    S %= mod

  print(S)

# optimized version of the same code:

n = int(eval(input()))

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

D = {i: [0] for i in range(1, n+1)}

for i in range(n+1):

  D[a[i]][0] += 1

  D[a[i]].append(i)

pl, pr = 0, 0

for i in D:

  if D[i][0] == 2:

    pl = D[i][1]

    pr = D[i][2]

    break

L = pl

M = pr - pl - 1

N = n - pr

mod = int(1e9) + 7 # <-- input modulo

maxf = n+11          # <-- input factional limitation

def make_fact(n, k):

    tmp = n

    perm = [i for i in range(k)]

    L = [0 for _ in range(k)]

    for i in range(k):

        L[i] = tmp % (i + 1)

        tmp //= i + 1

    LL = [0 for _ in range(k)]

    for i in range(k):

        LL[i] = perm[L[-i-1]]

        for j in range(L[-i-1]+1, k):

            perm[j-1] = perm[j]

    return LL

def doubling(n, m, modulo=mod):

    y = 1

    base = n

    tmp = m

    while tmp != 0:

        if tmp % 2 == 1:

            y *= base

            if modulo > 0:

                y %= modulo

        base *= base

        if modulo > 0:

            base %= modulo

        tmp //= 2

    return y

def inved(a, modulo=mod):

    x, y, u, v, k, l = 1, 0, 0, 1, a, modulo

    while l != 0:

        x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)

        k, l = l, k % l

    return x % modulo

fact = [1 for _ in range(maxf+1)]

invf = [1 for _ in range(maxf+1)]

for i in range(maxf):

    fact[i+1] = (fact[i] * (i+1)) % mod

invf[-1] = inved(fact[-1])

for i in range(maxf, 0, -1):

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

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

  S = fact[n+1]*invf[i]*invf[n-i+1]%mod

  if i <= n-M:

    S -= fact[n-1-M]*invf[i-1]*invf[n-M-i]%mod

    S %= mod

  print(S)

n = int(eval(input()))
a = list(map(int, input().split()))
D = {i: [0] for i in range(1, n + 1)}
for i in range(n + 1):
    D[a[i]][0] += 1
    D[a[i]].append(i)
pl, pr = 0, 0
for i in D:
    if D[i][0] == 2:
        pl = D[i][1]
        pr = D[i][2]
        break
L = pl
M = pr - pl - 1
N = n - pr
mod = int(1e9) + 7  # <-- input modulo
maxf = n + 11  # <-- input factional limitation

def make_fact(n, k):
    tmp = n
    perm = [i for i in range(k)]
    L = [0 for _ in range(k)]
    for i in range(k):
        L[i] = tmp % (i + 1)
        tmp //= i + 1
    LL = [0 for _ in range(k)]
    for i in range(k):
        LL[i] = perm[L[-i - 1]]
        for j in range(L[-i - 1] + 1, k):
            perm[j - 1] = perm[j]
    return LL

def doubling(n, m, modulo=mod):
    y = 1
    base = n
    tmp = m
    while tmp != 0:
        if tmp % 2 == 1:
            y *= base
            if modulo > 0:
                y %= modulo
        base *= base
        if modulo > 0:
            base %= modulo
        tmp //= 2
    return y

def inved(a, modulo=mod):
    x, y, u, v, k, l = 1, 0, 0, 1, a, modulo
    while l != 0:
        x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
        k, l = l, k % l
    return x % modulo

fact = [1 for _ in range(maxf + 1)]
invf = [1 for _ in range(maxf + 1)]
for i in range(maxf):
    fact[i + 1] = (fact[i] * (i + 1)) % mod
invf[-1] = inved(fact[-1])
for i in range(maxf, 0, -1):
    invf[i - 1] = (invf[i] * i) % mod
for i in range(1, n + 2):
    S = fact[n] * invf[i - 1] * invf[n - i + 1] % mod
    if i <= n - 1:
        S += fact[n - 1] * invf[i] * invf[n - 1 - i] % mod
        S %= mod
    if i <= n - M:
        S -= fact[n - 1 - M] * invf[i - 1] * invf[n - M - i] % mod
        S %= mod
    if i <= n:
        S += fact[n - 1] * invf[i - 1] * invf[n - i] % mod
        S %= mod
    print(S)

n = int(eval(input()))
a = list(map(int, input().split()))
D = {i: [0] for i in range(1, n + 1)}
for i in range(n + 1):
    D[a[i]][0] += 1
    D[a[i]].append(i)
pl, pr = 0, 0
for i in D:
    if D[i][0] == 2:
        pl = D[i][1]
        pr = D[i][2]
        break
L = pl
M = pr - pl - 1
N = n - pr
mod = int(1e9) + 7  # <-- input modulo
maxf = n + 11  # <-- input factional limitation

def make_fact(n, k):
    tmp = n
    perm = [i for i in range(k)]
    L = [0 for _ in range(k)]
    for i in range(k):
        L[i] = tmp % (i + 1)
        tmp //= i + 1
    LL = [0 for _ in range(k)]
    for i in range(k):
        LL[i] = perm[L[-i - 1]]
        for j in range(L[-i - 1] + 1, k):
            perm[j - 1] = perm[j]
    return LL

def doubling(n, m, modulo=mod):
    y = 1
    base = n
    tmp = m
    while tmp != 0:
        if tmp % 2 == 1:
            y *= base
            if modulo > 0:
                y %= modulo
        base *= base
        if modulo > 0:
            base %= modulo
        tmp //= 2
    return y

def inved(a, modulo=mod):
    x, y, u, v, k, l = 1, 0, 0, 1, a, modulo
    while l != 0:
        x, y, u, v = u, v, x - u * (k // l), y - v * (k // l)
        k, l = l, k % l
    return x % modulo

fact = [1 for _ in range(maxf + 1)]
invf = [1 for _ in range(maxf + 1)]
for i in range(maxf):
    fact[i + 1] = (fact[i] * (i + 1)) % mod
invf[-1] = inved(fact[-1])
for i in range(maxf, 0, -1):
    invf[i - 1] = (invf[i] * i) % mod
for i in range(1, n + 2):
    S = fact[n + 1] * invf[i] * invf[n - i + 1] % mod
    if i <= n - M:
        S -= fact[n - 1 - M] * invf[i - 1] * invf[n - M - i] % mod
        S %= mod
    print(S)

-    S = fact[n] * invf[i - 1] * invf[n - i + 1] % mod

-        S += fact[n - 1] * invf[i] * invf[n - 1 - i] % mod

+    S = fact[n + 1] * invf[i] * invf[n - i + 1] % mod

-        S += fact[n - 1] * invf[i - 1] * invf[n - i] % 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:

n = int(eval(input()))

def countKeta(num):

    count = 1

    while num / 10 >= 1:

        count += 1

        num = num // 10

    return count

count = 0

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

    if(countKeta(i) % 2 == 1):

        count += 1

print(count)

# optimized version of the same code:

n = int(eval(input()))

def countKeta(num):
    count = 1
    while num / 10 >= 1:
        count += 1
        num = num // 10
    return count

count = 0
for i in range(1, n + 1):
    if countKeta(i) % 2 == 1:
        count += 1
print(count)

-def countKeta(num):
-    count = 1
-    while num / 10 >= 1:
-        count += 1
-        num = num // 10
-    return count
-count = 0
-for i in range(1, n + 1):
-    if countKeta(i) % 2 == 1:
-        count += 1
-print(count)
+if n < 10:
+    print(n)
+elif n < 100:
+    print((9))
+elif n < 1000:
+    print((n - 90))
+elif n < 10000:
+    print((909))
+elif n < 100000:
+    print((n - 9090))
+elif n < 1000000:
+    print((90909))


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, k = list(map(int, input().split()))

z = np.zeros(10**5 + 1)

for i in range(n):

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

  z[a] += b

a = 0

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

  if k <= z[i]:

    a = i

    break

  k -= z[i]

print((int(a)))

# optimized version of the same code:

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

d = {}

for i in range(n):

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

  d[a] = d[a] + b if a in d else b

a = 0

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

  if i in d and k <= d[i]:

    a = i

    break

  k -= d[i] if i in d else 0

print(a)

n, k = list(map(int, input().split()))
d = {}
for i in range(n):
    a, b = list(map(int, input().split()))
    d[a] = d[a] + b if a in d else b
a = 0
for i in range(1, 10**5 + 1):
    if i in d and k <= d[i]:
        a = i
        break
    k -= d[i] if i in d else 0
print(a)

-import numpy as np
-z = np.zeros(10**5 + 1)
+d = {}
-    z[a] += b
+    d[a] = d[a] + b if a in d else b
-    if k <= z[i]:
+    if i in d and k <= d[i]:
-    k -= z[i]
-print((int(a)))
+    k -= d[i] if i in d else 0
+print(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()))

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

abn.sort()

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

#print(abn)

ts = 0 # time_stamp

enable = True

for abi in abn:

    a, b = abi

    if not ts + a <= b:

        enable = False

        break

    else:

        ts += a

print(('Yes' if enable else 'No'))

# optimized version of the same code:

n = int(eval(input()))

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

#abn.sort()

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

#print(abn)

ts = 0 # time_stamp

enable = True

for abi in abn:

    a, b = abi

    if not ts + a <= b:

        enable = False

        break

    else:

        ts += a

print(('Yes' if enable else 'No'))

n = int(eval(input()))
abn = [list(map(int, input().split())) for _ in range(n)]
abn.sort()
abn.sort(key=lambda x: x[1])
# print(abn)
ts = 0  # time_stamp
enable = True
for abi in abn:
    a, b = abi
    if not ts + a <= b:
        enable = False
        break
    else:
        ts += a
print(("Yes" if enable else "No"))

n = int(eval(input()))
abn = [list(map(int, input().split())) for _ in range(n)]
# abn.sort()
abn.sort(key=lambda x: x[1])
# print(abn)
ts = 0  # time_stamp
enable = True
for abi in abn:
    a, b = abi
    if not ts + a <= b:
        enable = False
        break
    else:
        ts += a
print(("Yes" if enable else "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:

def isPrime(x):

    if x == 2:

        return True

    if x < 2 or x % 2 == 0:

        return False

    i, root_x = 3, int(pow(x, 0.5))

    while i <= root_x:

        if x % i == 0:

            return False

        i += 2

    return True

primes = [2]

for i in range(3, 104730):

    if isPrime(i):

        primes.append(primes[-1]+i)

while True:

    n = int(eval(input()))

    if n == 0:

        break

    print((primes[n-1]))

# optimized version of the same code:

primes = [0, 0] + [1] * 150000

for i in range(2, 388):

    if primes[i]:

        for j in range(i*i, 150001, i):

            primes[j] = 0

values = [i for i, v in enumerate(primes) if v]

while True:

    n = int(eval(input()))

    if n == 0:

        break

    print((sum(values[:n])))

def isPrime(x):
    if x == 2:
        return True
    if x < 2 or x % 2 == 0:
        return False
    i, root_x = 3, int(pow(x, 0.5))
    while i <= root_x:
        if x % i == 0:
            return False
        i += 2
    return True

primes = [2]
for i in range(3, 104730):
    if isPrime(i):
        primes.append(primes[-1] + i)
while True:
    n = int(eval(input()))
    if n == 0:
        break
    print((primes[n - 1]))

primes = [0, 0] + [1] * 150000
for i in range(2, 388):
    if primes[i]:
        for j in range(i * i, 150001, i):
            primes[j] = 0
values = [i for i, v in enumerate(primes) if v]
while True:
    n = int(eval(input()))
    if n == 0:
        break
    print((sum(values[:n])))

+        for j in range(i * i, 150001, i):

+values = [i for i, v in enumerate(primes) if 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:

# https://atcoder.jp/contests/dp/tasks/dp_c

import numpy as np

N = int(eval(input()))

Max_List=[]

N_List=[i for i in range(3)]

for i in range(N):

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

    if i == 0:

        Max_List.append(Current_List)

    else:

        Current_Max_List = []

        for j in range(3):

            Index_List=np.array(Max_List[i-1])

            ind = np.ones(3, dtype=bool)

            ind[j] = False

            Current_Max_List.append(max(Index_List[ind])+Current_List[j])

        Max_List.append(Current_Max_List)

print((max(Max_List[-1])))

# optimized version of the same code:

# https://atcoder.jp/contests/dp/tasks/dp_c

N = int(eval(input()))

Max_List=[]

N_List=[i for i in range(3)]

for i in range(N):

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

    if i == 0:

        Max_List.append(Current_List)

    else:

        Current_Max_List = []

        Search_List=Max_List[i-1]

        for j in range(3):

            Current_Search_List=Search_List[1:3]

            Current_Max_List.append(max(Current_Search_List)+Current_List[j])

            Search_List.append(Search_List[0])

            del Search_List[0]

        Max_List.append(Current_Max_List)

print((max(Max_List[-1])))

# https://atcoder.jp/contests/dp/tasks/dp_c
import numpy as np

N = int(eval(input()))
Max_List = []
N_List = [i for i in range(3)]
for i in range(N):
    Current_List = list(map(int, input().split()))
    if i == 0:
        Max_List.append(Current_List)
    else:
        Current_Max_List = []
        for j in range(3):
            Index_List = np.array(Max_List[i - 1])
            ind = np.ones(3, dtype=bool)
            ind[j] = False
            Current_Max_List.append(max(Index_List[ind]) + Current_List[j])
        Max_List.append(Current_Max_List)
print((max(Max_List[-1])))

# https://atcoder.jp/contests/dp/tasks/dp_c
N = int(eval(input()))
Max_List = []
N_List = [i for i in range(3)]
for i in range(N):
    Current_List = list(map(int, input().split()))
    if i == 0:
        Max_List.append(Current_List)
    else:
        Current_Max_List = []
        Search_List = Max_List[i - 1]
        for j in range(3):
            Current_Search_List = Search_List[1:3]
            Current_Max_List.append(max(Current_Search_List) + Current_List[j])
            Search_List.append(Search_List[0])
            del Search_List[0]
        Max_List.append(Current_Max_List)
print((max(Max_List[-1])))

-            Index_List = np.array(Max_List[i - 1])

-            ind = np.ones(3, dtype=bool)

-            Current_Max_List.append(max(Index_List[ind]) + Current_List[j])

+            Current_Search_List = Search_List[1:3]

+            Current_Max_List.append(max(Current_Search_List) + Current_List[j])

+            Search_List.append(Search_List[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:

import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)

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

ans = 0

for z in range(K+1):

    for y in range(K+1):

        x = S - (z + y)

        if x >= 0 and x <= K:

            ans += 1

print(ans)

# optimized version of the same code:

import sys

input = sys.stdin.readline

sys.setrecursionlimit(10 ** 7)

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

ans = 0

for z in range(K+1):

    for y in range(K+1):

        x = S - (z + y)

        if 0 <= x <= K:

            ans += 1

print(ans)

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
K, S = list(map(int, input().split()))
ans = 0
for z in range(K + 1):
    for y in range(K + 1):
        x = S - (z + y)
        if x >= 0 and x <= K:
            ans += 1
print(ans)

import sys

input = sys.stdin.readline
sys.setrecursionlimit(10**7)
K, S = list(map(int, input().split()))
ans = 0
for z in range(K + 1):
    for y in range(K + 1):
        x = S - (z + y)
        if 0 <= x <= K:
            ans += 1
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:

n=int(eval(input()))

task=[]

for _ in range(n):

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

    task.append((b, -a))

task.sort()

time=0

flag=True

for i in task:

    time-=i[1]

    if time>i[0]:

        flag=False

        break

if flag:

    print("Yes")

else:

    print("No")

# optimized version of the same code:

import sys

from collections import defaultdict

from operator import itemgetter

input = sys.stdin.readline

N = int(eval(input()))

d = defaultdict(int)

for _ in range(N):

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

    d[b] += a

task = list(d.items())

task.sort()

now = 0

ans = "Yes"

for limit, time in task:

    now += time

    if now > limit:

        ans = "No"

        break

print(ans)

n = int(eval(input()))
task = []
for _ in range(n):
    a, b = list(map(int, input().split()))
    task.append((b, -a))
task.sort()
time = 0
flag = True
for i in task:
    time -= i[1]
    if time > i[0]:
        flag = False
        break
if flag:
    print("Yes")
else:
    print("No")

-n = int(eval(input()))
-task = []
-for _ in range(n):
+import sys
+from collections import defaultdict
+from operator import itemgetter
+
+input = sys.stdin.readline
+N = int(eval(input()))
+d = defaultdict(int)
+for _ in range(N):
-    task.append((b, -a))
+    d[b] += a
+task = list(d.items())
-time = 0
-flag = True
-for i in task:
-    time -= i[1]
-    if time > i[0]:
-        flag = False
+now = 0
+ans = "Yes"
+for limit, time in task:
+    now += time
+    if now > limit:
+        ans = "No"
-if flag:
-    print("Yes")
-else:
-    print("No")
+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()))

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

x2 = np.power(x,2)

p1 = sum(x)//n

p2 = -(-sum(x)//n)

w1 = n*(p1**2) -2*sum(x)*p1 +sum(x2)

w2 = n*(p2**2) -2*sum(x)*p2 +sum(x2)

print((min(w1,w2)))

# optimized version of the same code:

n = int(eval(input()))

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

ans = 10**6

for i in range(X[0],X[-1]+1):

    HP = 0

    for j in X:

        HP += (j - i) ** 2

    ans = min(ans,HP)

print(ans)

import numpy as np

n = int(eval(input()))
x = list(map(int, input().split()))
x2 = np.power(x, 2)
p1 = sum(x) // n
p2 = -(-sum(x) // n)
w1 = n * (p1**2) - 2 * sum(x) * p1 + sum(x2)
w2 = n * (p2**2) - 2 * sum(x) * p2 + sum(x2)
print((min(w1, w2)))

n = int(eval(input()))
X = sorted(map(int, input().split()))
ans = 10**6
for i in range(X[0], X[-1] + 1):
    HP = 0
    for j in X:
        HP += (j - i) ** 2
    ans = min(ans, HP)
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:

from collections import Counter,defaultdict,deque

from heapq import heapify,heappop,heappush

from bisect import bisect_left,bisect_right

import sys,math,itertools,string,queue

sys.setrecursionlimit(10**8)

mod = 10**9+7

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

def inpl_str(): return list(sys.stdin.readline().split())

def inpln(n): return list(int(sys.stdin.readline()) for i in range(n))

n,m = inpl()

a = inpl()

b = [0] * m

for i in range(m):

    x,y = inpl()

    b[i] = [x,y]

a.sort()

b.sort(key=lambda x:x[1], reverse = True)

res = sum(a)

i = 0

j = 0

while True:

    # print(i,j)

    if a[i] < b[j][1]:

        res += b[j][1] - a[i]

        i += 1

    else:

        break

    b[j][0] -= 1

    if b[j][0] == 0:

        j += 1

    if i >= n or j >= m:

        break

print(res)

# optimized version of the same code:

from collections import Counter,defaultdict,deque

from heapq import heappop,heappush,heapify

from bisect import bisect_left,bisect_right

import sys,math,itertools,fractions,pprint

sys.setrecursionlimit(10**8)

mod = 10**9+7

INF = float('inf')

def inp(): return int(sys.stdin.readline())

def inpl(): return list(map(int, sys.stdin.readline().split()))

n,m = inpl()

a = inpl()

a.sort()

bc = [inpl() for _ in range(m)]

bc.sort(key = lambda x:x[1], reverse = True)

lm = sum(x[1] for x in bc)

now = 0

alt = 0

while now < n and alt < m:

    c,b = bc[alt]

    if a[now] > b:

        break

    else:

        a[now] = b

    bc[alt][0] -= 1

    if bc[alt][0] == 0:

        alt += 1

    now += 1

print((sum(a)))

from collections import Counter, defaultdict, deque
from heapq import heapify, heappop, heappush
from bisect import bisect_left, bisect_right
import sys, math, itertools, string, queue

sys.setrecursionlimit(10**8)
mod = 10**9 + 7

def inp():
    return int(sys.stdin.readline())

def inpl():
    return list(map(int, sys.stdin.readline().split()))

def inpl_str():
    return list(sys.stdin.readline().split())

def inpln(n):
    return list(int(sys.stdin.readline()) for i in range(n))

n, m = inpl()
a = inpl()
b = [0] * m
for i in range(m):
    x, y = inpl()
    b[i] = [x, y]
a.sort()
b.sort(key=lambda x: x[1], reverse=True)
res = sum(a)
i = 0
j = 0
while True:
    # print(i,j)
    if a[i] < b[j][1]:
        res += b[j][1] - a[i]
        i += 1
    else:
        break
    b[j][0] -= 1
    if b[j][0] == 0:
        j += 1
    if i >= n or j >= m:
        break
print(res)

from collections import Counter, defaultdict, deque
from heapq import heappop, heappush, heapify
from bisect import bisect_left, bisect_right
import sys, math, itertools, fractions, pprint

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

def inp():
    return int(sys.stdin.readline())

def inpl():
    return list(map(int, sys.stdin.readline().split()))

n, m = inpl()
a = inpl()
a.sort()
bc = [inpl() for _ in range(m)]
bc.sort(key=lambda x: x[1], reverse=True)
lm = sum(x[1] for x in bc)
now = 0
alt = 0
while now < n and alt < m:
    c, b = bc[alt]
    if a[now] > b:
        break
    else:
        a[now] = b
    bc[alt][0] -= 1
    if bc[alt][0] == 0:
        alt += 1
    now += 1
print((sum(a)))

-from heapq import heapify, heappop, heappush

+from heapq import heappop, heappush, heapify

-import sys, math, itertools, string, queue

+import sys, math, itertools, fractions, pprint

-    return list(sys.stdin.readline().split())

-    return list(int(sys.stdin.readline()) for i in range(n))

-b.sort(key=lambda x: x[1], reverse=True)

+bc.sort(key=lambda x: x[1], reverse=True)


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())

k = int(eval(input()))

if len(set(s)) == 1:

    print(((len(s)*k)//2))

    exit()

ss = s + s

shoko = 0

prev = ''

cnt = 0

for i in range(len(s)):

    if s[i] == prev:

        cnt += 1

    else:

        shoko += cnt // 2

        cnt = 1

    prev = s[i]

shoko += cnt // 2

kosa = 0

prev = ''

cnt = 0

for i in range(len(ss)):

    if ss[i] == prev:

        cnt += 1

    else:

        kosa += cnt // 2

        cnt = 1

    prev = ss[i]

kosa += cnt // 2

kosa -= shoko

print((shoko + (k-1)*kosa))

# optimized version of the same code:

s = eval(input())

k = int(eval(input()))

n = len(s)

if len(set(s)) == 1:

    print((n*k//2))

    exit()

ss = s + s

cnts = 0

now = s[0]

temp = 1

for i in range(1, n):

    if s[i] == now:

        temp += 1

    else:

        cnts += temp // 2

        temp = 1

        now = s[i]

cnts += temp // 2

cntss = 0

now = ss[0]

temp = 1

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

    if ss[i] == now:

        temp += 1

    else:

        cntss += temp // 2

        temp = 1

        now = ss[i]

cntss += temp // 2

kousa = cntss - cnts

print((cnts + kousa*(k-1)))

s = eval(input())
k = int(eval(input()))
if len(set(s)) == 1:
    print(((len(s) * k) // 2))
    exit()
ss = s + s
shoko = 0
prev = ""
cnt = 0
for i in range(len(s)):
    if s[i] == prev:
        cnt += 1
    else:
        shoko += cnt // 2
        cnt = 1
    prev = s[i]
shoko += cnt // 2
kosa = 0
prev = ""
cnt = 0
for i in range(len(ss)):
    if ss[i] == prev:
        cnt += 1
    else:
        kosa += cnt // 2
        cnt = 1
    prev = ss[i]
kosa += cnt // 2
kosa -= shoko
print((shoko + (k - 1) * kosa))

s = eval(input())
k = int(eval(input()))
n = len(s)
if len(set(s)) == 1:
    print((n * k // 2))
    exit()
ss = s + s
cnts = 0
now = s[0]
temp = 1
for i in range(1, n):
    if s[i] == now:
        temp += 1
    else:
        cnts += temp // 2
        temp = 1
        now = s[i]
cnts += temp // 2
cntss = 0
now = ss[0]
temp = 1
for i in range(1, 2 * n):
    if ss[i] == now:
        temp += 1
    else:
        cntss += temp // 2
        temp = 1
        now = ss[i]
cntss += temp // 2
kousa = cntss - cnts
print((cnts + kousa * (k - 1)))

+n = len(s)
-    print(((len(s) * k) // 2))
+    print((n * k // 2))
-shoko = 0
-prev = ""
-cnt = 0
-for i in range(len(s)):
-    if s[i] == prev:
-        cnt += 1
+cnts = 0
+now = s[0]
+temp = 1
+for i in range(1, n):
+    if s[i] == now:
+        temp += 1
-        shoko += cnt // 2
-        cnt = 1
-    prev = s[i]
-shoko += cnt // 2
-kosa = 0
-prev = ""
-cnt = 0
-for i in range(len(ss)):
-    if ss[i] == prev:
-        cnt += 1
+        cnts += temp // 2
+        temp = 1
+        now = s[i]
+cnts += temp // 2
+cntss = 0
+now = ss[0]
+temp = 1
+for i in range(1, 2 * n):
+    if ss[i] == now:
+        temp += 1
-        kosa += cnt // 2
-        cnt = 1
-    prev = ss[i]
-kosa += cnt // 2
-kosa -= shoko
-print((shoko + (k - 1) * kosa))
+        cntss += temp // 2
+        temp = 1
+        now = ss[i]
+cntss += temp // 2
+kousa = cntss - cnts
+print((cnts + kousa * (k - 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:

n,q=list(map(int,input().split()));s="_"+eval(input())+"_";l,r=0,n+1

for(m,h)in[input().split()for i in range(q)][::-1]:L=h=="L";R=h=="R";l,r=[l,l-1,l+1][(m==s[l]and R)-(m==s[l+1]and L)],[r,r-1,r+1][(m==s[r-1]and R)-(m==s[r]and L)]

print((max(0,r-l-1)))

# optimized version of the same code:

n,q=list(map(int,input().split()));s="_"+eval(input())+"_";l,r=0,n+1

for(m,h)in[input().split()for i in range(q)][::-1]:

    L=h=="L";R=h=="R";

    l+=(m==s[l+1]and L)-(m==s[l]and R)

    r+=(m==s[r]and L)-(m==s[r-1]and R)

print((max(0,r-l-1)))

n, q = list(map(int, input().split()))
s = "_" + eval(input()) + "_"
l, r = 0, n + 1
for (m, h) in [input().split() for i in range(q)][::-1]:
    L = h == "L"
    R = h == "R"
    l += (m == s[l + 1] and L) - (m == s[l] and R)
    r += (m == s[r] and L) - (m == s[r - 1] and R)
print((max(0, r - l - 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

N = int(eval(input()))

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

ans = 0

a = np.array(a)

while a.size > 0:

    a = a[a%2 == 0]

    ans += len(a)

    a = a//2

print(ans)

# optimized version of the same code:

n = int(eval(input()))

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

ans = 0

for i in range(n):

    while a[i]%2 == 0:

        a[i] //=2

        ans+=1

print(ans)

import numpy as np

N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
a = np.array(a)
while a.size > 0:
    a = a[a % 2 == 0]
    ans += len(a)
    a = a // 2
print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
for i in range(n):
    while a[i] % 2 == 0:
        a[i] //= 2
        ans += 1
print(ans)

-import numpy as np
-N = int(eval(input()))
+n = int(eval(input()))
-a = np.array(a)
-while a.size > 0:
-    a = a[a % 2 == 0]
-    ans += len(a)
-    a = a // 2
+for i in range(n):
+    while a[i] % 2 == 0:
+        a[i] //= 2
+        ans += 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

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

a = [int(eval(input())) for _ in range(m)] + [0]

mod = 10 ** 9 + 7

dp = np.zeros(n + 1, dtype=np.int64)

dp[0] = 1

b = a[0]

j = 1

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

    if i == b:

        b = a[j]

        j += 1

    else:

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

        if tmp >= mod:

            tmp -= mod

        dp[i] = tmp

print((int(dp[-1])))

# optimized version of the same code:

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

a = [int(eval(input())) for _ in range(m)] + [0]

mod = 10 ** 9 + 7

dp = [0] * (n + 1)

dp[0] = 1

b = a[0]

j = 1

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

    if i == b:

        b = a[j]

        j += 1

    else:

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

        if tmp >= mod:

            tmp -= mod

        dp[i] = tmp

print((int(dp[-1])))

import numpy as np

n, m = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(m)] + [0]
mod = 10**9 + 7
dp = np.zeros(n + 1, dtype=np.int64)
dp[0] = 1
b = a[0]
j = 1
for i in range(1, n + 1):
    if i == b:
        b = a[j]
        j += 1
    else:
        tmp = dp[i - 2] + dp[i - 1]
        if tmp >= mod:
            tmp -= mod
        dp[i] = tmp
print((int(dp[-1])))

n, m = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(m)] + [0]
mod = 10**9 + 7
dp = [0] * (n + 1)
dp[0] = 1
b = a[0]
j = 1
for i in range(1, n + 1):
    if i == b:
        b = a[j]
        j += 1
    else:
        tmp = dp[i - 2] + dp[i - 1]
        if tmp >= mod:
            tmp -= mod
        dp[i] = tmp
print((int(dp[-1])))

-import numpy as np
-dp = np.zeros(n + 1, dtype=np.int64)
+dp = [0] * (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:

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

A = {int(eval(input())) for _ in range(M)}

memo = [0] * (N + 1)

memo[0] = 1

memo[1] = 0 if 1 in A else 1

if N == 1:

    print((memo[1]))

else:

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

        if i in A:

            continue

        memo[i] = (memo[i - 2] + memo[i - 1]) % 1000000007

    print((memo[N]))

# optimized version of the same code:

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

A = {int(input()) for _ in range(M)}

memo = [0] * (N + 1)

memo[0] = 1

memo[1] = 0 if 1 in A else 1

if N == 1:

    print((memo[1]))

else:

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

        if i in A:

            continue

        memo[i] = (memo[i - 2] + memo[i - 1]) % 1000000007

    print((memo[N]))

-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:

import math

n = int(eval(input()))

print((math.factorial(n) % (10 ** 9 + 7)))

# optimized version of the same code:

n = int(eval(input()))

p = 1

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

  p = p * i % (10 ** 9 + 7)

print(p)

import math

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

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

-print((math.factorial(n) % (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:

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

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

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

A.sort()

F.sort(reverse=True)

#積をx以下にするために必要な修行回数

def f(x):

    r = 0

    for i in range(N):

        a, f = A[i], F[i]

        m = a * f

        if m > x:

            r += (m - x + f - 1) // f

    return r

under = -1

r = 10**18

while r - under > 1:

    m = (under + r) // 2

    if f(m) > K: under = m

    else: r = m

print(r)

# optimized version of the same code:

# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)

import sys

def main(N, K, A, F):

    A.sort()

    F.sort(reverse=True)

    def f(x):

        sy = 0

        for a, f in zip(A, F):

            m = a * f

            if m > x:

                sy += (m - x + f - 1) // f

        return sy

    under = -1

    hi = 10**12 + 1

    while hi - under > 1:

        m = (hi + under) // 2

        if f(m) <= K: hi = m

        else: under = m

    print(hi)

if __name__ == '__main__':

    input = sys.stdin.readline

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

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

    *F, = list(map(int, input().split()))

    main(N, K, A, F)

N, K = list(map(int, input().split()))
A = list(map(int, input().split()))
F = list(map(int, input().split()))
A.sort()
F.sort(reverse=True)
# 積をx以下にするために必要な修行回数
def f(x):
    r = 0
    for i in range(N):
        a, f = A[i], F[i]
        m = a * f
        if m > x:
            r += (m - x + f - 1) // f
    return r

under = -1
r = 10**18
while r - under > 1:
    m = (under + r) // 2
    if f(m) > K:
        under = m
    else:
        r = m
print(r)

# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)
import sys

def main(N, K, A, F):
    A.sort()
    F.sort(reverse=True)

    def f(x):
        sy = 0
        for a, f in zip(A, F):
            m = a * f
            if m > x:
                sy += (m - x + f - 1) // f
        return sy

    under = -1
    hi = 10**12 + 1
    while hi - under > 1:
        m = (hi + under) // 2
        if f(m) <= K:
            hi = m
        else:
            under = m
    print(hi)

if __name__ == "__main__":
    input = sys.stdin.readline
    N, K = list(map(int, input().split()))
    (*A,) = list(map(int, input().split()))
    (*F,) = list(map(int, input().split()))
    main(N, K, A, F)

-# 積をx以下にするために必要な修行回数

+# でつoO(YOU PLAY WITH THE CARDS YOU'RE DEALT..)

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

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

+    (*F,) = 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=list(map(int,input().split()))

print((b if 13<=a else b//2 if 6<=a else 0))

# optimized version of the same code:

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

print((b if 12<a else b//2 if 5<a else 0))

a, b = list(map(int, input().split()))
print((b if 13 <= a else b // 2 if 6 <= a else 0))

a, b = list(map(int, input().split()))
print((b if 12 < a else b // 2 if 5 < a else 0))

-print((b if 13 <= a else b // 2 if 6 <= a else 0))

+print((b if 12 < a else b // 2 if 5 < a else 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,K=list(map(int,input().split()))

con = 0

ans = list(int() for _ in range(100000))

pre = 0

for _ in range(K):

    D = int(eval(input()))

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

    for j in range(D):

        ans[pre+j]=arr[j]

    pre += D

fin = (N+1) - len(set(ans))

print(fin)

# optimized version of the same code:

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

con = 0

ans = list(int() for _ in range(10001))

pre = 0

for _ in range(K):

    D = int(eval(input()))

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

    for j in range(D):

        ans[pre+j]=arr[j]

    pre += D

fin = (N+1) - len(set(ans))

print(fin)

N, K = list(map(int, input().split()))
con = 0
ans = list(int() for _ in range(100000))
pre = 0
for _ in range(K):
    D = int(eval(input()))
    arr = list(map(int, input().split()))
    for j in range(D):
        ans[pre + j] = arr[j]
    pre += D
fin = (N + 1) - len(set(ans))
print(fin)

N, K = list(map(int, input().split()))
con = 0
ans = list(int() for _ in range(10001))
pre = 0
for _ in range(K):
    D = int(eval(input()))
    arr = list(map(int, input().split()))
    for j in range(D):
        ans[pre + j] = arr[j]
    pre += D
fin = (N + 1) - len(set(ans))
print(fin)

-ans = list(int() for _ in range(100000))

+ans = list(int() for _ in range(10001))


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 = int(eval(input()))

  a = [0]

  b = [0]

  c = [0]

  for i in range(n):

      aa,bb,cc = list(map(int,input().split()))

      a.append(max(b[i] + aa, c[i] + aa))

      b.append(max(a[i] + bb, c[i] + bb))

      c.append(max(a[i] + cc, b[i] + cc))

  print((max(a[-1], b[-1], c[-1])))

main()

# optimized version of the same code:

def main():

    n = int(eval(input()))

    a = 0

    b = 0

    c = 0

    for i in range(n):

        aa,bb,cc = list(map(int,input().split()))

        a,b,c = max(b,c)+aa, max(a,c)+bb, max(a,b)+cc

    print((max(a,b,c)))

main()

def main():
    n = int(eval(input()))
    a = [0]
    b = [0]
    c = [0]
    for i in range(n):
        aa, bb, cc = list(map(int, input().split()))
        a.append(max(b[i] + aa, c[i] + aa))
        b.append(max(a[i] + bb, c[i] + bb))
        c.append(max(a[i] + cc, b[i] + cc))
    print((max(a[-1], b[-1], c[-1])))

main()

def main():
    n = int(eval(input()))
    a = 0
    b = 0
    c = 0
    for i in range(n):
        aa, bb, cc = list(map(int, input().split()))
        a, b, c = max(b, c) + aa, max(a, c) + bb, max(a, b) + cc
    print((max(a, b, c)))

main()

-        a.append(max(b[i] + aa, c[i] + aa))

-        b.append(max(a[i] + bb, c[i] + bb))

-        c.append(max(a[i] + cc, b[i] + cc))

+        a, b, c = max(b, c) + aa, max(a, c) + bb, max(a, b) + cc


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():

    import sys

    input = sys.stdin.readline

    sys.setrecursionlimit(10**7)

    from collections import Counter, deque

    #from collections import defaultdict

    from itertools import combinations, permutations, accumulate, groupby

    #from itertools import product

    from bisect import bisect_left,bisect_right

    import heapq

    from math import floor, ceil

    #from operator import itemgetter

    #inf = 10**17

    #mod = 10**9 + 7

    x,y,z,k = list(map(int, input().split()))

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

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

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

    ab = []

    for i in a:

        for j in b:

            ab.append(i+j)

    ab.sort(reverse=1)

    ab = ab[:k]

    abc = []

    for i in ab:

        for j in c:

            abc.append(i+j)

    abc.sort(reverse=1)

    for i in range(k):

        print((abc[i]))

if __name__ == '__main__':

    main()

# optimized version of the same code:

#xyzの全通り調べると間に合わない

#まず問題を分けよう

#先にxyだけ考えてみる

#xyの和をとってからそれとzの和をとるとき

#xyの和においてk番目以降の値を使うことは無い

#

def main():

    import sys

    input = sys.stdin.readline

    sys.setrecursionlimit(10**7)

    from collections import Counter, deque

    #from collections import defaultdict

    from itertools import combinations, permutations, accumulate, groupby

    #from itertools import product

    from bisect import bisect_left,bisect_right

    import heapq

    from math import floor, ceil

    #from operator import itemgetter

    #inf = 10**17

    #mod = 10**9 + 7

    x,y,z,k = list(map(int, input().split()))

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

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

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

    a.sort(reverse=1)

    b.sort(reverse=1)

    c.sort(reverse=1)

    abc = []

    for i in range(x):

        for j in range(y):

            if i*j>k:

                continue

            for t in range(z):

                if i*j*t>k:

                    continue

                abc.append(a[i]+b[j]+c[t])

    abc.sort(reverse=1)

    for i in range(k):

        print((abc[i]))

if __name__ == '__main__':

    main()

def main():
    import sys

    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque

    # from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby

    # from itertools import product
    from bisect import bisect_left, bisect_right
    import heapq
    from math import floor, ceil

    # from operator import itemgetter
    # inf = 10**17
    # mod = 10**9 + 7
    x, y, z, k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    ab = []
    for i in a:
        for j in b:
            ab.append(i + j)
    ab.sort(reverse=1)
    ab = ab[:k]
    abc = []
    for i in ab:
        for j in c:
            abc.append(i + j)
    abc.sort(reverse=1)
    for i in range(k):
        print((abc[i]))

if __name__ == "__main__":
    main()

# xyzの全通り調べると間に合わない
# まず問題を分けよう
# 先にxyだけ考えてみる
# xyの和をとってからそれとzの和をとるとき
# xyの和においてk番目以降の値を使うことは無い
#
def main():
    import sys

    input = sys.stdin.readline
    sys.setrecursionlimit(10**7)
    from collections import Counter, deque

    # from collections import defaultdict
    from itertools import combinations, permutations, accumulate, groupby

    # from itertools import product
    from bisect import bisect_left, bisect_right
    import heapq
    from math import floor, ceil

    # from operator import itemgetter
    # inf = 10**17
    # mod = 10**9 + 7
    x, y, z, k = list(map(int, input().split()))
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))
    c = list(map(int, input().split()))
    a.sort(reverse=1)
    b.sort(reverse=1)
    c.sort(reverse=1)
    abc = []
    for i in range(x):
        for j in range(y):
            if i * j > k:
                continue
            for t in range(z):
                if i * j * t > k:
                    continue
                abc.append(a[i] + b[j] + c[t])
    abc.sort(reverse=1)
    for i in range(k):
        print((abc[i]))

if __name__ == "__main__":
    main()

+# xyzの全通り調べると間に合わない

+# まず問題を分けよう

+# 先にxyだけ考えてみる

+# xyの和をとってからそれとzの和をとるとき

+# xyの和においてk番目以降の値を使うことは無い

+                abc.append(a[i] + b[j] + c[t])


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

e=[list(map(int,e.split()))for e in sys.stdin]

n=e[0][0]+1

for c in e[1:n]:

 t=''

 for l in zip(*e[n:]):t+=f'{sum(s*t for s,t in zip(c,l))} '

 print((t[:-1]))

# optimized version of the same code:

import sys

e=[list(map(int,e.split()))for e in sys.stdin]

n=e[0][0]+1

t=''

for c in e[1:n]:

 for l in zip(*e[n:]):t+=f'{sum(s*t for s,t in zip(c,l))} '

 t=t[:-1]+'\n'

print((t[:-1]))

import sys

e = [list(map(int, e.split())) for e in sys.stdin]
n = e[0][0] + 1
for c in e[1:n]:
    t = ""
    for l in zip(*e[n:]):
        t += f"{sum(s*t for s,t in zip(c,l))} "
    print((t[:-1]))

import sys

e = [list(map(int, e.split())) for e in sys.stdin]
n = e[0][0] + 1
t = ""
for c in e[1:n]:
    for l in zip(*e[n:]):
        t += f"{sum(s*t for s,t in zip(c,l))} "
    t = t[:-1] + "\n"
print((t[:-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 functools import reduce

from fractions import gcd

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

def lcm(x, y):

    return x * y // gcd(x, y)

def sub_by_2(n):

    cnt = 0

    while n % 2 == 0:

        n //= 2

        cnt += 1

    return cnt

lcm_2 = [sub_by_2(n // 2) for n in A]

if all(lcm_2[0] == v for v in lcm_2):

    num = reduce(lcm, [v // 2 for v in A])

    res = M // num

    print((res // 2 + res % 2))

else:

    print((0))

# optimized version of the same code:

from math import gcd

from functools import reduce

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

def lcm(x, y):

    return x * y // gcd(x, y)

def lcm_list(numbers):

    return reduce(lcm, numbers, 1)

def even_count(n):

    res = 0

    while n % 2 == 0:

        res += 1

        n //= 2

    return res

x = [v // 2 for v in A]

if all(even_count(v) == even_count(x[0]) for v in x):

    num = lcm_list(x)

    print((-(-(M // num) // 2)))

else:

    print((0))

-    num = reduce(lcm, [v // 2 for v in A])

+if all(even_count(v) == even_count(x[0]) for v in 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:

n=int(eval(input()))

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

import itertools as it

import numpy as np

al=list(it.combinations(a,2))

total=0

for i in al:

    total+=np.prod(i)

print(total)

# optimized version of the same code:

n=int(eval(input()))

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

ans=0

for i in range(n-1):

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

        ans+=a[i]*a[j]

print(ans)

n = int(eval(input()))
a = list(map(int, input().split()))
import itertools as it
import numpy as np

al = list(it.combinations(a, 2))
total = 0
for i in al:
    total += np.prod(i)
print(total)

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

-import itertools as it
-import numpy as np
-al = list(it.combinations(a, 2))
-total = 0
-for i in al:
-    total += np.prod(i)
-print(total)
+ans = 0
+for i in range(n - 1):
+    for j in range(i + 1, n):
+        ans += a[i] * a[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:

x = int(eval(input()))

if x == 0:

  print((1))

else:

  print((0))

# optimized version of the same code:


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 = np.array(input().split(),dtype=np.int32)

def ord(n):

  cnt = 0

  while not n&1:

    n >>= 1

    cnt += 1

  return cnt

np_ord = np.frompyfunc(ord,1,1)

answer = np_ord(A).sum()

print(answer)

# optimized version of the same code:

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(readline())

A = np.array(read().split(),np.int32)

answer = 0

for _ in range(32):

    A = A[A%2 == 0]

    answer += len(A)

    A >>= 1

print(answer)

import numpy as np

N = int(eval(input()))
A = np.array(input().split(), dtype=np.int32)

def ord(n):
    cnt = 0
    while not n & 1:
        n >>= 1
        cnt += 1
    return cnt

np_ord = np.frompyfunc(ord, 1, 1)
answer = np_ord(A).sum()
print(answer)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np

N = int(readline())
A = np.array(read().split(), np.int32)
answer = 0
for _ in range(32):
    A = A[A % 2 == 0]
    answer += len(A)
    A >>= 1
print(answer)

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


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,l = [int(x) for x in input().split()]

x = np.arange(l,l+n)

y = np.abs(x)

x = np.delete(x, np.argmin(y))

print((np.sum(x)))

# optimized version of the same code:

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

apples = [i for i in range(L, L+N)]

apples_abs = [abs(i) for i in apples]

min_idx = apples_abs.index(min(apples_abs))

print((sum(apples) - apples[min_idx]))

import numpy as np

n, l = [int(x) for x in input().split()]
x = np.arange(l, l + n)
y = np.abs(x)
x = np.delete(x, np.argmin(y))
print((np.sum(x)))

N, L = list(map(int, input().split()))
apples = [i for i in range(L, L + N)]
apples_abs = [abs(i) for i in apples]
min_idx = apples_abs.index(min(apples_abs))
print((sum(apples) - apples[min_idx]))

-n, l = [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:

N=int(eval(input()))

C=[[0]*9  for i in range(9)]

count=0

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

   if str(n)[-1]!="0":

      left=int(str(n)[0])-1

      right=int(str(n)[-1])-1

      C[left][right]+=1

for i in range(1,10):

   for j in range(1,10):

      count+=C[i-1][j-1]*C[j-1][i-1]

print(count)

# optimized version of the same code:

from sys import stdin

def main():

    #入力

    readline=stdin.readline

    N=int(readline())

    d=dict()

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

        i=str(i)

        head=i[0]

        tail=i[-1]

        if tail=="0":

            continue

        if (head,tail) not in d:

            d[(head,tail)]=1

        else:

            d[(head,tail)]+=1

    ans=0

    s=set()

    for k in list(d.keys()):

        m,l=k[0],k[1]

        if (m,l) in s:

            continue

        if (l,m) in d:

            ans+=d[(m,l)]*d[(l,m)]

            if (m,l)!=(l,m):

                ans+=d[(m,l)]*d[(l,m)]

        s.add((m,l))

        s.add((l,m))

    print(ans)

if __name__=="__main__":

    main()

N = int(eval(input()))
C = [[0] * 9 for i in range(9)]
count = 0
for n in range(1, N + 1):
    if str(n)[-1] != "0":
        left = int(str(n)[0]) - 1
        right = int(str(n)[-1]) - 1
        C[left][right] += 1
for i in range(1, 10):
    for j in range(1, 10):
        count += C[i - 1][j - 1] * C[j - 1][i - 1]
print(count)

from sys import stdin

def main():
    # 入力
    readline = stdin.readline
    N = int(readline())
    d = dict()
    for i in range(1, N + 1):
        i = str(i)
        head = i[0]
        tail = i[-1]
        if tail == "0":
            continue
        if (head, tail) not in d:
            d[(head, tail)] = 1
        else:
            d[(head, tail)] += 1
    ans = 0
    s = set()
    for k in list(d.keys()):
        m, l = k[0], k[1]
        if (m, l) in s:
            continue
        if (l, m) in d:
            ans += d[(m, l)] * d[(l, m)]
            if (m, l) != (l, m):
                ans += d[(m, l)] * d[(l, m)]
        s.add((m, l))
        s.add((l, m))
    print(ans)

if __name__ == "__main__":
    main()


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()))

s = list(eval(input()))

j = []

now = 0

unclosen = 0

opened = 0

for i in s:

    if i == ")":

        now -= 1

        if opened:

            opened -= 1

        else:

            unclosen += 1

    else:

        now += 1

        opened += 1

j = np.array(j)

print(("(" * unclosen + "".join(s) + ")" * opened))

# optimized version of the same code:

n = int(eval(input()))

s = list(eval(input()))

now = 0

unclosen = 0

opened = 0

for i in s:

    if i == ")":

        now -= 1

        if opened:

            opened -= 1

        else:

            unclosen += 1

    else:

        now += 1

        opened += 1

print(("(" * unclosen + "".join(s) + ")" * opened))

-import numpy as np
-j = []
-j = np.array(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:

import numpy as np

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

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

cs = np.sort(a).cumsum()

if cs[-1]<x:

    print((N-1))

elif cs[-1]==x:

    print(N)

else:

    print((np.where(cs<=x)[0].shape[0]))

# optimized version of the same code:

from bisect import bisect_right

from itertools import accumulate

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

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

arr.sort()

arr = list(accumulate(arr))

happy = bisect_right(arr, x)

if happy == n:

    if arr[-1] != x:

        happy -= 1

print(happy)

import numpy as np

N, x = list(map(int, input().split()))
a = np.array(list(map(int, input().split())))
cs = np.sort(a).cumsum()
if cs[-1] < x:
    print((N - 1))
elif cs[-1] == x:
    print(N)
else:
    print((np.where(cs <= x)[0].shape[0]))

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

-    print((np.where(cs <= x)[0].shape[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:

from sys import stdin,stdout

if __name__=="__main__":

    n=int(stdin.readline())

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

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

    cnt=0

    for i in range(n):

        if(a[i]>=b[i]):

            cnt+=b[i]

        else:

            cnt+=a[i]

            d=b[i]-a[i]

            cnt+=min(a[i+1],d)

            if(d>a[i+1]):

                a[i+1]=0

            else: a[i+1]-=d

    stdout.write(str(cnt)+"\n")

# optimized version of the same code:

n = int(eval(input()))

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

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

a1 = sum(A)

for i in range(n):

  b = B[i]

  if A[i] >= b:A[i] -= b

  else:

    if A[i+1]+A[i] >= b:

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

      A[i] = 0

    else:A[i], A[i+1] = 0, 0

a2 = sum(A)

print((a1-a2))

from sys import stdin, stdout

if __name__ == "__main__":
    n = int(stdin.readline())
    a = [int(x) for x in stdin.readline().split()]
    b = [int(x) for x in stdin.readline().split()]
    cnt = 0
    for i in range(n):
        if a[i] >= b[i]:
            cnt += b[i]
        else:
            cnt += a[i]
            d = b[i] - a[i]
            cnt += min(a[i + 1], d)
            if d > a[i + 1]:
                a[i + 1] = 0
            else:
                a[i + 1] -= d
    stdout.write(str(cnt) + "\n")

n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
a1 = sum(A)
for i in range(n):
    b = B[i]
    if A[i] >= b:
        A[i] -= b
    else:
        if A[i + 1] + A[i] >= b:
            A[i + 1] = A[i + 1] + A[i] - b
            A[i] = 0
        else:
            A[i], A[i + 1] = 0, 0
a2 = sum(A)
print((a1 - a2))

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

-    b = [int(x) for x in stdin.readline().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 itertools import permutations

    n, m, r, *x = list(map(int, open(0).read().split()))

    to = x[:r]

    dis = [[float("Inf")] * (n + 1) for _ in range(n + 1)]

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

        dis[i][i] = 0

    for a, b, c in zip(*[iter(x[r:])] * 3):

        dis[a][b] = c

        dis[b][a] = c

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

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

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

                dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])

    ans = float("Inf")

    for p in permutations(to):

        tmp = 0

        nw = p[0]

        for nx in p[1:]:

            tmp += dis[nw][nx]

            nw = nx

        ans = min(ans, tmp)

    print(ans)

if __name__ == '__main__':

    main()

# optimized version of the same code:

def main():

    from itertools import permutations

    n, m, r, *x = list(map(int, open(0).read().split()))

    to = x[:r]

    dis = [[10 ** 8] * (n + 1) for _ in range(n + 1)]

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

        dis[i][i] = 0

    for a, b, c in zip(*[iter(x[r:])] * 3):

        dis[a][b] = c

        dis[b][a] = c

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

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

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

                dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])

    ans = 10 ** 8

    for p in permutations(to):

        tmp = 0

        nw = p[0]

        for nx in p[1:]:

            tmp += dis[nw][nx]

            nw = nx

        ans = min(ans, tmp)

    print(ans)

if __name__ == '__main__':

    main()

def main():
    from itertools import permutations

    n, m, r, *x = list(map(int, open(0).read().split()))
    to = x[:r]
    dis = [[float("Inf")] * (n + 1) for _ in range(n + 1)]
    for i in range(1, n + 1):
        dis[i][i] = 0
    for a, b, c in zip(*[iter(x[r:])] * 3):
        dis[a][b] = c
        dis[b][a] = c
    for k in range(1, n + 1):
        for i in range(1, n + 1):
            for j in range(1, n + 1):
                dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])
    ans = float("Inf")
    for p in permutations(to):
        tmp = 0
        nw = p[0]
        for nx in p[1:]:
            tmp += dis[nw][nx]
            nw = nx
        ans = min(ans, tmp)
    print(ans)

if __name__ == "__main__":
    main()

def main():
    from itertools import permutations

    n, m, r, *x = list(map(int, open(0).read().split()))
    to = x[:r]
    dis = [[10**8] * (n + 1) for _ in range(n + 1)]
    for i in range(1, n + 1):
        dis[i][i] = 0
    for a, b, c in zip(*[iter(x[r:])] * 3):
        dis[a][b] = c
        dis[b][a] = c
    for k in range(1, n + 1):
        for i in range(1, n + 1):
            for j in range(1, n + 1):
                dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j])
    ans = 10**8
    for p in permutations(to):
        tmp = 0
        nw = p[0]
        for nx in p[1:]:
            tmp += dis[nw][nx]
            nw = nx
        ans = min(ans, tmp)
    print(ans)

if __name__ == "__main__":
    main()

-    dis = [[float("Inf")] * (n + 1) for _ 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:

counter = 0

c = list(map(int, input().split(' ')))

for i in range(c[0], c[1] + 1):

  if str(i)[0] != str(i)[4]:

    continue

  if str(i)[1] != str(i)[3]:

    continue

  counter += 1

print(counter)

# optimized version of the same code:

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

counter = 0

for i in range(a[0], a[1] + 1):

  stri = str(i)

  if (stri[0] == stri[4] and stri[1] == stri[3]):

    counter += 1

print(counter)

counter = 0
c = list(map(int, input().split(" ")))
for i in range(c[0], c[1] + 1):
    if str(i)[0] != str(i)[4]:
        continue
    if str(i)[1] != str(i)[3]:
        continue
    counter += 1
print(counter)

a = list(map(int, input().split()))
counter = 0
for i in range(a[0], a[1] + 1):
    stri = str(i)
    if stri[0] == stri[4] and stri[1] == stri[3]:
        counter += 1
print(counter)

+    if stri[0] == stri[4] and stri[1] == stri[3]:


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:

I=lambda:list(map(int,input().split()))

n,m=I()

a=I()

a.sort(reverse=True)

qq=[I() for i in range(m)]

qq.sort(key=lambda x:x[1],reverse=True)

ans=0

for x,y in qq:

    for j in range(x):

        if not a:

            break

        aa=a.pop()

        ans+=max(aa,y)

ans+=sum(a)

print(ans)

# optimized version of the same code:

I=lambda : list(map(int,input().split()))

n,m = I()

l=I();s=sum(l);l.sort();d=[]

for _ in range(m):

    b,c=I()

    d.append([c,b])

p=s=0

for i in sorted(d,reverse=True):

    while i[1]:

        if p>=n or l[p]>=i[0]:

            break

        i[1]-=1

        s+=i[0]

        p+=1

    if p>=n:

        break

s+=sum(l[p:])

print(s)

I = lambda: list(map(int, input().split()))
n, m = I()
a = I()
a.sort(reverse=True)
qq = [I() for i in range(m)]
qq.sort(key=lambda x: x[1], reverse=True)
ans = 0
for x, y in qq:
    for j in range(x):
        if not a:
            break
        aa = a.pop()
        ans += max(aa, y)
ans += sum(a)
print(ans)

I = lambda: list(map(int, input().split()))
n, m = I()
l = I()
s = sum(l)
l.sort()
d = []
for _ in range(m):
    b, c = I()
    d.append([c, b])
p = s = 0
for i in sorted(d, reverse=True):
    while i[1]:
        if p >= n or l[p] >= i[0]:
            break
        i[1] -= 1
        s += i[0]
        p += 1
    if p >= n:
        break
s += sum(l[p:])
print(s)

-qq.sort(key=lambda x: x[1], reverse=True)


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,k=list(map(int,input().split()))

exp=tuple([(int(x)+1)/2 for x in input().split()])

l=np.cumsum(exp)

ans=l[k-1]

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

  x=l[i+k]-l[i]

  ans=max(ans,x)

print(ans)

# optimized version of the same code:

def main():

    from itertools import accumulate

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

    *exp, = [(int(x) + 1) / 2 for x in input().split()]

    l = accumulate(exp)

    l = list(l)

    ans = l[k - 1]

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

        x = l[i + k] - l[i]

        ans = max(ans, x)

    print(ans)

if __name__ == '__main__':

    main()

import numpy as np

n, k = list(map(int, input().split()))
exp = tuple([(int(x) + 1) / 2 for x in input().split()])
l = np.cumsum(exp)
ans = l[k - 1]
for i in range(0, n - k):
    x = l[i + k] - l[i]
    ans = max(ans, x)
print(ans)

def main():
    from itertools import accumulate

    n, k = list(map(int, input().split()))
    (*exp,) = [(int(x) + 1) / 2 for x in input().split()]
    l = accumulate(exp)
    l = list(l)
    ans = l[k - 1]
    for i in range(0, n - k):
        x = l[i + k] - l[i]
        ans = max(ans, x)
    print(ans)

if __name__ == "__main__":
    main()

-exp = tuple([(int(x) + 1) / 2 for x in input().split()])

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

+    (*exp,) = [(int(x) + 1) / 2 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:

import numpy as np

import sys

n = int(eval(input()))

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

cnt = 1

if np.any(a%2==1):

    print((0))

    sys.exit()

while True:

    a2 = a % 2**cnt

    if np.all(a2==0):

        cnt += 1

        continue

    else:

        print((cnt-1))

        break

# optimized version of the same code:

N = int(eval(input()))

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

ans = 0

while all(A%2 == 0 for A in a):

	a = [i/2 for i in a ]

	ans += 1

print(ans)

import numpy as np
import sys

n = int(eval(input()))
a = np.array(list(map(int, input().split())))
cnt = 1
if np.any(a % 2 == 1):
    print((0))
    sys.exit()
while True:
    a2 = a % 2**cnt
    if np.all(a2 == 0):
        cnt += 1
        continue
    else:
        print((cnt - 1))
        break

N = int(eval(input()))
a = list(map(int, input().split()))
ans = 0
while all(A % 2 == 0 for A in a):
    a = [i / 2 for i in a]
    ans += 1
print(ans)

-a = np.array(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()))

e=(a-b)|(b-c)

print((bool(e|(a|b|c)%2)*(e^~-e).bit_length()-1))

# optimized version of the same code:

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

e=(a-b)|(b-c)

print((bool(e|b%2)*(e^~-e).bit_length()-1))

a, b, c = list(map(int, input().split()))
e = (a - b) | (b - c)
print((bool(e | (a | b | c) % 2) * (e ^ ~-e).bit_length() - 1))

a, b, c = list(map(int, input().split()))
e = (a - b) | (b - c)
print((bool(e | b % 2) * (e ^ ~-e).bit_length() - 1))

+print((bool(e | b % 2) * (e ^ ~-e).bit_length() - 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

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

print((int(np.ceil(N/(2*D+1)))))

# optimized version of the same code:

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

import math

print((math.ceil(N/(2*D+1))))

import numpy as np

N, D = list(map(int, input().split()))
print((int(np.ceil(N / (2 * D + 1)))))

N, D = list(map(int, input().split()))
import math

print((math.ceil(N / (2 * D + 1))))

-import numpy as np
+N, D = list(map(int, input().split()))
+import math
-N, D = list(map(int, input().split()))
-print((int(np.ceil(N / (2 * D + 1)))))
+print((math.ceil(N / (2 * D + 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:

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

L = [0 for i in range(N+1)]

R = [0 for i in range(N+1)]

for i in range(M):

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

    L[l] += 1

    R[r] += 1

cnt = 0

tmp = 0

for i in range(N+1):

    tmp += L[i]

    if tmp == M:

        cnt += 1

    tmp -= R[i]

print(cnt)

# optimized version of the same code:

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

ll = 1

rr = n

for i in range(m):

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

    if l > ll:

        ll = l

    if r < rr:

        rr = r

print((max(rr - ll + 1, 0)))

N, M = list(map(int, input().split()))
L = [0 for i in range(N + 1)]
R = [0 for i in range(N + 1)]
for i in range(M):
    l, r = list(map(int, input().split()))
    L[l] += 1
    R[r] += 1
cnt = 0
tmp = 0
for i in range(N + 1):
    tmp += L[i]
    if tmp == M:
        cnt += 1
    tmp -= R[i]
print(cnt)

n, m = list(map(int, input().split()))
ll = 1
rr = n
for i in range(m):
    l, r = list(map(int, input().split()))
    if l > ll:
        ll = l
    if r < rr:
        rr = r
print((max(rr - ll + 1, 0)))

-N, M = list(map(int, input().split()))
-L = [0 for i in range(N + 1)]
-R = [0 for i in range(N + 1)]
-for i in range(M):
+n, m = list(map(int, input().split()))
+ll = 1
+rr = n
+for i in range(m):
-    L[l] += 1
-    R[r] += 1
-cnt = 0
-tmp = 0
-for i in range(N + 1):
-    tmp += L[i]
-    if tmp == M:
-        cnt += 1
-    tmp -= R[i]
-print(cnt)
+    if l > ll:
+        ll = l
+    if r < rr:
+        rr = r
+print((max(rr - ll + 1, 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:

import numpy as np

n = int(eval(input()))

input_X = [[int(i) for i in input().split()] for i in range(n)]

X = np.array(input_X)

pre_t = 0

pre_x = 0

pre_y = 0

for i in range(n):

    x_move = abs(X[i][1] - pre_x)

    y_move = abs(X[i][2] - pre_y)

    xy_sum = x_move + y_move

    spend_time = X[i][0]-pre_t

    if xy_sum%2 == spend_time%2 and spend_time >= xy_sum:

        pre_t = X[i][0]

        pre_x = X[i][1]

        pre_y = X[i][2]

        if i+1 == n:

            print('Yes')

        else:

            continue

    else:

        print('No')

        break

# optimized version of the same code:

# C

import copy

n = int(eval(input()))

preX = [0,0,0]

ans = True

for i in range(n):

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

    dt = curX[0] - preX[0]

    dx = abs(curX[1] - preX[1])

    dy = abs(curX[2] - preX[2])

    if dt < dx + dy  or (dt % 2) != ((dx + dy) % 2):

        ans = False

    preX = copy.copy(curX)

if ans:

    print('Yes')

else:

    print('No')

import numpy as np

n = int(eval(input()))
input_X = [[int(i) for i in input().split()] for i in range(n)]
X = np.array(input_X)
pre_t = 0
pre_x = 0
pre_y = 0
for i in range(n):
    x_move = abs(X[i][1] - pre_x)
    y_move = abs(X[i][2] - pre_y)
    xy_sum = x_move + y_move
    spend_time = X[i][0] - pre_t
    if xy_sum % 2 == spend_time % 2 and spend_time >= xy_sum:
        pre_t = X[i][0]
        pre_x = X[i][1]
        pre_y = X[i][2]
        if i + 1 == n:
            print("Yes")
        else:
            continue
    else:
        print("No")
        break

# C
import copy

n = int(eval(input()))
preX = [0, 0, 0]
ans = True
for i in range(n):
    curX = list(map(int, input().split()))
    dt = curX[0] - preX[0]
    dx = abs(curX[1] - preX[1])
    dy = abs(curX[2] - preX[2])
    if dt < dx + dy or (dt % 2) != ((dx + dy) % 2):
        ans = False
    preX = copy.copy(curX)
if ans:
    print("Yes")
else:
    print("No")

-input_X = [[int(i) for i in input().split()] for i in range(n)]

-    if xy_sum % 2 == spend_time % 2 and spend_time >= xy_sum:

+    curX = 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:

from collections import deque

K = int(eval(input()))

G = [[] for i in range(K)]

for n in range(K):

    G[n].append([(n + 1) % K, 1])

    G[n].append([(10 * n) % K, 0])

que = deque([[1, 1]])

dist = [float('inf')] * K

while que:

    node, cost = que.pop()

    dist[node] = min(cost, dist[node])

    for e, e_cost in G[node]:

        if dist[e] != float('inf'):

            continue

        if e_cost == 0:

            que.append([e, cost + 0])

        if e_cost == 1:

            que.appendleft([e, cost + 1])

print((dist[0]))

# optimized version of the same code:

from collections import deque

K = int(eval(input()))

G = [[] for i in range(K)]

for i in range(K):

    G[i].append(((10 * i) % K, 0))

    G[i].append(((i + 1) % K, 1))

dist = [float('inf')] * K

dist[1] = 1

que = deque()

que.append(1)

while que:

    n = que.pop()

    for v, c in G[n]:

        if dist[v] > dist[n] + c:

            dist[v] = dist[n] + c

            if c == 0:

                que.append(v)

            else:

                que.appendleft(v)

print((dist[0]))

from collections import deque

K = int(eval(input()))
G = [[] for i in range(K)]
for n in range(K):
    G[n].append([(n + 1) % K, 1])
    G[n].append([(10 * n) % K, 0])
que = deque([[1, 1]])
dist = [float("inf")] * K
while que:
    node, cost = que.pop()
    dist[node] = min(cost, dist[node])
    for e, e_cost in G[node]:
        if dist[e] != float("inf"):
            continue
        if e_cost == 0:
            que.append([e, cost + 0])
        if e_cost == 1:
            que.appendleft([e, cost + 1])
print((dist[0]))

from collections import deque

K = int(eval(input()))
G = [[] for i in range(K)]
for i in range(K):
    G[i].append(((10 * i) % K, 0))
    G[i].append(((i + 1) % K, 1))
dist = [float("inf")] * K
dist[1] = 1
que = deque()
que.append(1)
while que:
    n = que.pop()
    for v, c in G[n]:
        if dist[v] > dist[n] + c:
            dist[v] = dist[n] + c
            if c == 0:
                que.append(v)
            else:
                que.appendleft(v)
print((dist[0]))

-            que.appendleft([e, cost + 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 fractions

def lcm(x, y):

    return (x * y) // fractions.gcd(x, y)

N = int(eval(input()))

print((lcm(N, 2)))

# optimized version of the same code:

N = int(eval(input()))

if N % 2 == 0:

    print(N)

else:

    print((2 * N))

-    return (x * y) // fractions.gcd(x, y)


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(x) for x in input().split()]

L = [[int (y) for y in input().split()] for _ in range(M)]

L = sum(L, [])

for i in np.arange(1, N+1):

    print((L.count(i)))

# optimized version of the same code:

N, M = [int(x) for x in input().split()]

L = [[int (y) for y in input().split()] for _ in range(M)]

L = sum(L, [])

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

    print((L.count(i)))

import numpy as np

N, M = [int(x) for x in input().split()]
L = [[int(y) for y in input().split()] for _ in range(M)]
L = sum(L, [])
for i in np.arange(1, N + 1):
    print((L.count(i)))

N, M = [int(x) for x in input().split()]
L = [[int(y) for y in input().split()] for _ in range(M)]
L = sum(L, [])
for i in range(1, N + 1):
    print((L.count(i)))

-import numpy as np
-for i in np.arange(1, N + 1):
+for i in range(1, 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:

import numpy as np

def main():

    N = int(eval(input()))

    INF = 10**6 + 100

    x = np.arange(1,INF,dtype=np.int64)

    div = x[N % x == 0]

    #print(div)

    #print(N // div)

    ans = (div + N//div).min() - 2

    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

from math import sqrt

def divisor_enumeration(n):

    div = []

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

        if n % i == 0:

            if n // i != i:

                div.append((i, n // i))

            else:

                div.append((i, i))

    return div

def main():

    N = int(readline())

    d = divisor_enumeration(N)

    ans = 10**15

    for x, y in d:

        ans = min(ans, x + y - 2)

    print(ans)

if __name__ == "__main__":

    main()

import numpy as np

def main():
    N = int(eval(input()))
    INF = 10**6 + 100
    x = np.arange(1, INF, dtype=np.int64)
    div = x[N % x == 0]
    # print(div)
    # print(N // div)
    ans = (div + N // div).min() - 2
    print(ans)

if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from math import sqrt

def divisor_enumeration(n):
    div = []
    for i in range(1, int(sqrt(n)) + 1):
        if n % i == 0:
            if n // i != i:
                div.append((i, n // i))
            else:
                div.append((i, i))
    return div

def main():
    N = int(readline())
    d = divisor_enumeration(N)
    ans = 10**15
    for x, y in d:
        ans = min(ans, x + y - 2)
    print(ans)

if __name__ == "__main__":
    main()

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

+                div.append((i, n // i))

-    x = np.arange(1, INF, dtype=np.int64)


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 factorial as fac

S = int(eval(input()))

ans = 0

if S == 1 or S == 2:

  print((0))

elif S == 3:

  print((1))

else:

  for k in range(1,S):

    if S-2*k-1 >= 0 and S-3*k >= 0:

      ans += fac(S-2*k-1)//(fac(k-1)*fac(S-3*k))

  print((ans%1000000007))

# optimized version of the same code:

from math import factorial as fac

S = int(eval(input()))
ans = 0
if S == 1 or S == 2:
    print((0))
elif S == 3:
    print((1))
else:
    for k in range(1, S):
        if S - 2 * k - 1 >= 0 and S - 3 * k >= 0:
            ans += fac(S - 2 * k - 1) // (fac(k - 1) * fac(S - 3 * k))
    print((ans % 1000000007))


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 defaultdict

from scipy.misc import comb

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

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

B = [0] * N

B[0] = A[0]

for i in range(1, N):

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

B = [0] + B

c = defaultdict(int)

for i in range(N + 1):

    c[B[i] % M] += 1

ans = 0

for k, v in list(c.items()):

    if v >= 2:

        ans += comb(v, 2, exact=True)

print(ans)

# optimized version of the same code:

from collections import defaultdict

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

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

B = [0] * N

B[0] = A[0]

for i in range(1, N):

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

B = [0] + B

c = defaultdict(int)

for i in range(N + 1):

    c[B[i] % M] += 1

ans = 0

for k, v in list(c.items()):

    if v >= 2:

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

print(ans)

-from scipy.misc import comb
-        ans += comb(v, 2, exact=True)
+        ans += v * (v - 1) // 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:

import sys, re

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd

from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from bisect import bisect, bisect_left

from heapq import heappush, heappop

from functools import reduce, lru_cache

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

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

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

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

def ZIP(n): return list(zip(*(MAP() for _ in range(n))))

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

mod = 10 ** 9 + 7

S = INT()

@lru_cache(maxsize=None)

def rec(x):

    if x == 0: return 1

    ret = 0

    for i in range(x-2):

        ret += rec(i)

        ret %= mod

    return ret

print((rec(S)))

# optimized version of the same code:

import sys, re

from collections import deque, defaultdict, Counter

from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd

from itertools import accumulate, permutations, combinations, product, groupby, combinations_with_replacement

from operator import itemgetter, mul

from copy import deepcopy

from string import ascii_lowercase, ascii_uppercase, digits

from bisect import bisect, bisect_left

from heapq import heappush, heappop

from functools import reduce, lru_cache

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

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

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

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

def ZIP(n): return list(zip(*(MAP() for _ in range(n))))

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

mod = 10 ** 9 + 7

S = INT()

@lru_cache(maxsize=None)

def rec(x):

    if x == 0: return 1

    ret = 0

    if x >= 3:

        return (rec(x-1)+rec(x-3))%mod

    else:

        return 0

print((rec(S)))

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
    accumulate,
    permutations,
    combinations,
    product,
    groupby,
    combinations_with_replacement,
)
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce, lru_cache

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

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

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

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

def ZIP(n):
    return list(zip(*(MAP() for _ in range(n))))

sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7
S = INT()

@lru_cache(maxsize=None)
def rec(x):
    if x == 0:
        return 1
    ret = 0
    for i in range(x - 2):
        ret += rec(i)
        ret %= mod
    return ret

print((rec(S)))

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians, gcd
from itertools import (
    accumulate,
    permutations,
    combinations,
    product,
    groupby,
    combinations_with_replacement,
)
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from heapq import heappush, heappop
from functools import reduce, lru_cache

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

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

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

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

def ZIP(n):
    return list(zip(*(MAP() for _ in range(n))))

sys.setrecursionlimit(10**9)
INF = float("inf")
mod = 10**9 + 7
S = INT()

@lru_cache(maxsize=None)
def rec(x):
    if x == 0:
        return 1
    ret = 0
    if x >= 3:
        return (rec(x - 1) + rec(x - 3)) % mod
    else:
        return 0

print((rec(S)))

+        return (rec(x - 1) + rec(x - 3)) % 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

# A,B,Cの値の獲得

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

# numリストの最大値を10倍

num[num.index(max(num))] = max(num) * 10

# npで要素の和を計算し、出力

print((np.sum(num)))

# optimized version of the same code:

# A,B,Cの値の獲得

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

# numリストの最大値を10倍

num[num.index(max(num))] *= 10

# npで要素の和を計算し、出力

print((sum(num)))

-num[num.index(max(num))] = max(num) * 10