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

n,*t=list(map(int,open(0).read().split()))

con=[[] for _ in range(n)]

dist_f_k=[0]*n

for a,b,c in zip(t[:3*n-3:3],t[1::3],t[2::3]):

	con[a-1].append((b-1,c))

	con[b-1].append((a-1,c))

k=t[3*n-2]

que=deque([k-1])

while que:

	cur=que.popleft()

	for nxt,dd in con[cur]:

		if dist_f_k[nxt]==0 and nxt!=k-1:

			que.append(nxt)

			dist_f_k[nxt]=dist_f_k[cur]+dd

for x,y in zip(t[3*n-1::2],t[3*n::2]):

	print((dist_f_k[x-1]+dist_f_k[y-1]))

# optimized version of the same code:

def solve():

	from collections import deque

	n,*t=list(map(int,open(0).read().split()))

	con=[[] for _ in range(n)]

	dist_f_k=[0]*n

	l1,l2=t[:3*n-3],t[3*n-1:]

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

		con[a-1].append((b-1,c))

		con[b-1].append((a-1,c))

	k=t[3*n-2]

	que=deque([k-1])

	while que:

		cur=que.popleft()

		for nxt,dd in con[cur]:

			if dist_f_k[nxt]==0 and nxt!=k-1:

				que.append(nxt)

				dist_f_k[nxt]=dist_f_k[cur]+dd

	for x,y in zip(*[iter(l2)]*2):

		print((dist_f_k[x-1]+dist_f_k[y-1]))

if __name__=="__main__":

	solve()

from collections import deque

n, *t = list(map(int, open(0).read().split()))
con = [[] for _ in range(n)]
dist_f_k = [0] * n
for a, b, c in zip(t[: 3 * n - 3 : 3], t[1::3], t[2::3]):
    con[a - 1].append((b - 1, c))
    con[b - 1].append((a - 1, c))
k = t[3 * n - 2]
que = deque([k - 1])
while que:
    cur = que.popleft()
    for nxt, dd in con[cur]:
        if dist_f_k[nxt] == 0 and nxt != k - 1:
            que.append(nxt)
            dist_f_k[nxt] = dist_f_k[cur] + dd
for x, y in zip(t[3 * n - 1 :: 2], t[3 * n :: 2]):
    print((dist_f_k[x - 1] + dist_f_k[y - 1]))

def solve():
    from collections import deque

    n, *t = list(map(int, open(0).read().split()))
    con = [[] for _ in range(n)]
    dist_f_k = [0] * n
    l1, l2 = t[: 3 * n - 3], t[3 * n - 1 :]
    for a, b, c in zip(*[iter(l1)] * 3):
        con[a - 1].append((b - 1, c))
        con[b - 1].append((a - 1, c))
    k = t[3 * n - 2]
    que = deque([k - 1])
    while que:
        cur = que.popleft()
        for nxt, dd in con[cur]:
            if dist_f_k[nxt] == 0 and nxt != k - 1:
                que.append(nxt)
                dist_f_k[nxt] = dist_f_k[cur] + dd
    for x, y in zip(*[iter(l2)] * 2):
        print((dist_f_k[x - 1] + dist_f_k[y - 1]))

if __name__ == "__main__":
    solve()

-n, *t = list(map(int, open(0).read().split()))

-        if dist_f_k[nxt] == 0 and nxt != k - 1:

-            dist_f_k[nxt] = dist_f_k[cur] + dd

-    print((dist_f_k[x - 1] + dist_f_k[y - 1]))

+    n, *t = list(map(int, open(0).read().split()))

+    for a, b, c in zip(*[iter(l1)] * 3):

+            if dist_f_k[nxt] == 0 and nxt != k - 1:

+                dist_f_k[nxt] = dist_f_k[cur] + dd

+        print((dist_f_k[x - 1] + dist_f_k[y - 1]))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

S = eval(input())

T = eval(input())

N = len(S)

cnt = 0

for i in range(N):

    cnt += (S[i] != T[i])

print(cnt)

# optimized version of the same code:

S = eval(input())

T = eval(input())

cnt = 0

for i in range(len(S)):

    cnt += (S[i] != T[i])

print(cnt)

S = eval(input())
T = eval(input())
N = len(S)
cnt = 0
for i in range(N):
    cnt += S[i] != T[i]
print(cnt)

S = eval(input())
T = eval(input())
cnt = 0
for i in range(len(S)):
    cnt += S[i] != T[i]
print(cnt)

-N = len(S)
-for i in range(N):
+for i in range(len(S)):


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

MOD = 10**9+7

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

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

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

def prepare(n, mod):

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

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

def cmb(n, r, mod):

    if n < 0 or r < 0:

        return 0

    if r > n:

        return 0

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

def prime_factorization(n):

    d = []

    i, e = 2, 0  # factor, exponent

    while i * i <= n:

        while n % i == 0:

            n //= i

            e += 1

        if e > 0:

            d.append((i, e))

        i += 1

        e = 0

    if n > 1:

        d.append((n, 1))

    return d

def main():

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

    prepare(N+100, MOD)

    d = prime_factorization(M)

    ans = 1

    for i, e in d:

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

        ans %= MOD

    print(ans)

if __name__ == "__main__":

    main()

# optimized version of the same code:

# AC: msec(Python3)

from math import factorial

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

MOD = 10**9+7

def cmb(n, r):

    if n < 0 or r < 0:

        return 0

    if r > n:

        return 0

    r = min(n-r, r)

    res = 1

    for i in range(r):

        res *= n - i

    return res // factorial(r)

def prime_factorization(n):

    d = []

    i, e = 2, 0  # factor, exponent

    while i * i <= n:

        while n % i == 0:

            n //= i

            e += 1

        if e > 0:

            d.append((i, e))

        i += 1

        e = 0

    if n > 1:

        d.append((n, 1))

    return d

def main():

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

    d = prime_factorization(M)

    ans = 1

    for i, e in d:

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

        ans %= MOD

    print(ans)

if __name__ == "__main__":

    main()

import sys

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

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

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

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

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

if __name__ == "__main__":
    main()

# AC: msec(Python3)
from math import factorial
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
MOD = 10**9 + 7

def cmb(n, r):
    if n < 0 or r < 0:
        return 0
    if r > n:
        return 0
    r = min(n - r, r)
    res = 1
    for i in range(r):
        res *= n - i
    return res // factorial(r)

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

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

if __name__ == "__main__":
    main()

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

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

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


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

X = int(eval(input()))

#print(X)

n = X

div = []

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

  if n % i == 0:

    div.append(i)

    if i != n // i:

      div.append(n//i)

#print(div)

for i in div:

  for a in range(0, 10001):

    b = a - i

    #print(a, b)

    if a**5 - b**5 == X:

      print((a, b))

      break

  else:

    continue

  break

# optimized version of the same code:

X = int(eval(input()))

#print(X)

n = X

div = []

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

  if n % i == 0:

    div.append(i)

    if i != n // i:

      div.append(n//i)

#print(div)

for i in div:

  for a in range(0, 1001):

    b = a - i

    #print(a, b)

    if a**5 - b**5 == X:

      print((a, b))

      break

  else:

    continue

  break

X = int(eval(input()))
# print(X)
n = X
div = []
for i in range(1, int(n**0.5) + 1):
    if n % i == 0:
        div.append(i)
        if i != n // i:
            div.append(n // i)
# print(div)
for i in div:
    for a in range(0, 10001):
        b = a - i
        # print(a, b)
        if a**5 - b**5 == X:
            print((a, b))
            break
    else:
        continue
    break

X = int(eval(input()))
# print(X)
n = X
div = []
for i in range(1, int(n**0.5) + 1):
    if n % i == 0:
        div.append(i)
        if i != n // i:
            div.append(n // i)
# print(div)
for i in div:
    for a in range(0, 1001):
        b = a - i
        # print(a, b)
        if a**5 - b**5 == X:
            print((a, b))
            break
    else:
        continue
    break

-    for a in range(0, 10001):
+    for a in range(0, 1001):


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 = [ int( val ) for val in input( ).split( " " ) ]

ps = [0]*n

t = [0]*n

for i in range( n ):

	ps[i], t[i] = input( ).split( " " )

output = []

qsum = 0

while t:

	psi = ps.pop( 0 )

	ti = int( t.pop( 0 ) )

	if ti <= q:

		qsum += ti

		output.append( psi+" "+str( qsum ) )

	else:

		t.append( ti - q )

		ps.append( psi )

		qsum += q

print(( "\n".join( output ) ))

# optimized version of the same code:

n, q = [ int( val ) for val in input( ).split( " " ) ]

ps = [0]*n

t = [0]*n

for i in range( n ):

    ps[i], t[i] = input( ).split( " " )

output = []

qsum = 0

while t:

    psi = ps.pop( 0 )

    ti = int( t.pop( 0 ) )

    if ti <= q:

        qsum += ti

        output.append( "".join( ( psi, " ", str( qsum ) ) ) )

    else:

        t.append( ti - q )

        ps.append( psi )

        qsum += q

print(( "\n".join( output ) ))

n, q = [int(val) for val in input().split(" ")]
ps = [0] * n
t = [0] * n
for i in range(n):
    ps[i], t[i] = input().split(" ")
output = []
qsum = 0
while t:
    psi = ps.pop(0)
    ti = int(t.pop(0))
    if ti <= q:
        qsum += ti
        output.append(psi + " " + str(qsum))
    else:
        t.append(ti - q)
        ps.append(psi)
        qsum += q
print(("\n".join(output)))

n, q = [int(val) for val in input().split(" ")]
ps = [0] * n
t = [0] * n
for i in range(n):
    ps[i], t[i] = input().split(" ")
output = []
qsum = 0
while t:
    psi = ps.pop(0)
    ti = int(t.pop(0))
    if ti <= q:
        qsum += ti
        output.append("".join((psi, " ", str(qsum))))
    else:
        t.append(ti - q)
        ps.append(psi)
        qsum += q
print(("\n".join(output)))

-        output.append(psi + " " + str(qsum))

+        output.append("".join((psi, " ", str(qsum))))


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

buf = sys.stdin.buffer

H,W = list(map(int,buf.readline().split()))

grid = np.frombuffer(buf.read(H*(W+1)), dtype='S1').reshape((H,W+1))

grid = grid[:,:-1]

select_col = (grid == b'#').any(axis = 0)

select_row = (grid == b'#').any(axis = 1)

grid = grid[select_row, :]

grid = grid[:, select_col]

grid = grid.astype(str)

print(('\n'.join(''.join(row) for row in grid)))

# optimized version of the same code:

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

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

A = list([a for a in A if any(x=='#' for x in a)])

A = list([a for a in zip(*A) if any(x=='#' for x in a)])

for a in zip(*A):

  print((''.join(a)))

import numpy as np
import sys

buf = sys.stdin.buffer
H, W = list(map(int, buf.readline().split()))
grid = np.frombuffer(buf.read(H * (W + 1)), dtype="S1").reshape((H, W + 1))
grid = grid[:, :-1]
select_col = (grid == b"#").any(axis=0)
select_row = (grid == b"#").any(axis=1)
grid = grid[select_row, :]
grid = grid[:, select_col]
grid = grid.astype(str)
print(("\n".join("".join(row) for row in grid)))

H, W = list(map(int, input().split()))
A = [eval(input()) for _ in range(H)]
A = list([a for a in A if any(x == "#" for x in a)])
A = list([a for a in zip(*A) if any(x == "#" for x in a)])
for a in zip(*A):
    print(("".join(a)))

-H, W = list(map(int, buf.readline().split()))

-grid = np.frombuffer(buf.read(H * (W + 1)), dtype="S1").reshape((H, W + 1))

-select_col = (grid == b"#").any(axis=0)

-select_row = (grid == b"#").any(axis=1)

-print(("\n".join("".join(row) for row in grid)))

+A = list([a for a in A if any(x == "#" for x in a)])

+A = list([a for a in zip(*A) if any(x == "#" for x in 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,K = list(map(int, input().split(' ')))

a=list(range(1,N+1))

for i in range(K):

  count=int(eval(input()))

  b=input().split(' ')

  for j in range(count):

    if int(b[j]) in a:

      a.remove(int(b[j]))

print((len(a)))

# optimized version of the same code:

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

a=list(range(1,N+1))

for i in range(K):

  count=int(eval(input()))

  b=[int(x.strip()) for x in input().split(' ')]

  for j in range(count):

    if b[j] in a:

      a.remove(b[j])

print((len(a)))

N, K = list(map(int, input().split(" ")))
a = list(range(1, N + 1))
for i in range(K):
    count = int(eval(input()))
    b = input().split(" ")
    for j in range(count):
        if int(b[j]) in a:
            a.remove(int(b[j]))
print((len(a)))

N, K = list(map(int, input().split(" ")))
a = list(range(1, N + 1))
for i in range(K):
    count = int(eval(input()))
    b = [int(x.strip()) for x in input().split(" ")]
    for j in range(count):
        if b[j] in a:
            a.remove(b[j])
print((len(a)))

+    b = [int(x.strip()) 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:

res = []

while True:

    s = eval(input())

    if s == '0':

        break

    res.append(sum([int(x) for x in s]))

for e in res:

    print(e)

# optimized version of the same code:

def sum_of_numbers(n):

    '''

    (* int -> int *)

    '''

    res = [int(n) for n in list(str(n))]

    return sum(res)

if __name__ == "__main__":

    while True:

        n = eval(input())

        if n == '0':

            break

        print((sum_of_numbers(n)))

res = []
while True:
    s = eval(input())
    if s == "0":
        break
    res.append(sum([int(x) for x in s]))
for e in res:
    print(e)

def sum_of_numbers(n):
    """
    (* int -> int *)
    """
    res = [int(n) for n in list(str(n))]
    return sum(res)

if __name__ == "__main__":
    while True:
        n = eval(input())
        if n == "0":
            break
        print((sum_of_numbers(n)))

-    res.append(sum([int(x) for x in s]))

+    res = [int(n) for n in list(str(n))]


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

n=int(eval(input()))

x=1

for i in range(n):

    x*=(i+1)

    if x>10**9+7:

        x=x%(10**9+7)

print(x)

#import numpy as np

#n=int(input())

#print(np.prod([i+1 for i in range(n)]))

#print(np.prod([i+1 for i in range(n)])%((10**9)+7))

#オーバーフロー？

# optimized version of the same code:

power=1

n=int(eval(input()))

mod=10**9+7

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

    power*=i

    power%=mod

    #print(power)

print(power)

n = int(eval(input()))
x = 1
for i in range(n):
    x *= i + 1
    if x > 10**9 + 7:
        x = x % (10**9 + 7)
print(x)
# import numpy as np
# n=int(input())
# print(np.prod([i+1 for i in range(n)]))
# print(np.prod([i+1 for i in range(n)])%((10**9)+7))
# オーバーフロー？

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

-# print(np.prod([i+1 for i in range(n)]))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import re;print((max(list(map(len,re.split('[^ACGT]',eval(input())))))))

# optimized version of the same code:

p=m=0

for c in eval(input()):p=-~p*(c in'ATGC');m=max(m,p)

print(m)

import re

print((max(list(map(len, re.split("[^ACGT]", eval(input())))))))

p = m = 0
for c in eval(input()):
    p = -~p * (c in "ATGC")
    m = max(m, p)
print(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:

X=int(eval(input()))

for i in range(200):

    for j in range(-200,200):

        if X == (i**5-j**5):

            print((i, j))

            exit()

# optimized version of the same code:

X=int(eval(input()))

for i in range(120):

    for j in range(-120,120):

        if X == (i**5-j**5):

            print((i, j))

            exit()

X = int(eval(input()))
for i in range(200):
    for j in range(-200, 200):
        if X == (i**5 - j**5):
            print((i, j))
            exit()

X = int(eval(input()))
for i in range(120):
    for j in range(-120, 120):
        if X == (i**5 - j**5):
            print((i, j))
            exit()

-for i in range(200):
-    for j in range(-200, 200):
+for i in range(120):
+    for j in range(-120, 120):


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 os

import sys

import numpy as np

from scipy.sparse import csr_matrix

from scipy.sparse.csgraph import connected_components

if os.getenv("LOCAL"):

    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(2147483647)

INF = float("inf")

IINF = 10 ** 18

MOD = 10 ** 9 + 7

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

A, B = list(zip(*[list(map(int, sys.stdin.readline().split())) for _ in range(M)]))

A = np.array(A) - 1

B = np.array(B) - 1

def is_bridge(i):

    a = np.concatenate([A[:i], A[i + 1:]])

    b = np.concatenate([B[:i], B[i + 1:]])

    graph = csr_matrix(([True] * (M - 1), (a, b)), shape=(N, N))

    _, components = connected_components(graph, directed=False)

    return components.max() >= 1

ans = 0

for i in range(M):

    ans += is_bridge(i)

print(ans)

# optimized version of the same code:

import os

import sys

if os.getenv("LOCAL"):

    sys.stdin = open("_in.txt", "r")

sys.setrecursionlimit(10 ** 9)

INF = float("inf")

IINF = 10 ** 18

MOD = 10 ** 9 + 7

# MOD = 998244353

def enumerate_bridges(graph):

    """

    橋を列挙する

    http://nupioca.hatenadiary.jp/entry/2013/11/03/200006

    :param list of (list of int) graph:

    """

    N = len(graph)

    ret_bridges = []

    pres = [-1] * N

    lows = [-1] * N

    order = -1

    for v in range(N):

        if pres[v] >= 0:

            continue

        edges = [(None, v, True)]

        while edges:

            v, u, forward = edges.pop()

            if forward:

                if pres[u] >= 0:

                    # もう来たことがある

                    lows[v] = min(lows[v], lows[u])

                    continue

                edges.append((v, u, False))

                parent, v = v, u

                order += 1

                pres[v] = lows[v] = order

                for u in graph[v]:

                    if u == parent:

                        continue

                    edges.append((v, u, True))

            else:

                if v is None:

                    continue

                if lows[u] == pres[u]:

                    ret_bridges.append((v, u))

                lows[v] = min(lows[v], lows[u])

    return ret_bridges

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

AB = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]

graph = [[] for _ in range(N + 1)]

for a, b in AB:

    graph[a].append(b)

    graph[b].append(a)

bridges = enumerate_bridges(graph)

print((len(bridges)))

import os
import sys
import numpy as np
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(2147483647)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
N, M = list(map(int, sys.stdin.readline().split()))
A, B = list(zip(*[list(map(int, sys.stdin.readline().split())) for _ in range(M)]))
A = np.array(A) - 1
B = np.array(B) - 1

def is_bridge(i):
    a = np.concatenate([A[:i], A[i + 1 :]])
    b = np.concatenate([B[:i], B[i + 1 :]])
    graph = csr_matrix(([True] * (M - 1), (a, b)), shape=(N, N))
    _, components = connected_components(graph, directed=False)
    return components.max() >= 1

ans = 0
for i in range(M):
    ans += is_bridge(i)
print(ans)

import os
import sys

if os.getenv("LOCAL"):
    sys.stdin = open("_in.txt", "r")
sys.setrecursionlimit(10**9)
INF = float("inf")
IINF = 10**18
MOD = 10**9 + 7
# MOD = 998244353
def enumerate_bridges(graph):
    """
    橋を列挙する
    http://nupioca.hatenadiary.jp/entry/2013/11/03/200006
    :param list of (list of int) graph:
    """
    N = len(graph)
    ret_bridges = []
    pres = [-1] * N
    lows = [-1] * N
    order = -1
    for v in range(N):
        if pres[v] >= 0:
            continue
        edges = [(None, v, True)]
        while edges:
            v, u, forward = edges.pop()
            if forward:
                if pres[u] >= 0:
                    # もう来たことがある
                    lows[v] = min(lows[v], lows[u])
                    continue
                edges.append((v, u, False))
                parent, v = v, u
                order += 1
                pres[v] = lows[v] = order
                for u in graph[v]:
                    if u == parent:
                        continue
                    edges.append((v, u, True))
            else:
                if v is None:
                    continue
                if lows[u] == pres[u]:
                    ret_bridges.append((v, u))
                lows[v] = min(lows[v], lows[u])
    return ret_bridges

N, M = list(map(int, sys.stdin.buffer.readline().split()))
AB = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]
graph = [[] for _ in range(N + 1)]
for a, b in AB:
    graph[a].append(b)
    graph[b].append(a)
bridges = enumerate_bridges(graph)
print((len(bridges)))

-from scipy.sparse.csgraph import connected_components

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

-A, B = list(zip(*[list(map(int, sys.stdin.readline().split())) for _ in range(M)]))

+    http://nupioca.hatenadiary.jp/entry/2013/11/03/200006

+    :param list of (list of int) graph:

+            v, u, forward = edges.pop()

+                    # もう来たことがある

+                    lows[v] = min(lows[v], lows[u])

+                edges.append((v, u, False))

+                pres[v] = lows[v] = order

+                    edges.append((v, u, True))

+                    ret_bridges.append((v, u))

+                lows[v] = min(lows[v], lows[u])

-    a = np.concatenate([A[:i], A[i + 1 :]])

-    b = np.concatenate([B[:i], B[i + 1 :]])

-    graph = csr_matrix(([True] * (M - 1), (a, b)), shape=(N, N))

-    _, components = connected_components(graph, directed=False)

+N, M = list(map(int, sys.stdin.buffer.readline().split()))

+AB = [list(map(int, sys.stdin.buffer.readline().split())) for _ in range(M)]


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

n = int(eval(input()))

felicidade = []

for x in range(n):

    felicidade.append(list(map(int,input().split())))

DP = [0,0,0]

if n == 1:

    print((max(felicidade[0])))

else:

    for x in range(3):

        DP[x] = felicidade[0][x]

    for dia in range(1,n):

        m = [0] * 3

        for x  in range(3):#As duas possíveis escolhas são x e y

            for y  in range(3):

                if x != y: #Se elas forem diferentes

                    m[x] = max(m[x], DP[y] + felicidade[dia][x])

        DP = m

    print((max(DP)))

# optimized version of the same code:

nDays = int(eval(input()))

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

for i in range(nDays - 1):

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

    tomorrow[0] += max(today[1], today[2])

    tomorrow[1] += max(today[0], today[2])

    tomorrow[2] += max(today[0], today[1])

    today = tomorrow

print((max(today)))

n = int(eval(input()))
felicidade = []
for x in range(n):
    felicidade.append(list(map(int, input().split())))
DP = [0, 0, 0]
if n == 1:
    print((max(felicidade[0])))
else:
    for x in range(3):
        DP[x] = felicidade[0][x]
    for dia in range(1, n):
        m = [0] * 3
        for x in range(3):  # As duas possíveis escolhas são x e y
            for y in range(3):
                if x != y:  # Se elas forem diferentes
                    m[x] = max(m[x], DP[y] + felicidade[dia][x])
        DP = m
    print((max(DP)))

-    felicidade.append(list(map(int, input().split())))

-        for x in range(3):  # As duas possíveis escolhas são x e y

-                if x != y:  # Se elas forem diferentes

-                    m[x] = max(m[x], DP[y] + felicidade[dia][x])

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

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

+    tomorrow[0] += max(today[1], today[2])

+    tomorrow[1] += max(today[0], today[2])

+    tomorrow[2] += max(today[0], today[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 math

n=int(eval(input()))

waru=10**9+7

li=[]

li2=[]

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

    tmp=math.factorial(n)

    flag=1

    for j in range(len(li)):

        if i%li[j]==0:

            flag=0

            break

    if flag==1:

        li.append(i)

        li2.append(0)

        while tmp%i==0:

            li2[len(li)-1]+=1

            tmp=tmp//i

ans=1

# print(li)

# print(li2)

for i in range(len(li2)):

    ans*=li2[i]+1

print((ans%waru))

# optimized version of the same code:

import sys

from collections import *

import heapq

import math

import bisect

from itertools import permutations,accumulate,combinations,product

from fractions import gcd

def input():

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

def ruiseki(lst):

    return [0]+list(accumulate(lst))

mod=pow(10,9)+7

al=[chr(ord('a') + i) for i in range(26)]

def factorization(n):

    arr = []

    temp = n

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

        if temp%i==0:

            cnt=0

            while temp%i==0:

                cnt+=1

                temp //= i

            arr.append([i, cnt])

    if temp!=1:

        arr.append([temp, 1])

    if arr==[]:

        arr.append([n, 1])

    return arr

n=int(eval(input()))

if n==1:

    print((1))

    exit()

d=defaultdict(int)

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

    tmp=factorization(i)

    for j in tmp:

        yaku,ko=j

        d[yaku]+=ko

# print(d)

ans=1

for i in list(d.values()):

    ans*=i+1

    ans%=mod

print(ans)

import math

n = int(eval(input()))
waru = 10**9 + 7
li = []
li2 = []
for i in range(2, n + 1):
    tmp = math.factorial(n)
    flag = 1
    for j in range(len(li)):
        if i % li[j] == 0:
            flag = 0
            break
    if flag == 1:
        li.append(i)
        li2.append(0)
        while tmp % i == 0:
            li2[len(li) - 1] += 1
            tmp = tmp // i
ans = 1
# print(li)
# print(li2)
for i in range(len(li2)):
    ans *= li2[i] + 1
print((ans % waru))

import sys
from collections import *
import heapq
import math
import bisect
from itertools import permutations, accumulate, combinations, product
from fractions import gcd

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

def ruiseki(lst):
    return [0] + list(accumulate(lst))

mod = pow(10, 9) + 7
al = [chr(ord("a") + i) for i in range(26)]

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-(n**0.5) // 1)) + 1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i, cnt])
    if temp != 1:
        arr.append([temp, 1])
    if arr == []:
        arr.append([n, 1])
    return arr

n = int(eval(input()))
if n == 1:
    print((1))
    exit()
d = defaultdict(int)
for i in range(2, n + 1):
    tmp = factorization(i)
    for j in tmp:
        yaku, ko = j
        d[yaku] += ko
# print(d)
ans = 1
for i in list(d.values()):
    ans *= i + 1
    ans %= mod
print(ans)

+from itertools import permutations, accumulate, combinations, product

+al = [chr(ord("a") + i) for i in range(26)]


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 = [-1] + [int(eval(input())) for _ in range(m)] + [n + 1]

MOD = 10 ** 9 + 7

fib = [0, 1]

for i in range(100100):

	fib.append((fib[i] + fib[i + 1] % MOD))

res = 1

for i in range(m + 1):

	p, q = a[i], a[i + 1]

	res = (res * fib[q - p - 1]) % MOD

print(res)

# optimized version of the same code:

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

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

MOD = 10 ** 9 + 7

# broken[i] : i段目が壊れていたらTrue

broken = [False] * 100100

for i in a:

	broken[i] = True

# dp[i] : i段目に行く通り数

dp = [0] * 100100

# 0段目に行く方法は1通り

dp[0] = 1

# 1段目からn段目について調べる

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

	# 壊れてるなら

	if broken[i]:

		# その段には進めないので0通り

		dp[i] = 0

	# 壊れてないなら

	else:

		# i - 1段目から移動可能 (i - 1段目は, i == 0 のときにはないので分岐)

		if i > 0:

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

		# i - 2段目から移動可能 (i - 2段目は, i == 0, 1 のときにはないので分岐)

		if i > 1:

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

	dp[i] %= MOD

print((dp[n]))

n, m = list(map(int, input().split()))
a = [-1] + [int(eval(input())) for _ in range(m)] + [n + 1]
MOD = 10**9 + 7
fib = [0, 1]
for i in range(100100):
    fib.append((fib[i] + fib[i + 1] % MOD))
res = 1
for i in range(m + 1):
    p, q = a[i], a[i + 1]
    res = (res * fib[q - p - 1]) % MOD
print(res)

n, m = list(map(int, input().split()))
a = [int(eval(input())) for _ in range(m)]
MOD = 10**9 + 7
# broken[i] : i段目が壊れていたらTrue
broken = [False] * 100100
for i in a:
    broken[i] = True
# dp[i] : i段目に行く通り数
dp = [0] * 100100
# 0段目に行く方法は1通り
dp[0] = 1
# 1段目からn段目について調べる
for i in range(1, n + 1):
    # 壊れてるなら
    if broken[i]:
        # その段には進めないので0通り
        dp[i] = 0
    # 壊れてないなら
    else:
        # i - 1段目から移動可能 (i - 1段目は, i == 0 のときにはないので分岐)
        if i > 0:
            dp[i] += dp[i - 1]
        # i - 2段目から移動可能 (i - 2段目は, i == 0, 1 のときにはないので分岐)
        if i > 1:
            dp[i] += dp[i - 2]
    dp[i] %= MOD
print((dp[n]))

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

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

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

+# 0段目に行く方法は1通り

+# 1段目からn段目について調べる

+    # 壊れてるなら

+        # その段には進めないので0通り

+    # 壊れてないなら

+        # i - 1段目から移動可能 (i - 1段目は, i == 0 のときにはないので分岐)

+        # i - 2段目から移動可能 (i - 2段目は, i == 0, 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 = int(eval(input()))

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

ans = 0

check = [0]*30

for i in range(1, 31):

    check[i-1] = 2**i

for i in A:

    if i % 2 == 0:

        j = 0

        while check[j] <= i:

            if i % check[j] == 0:

                add = check[j]

            else:

                break

            j += 1

        ans += j

print(ans)

# optimized version of the same code:

N = int(eval(input()))

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

ans = 0

for i in a:

    while i % 2 == 0:

        i //= 2

        ans += 1

print(ans)

N = int(eval(input()))
A = [int(i) for i in input().split()]
ans = 0
check = [0] * 30
for i in range(1, 31):
    check[i - 1] = 2**i
for i in A:
    if i % 2 == 0:
        j = 0
        while check[j] <= i:
            if i % check[j] == 0:
                add = check[j]
            else:
                break
            j += 1
        ans += j
print(ans)

-A = [int(i) for i in input().split()]
+a = [int(i) for i in input().split()]
-check = [0] * 30
-for i in range(1, 31):
-    check[i - 1] = 2**i
-for i in A:
-    if i % 2 == 0:
-        j = 0
-        while check[j] <= i:
-            if i % check[j] == 0:
-                add = check[j]
-            else:
-                break
-            j += 1
-        ans += j
+for i in a:
+    while i % 2 == 0:
+        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, K = list(map(int, input().split()))

S = eval(input())

l = [[], []]

ans = []

k = [int(s) for s in S]

if k[0] == 0:

    l[1].append(0)

v0 = 1 if k[0] == 0 else 0

v1 = 1 if k[0] == 1 else 0

for i in range(1, N):

    if (k[i]==0) & (k[i-1]==0):

        v0 += 1

    elif (k[i]==1) & (k[i-1]==0):

        l[0].append(v0)

        v0 = 0

        v1 += 1

    elif (k[i]==0) & (k[i-1]==1):

        l[1].append(v1)

        v0 += 1

        v1 = 0

    else:

        v1 += 1

for i, v in enumerate([v0, v1]):

    if v > 0:

        l[i].append(v)

if k[0] == 0:

    l[1].append(0)

if len(l[0]) <= K:

    print(N)

else:

    l[0].extend(np.repeat(0,K+1))

    l[1].extend(np.repeat(0,K+1))

    a = sum(l[0][:K]) + sum(l[1][:K+1])

    ans.append(a)

    for i in range(1, len(l[0])-K-1):

        a -= l[0][i-1] + l[1][i-1]

        a += l[0][i+K-1] + l[1][i+K]

        ans.append(a)

    print((max(ans)))

# optimized version of the same code:

-    for i in range(1, len(l[0]) - 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 = int(eval(input()))

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

M = int(eval(input()))

p = []

x = []

ans = []

for i in range(M):

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

    ans.append(sum(T[:p-1])+x+sum(T[p:]))

for _ in ans:

    print(_)

# optimized version of the same code:

N = int(eval(input()))

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

M = int(eval(input()))

P, X, ans = [0]*M, [0]*M, []

base = sum(T)

for i in range(M):

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

    ans.append(base-T[P-1]+X)

for i in ans:

    print(i)

N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
p = []
x = []
ans = []
for i in range(M):
    p, x = list(map(int, input().split()))
    ans.append(sum(T[: p - 1]) + x + sum(T[p:]))
for _ in ans:
    print(_)

N = int(eval(input()))
T = list(map(int, input().split()))
M = int(eval(input()))
P, X, ans = [0] * M, [0] * M, []
base = sum(T)
for i in range(M):
    P, X = list(map(int, input().split()))
    ans.append(base - T[P - 1] + X)
for i in ans:
    print(i)

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

-    ans.append(sum(T[: p - 1]) + x + sum(T[p:]))

+    P, X = 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:

n=int(eval(input()))

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

S=[[0 for i in range(3)] for i in range(n)]

dp[0]=list(map(int,input().split()))

S[0]=dp[0].copy()

for i in range(1,n):

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

    for j in range(3):

        dp[i][j]=max(dp[i-1][j-1],dp[i-1][j-2])+S[i][j]

print((max(dp[n-1][0],dp[n-1][1],dp[n-1][2])))

#dp[i][j]=i番目にjを選んだ時の最大値(jはa,b,cに対応している。)

# optimized version of the same code:

n=int(eval(input()))

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

dp[0]=list(map(int,input().split()))

for i in range(1,n):

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

    for j in range(3):

        dp[i][j]=max(dp[i-1][j-1],dp[i-1][j-2])+S[j]

print((max(dp[n-1][0],dp[n-1][1],dp[n-1][2])))

#dp[i][j]=i番目にjを選んだ時の最大値(jはa,b,cに対応している。)

n = int(eval(input()))
dp = [[0 for i in range(3)] for i in range(n)]
S = [[0 for i in range(3)] for i in range(n)]
dp[0] = list(map(int, input().split()))
S[0] = dp[0].copy()
for i in range(1, n):
    S[i] = list(map(int, input().split()))
    for j in range(3):
        dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j - 2]) + S[i][j]
print((max(dp[n - 1][0], dp[n - 1][1], dp[n - 1][2])))
# dp[i][j]=i番目にjを選んだ時の最大値(jはa,b,cに対応している。)

n = int(eval(input()))
dp = [[0 for i in range(3)] for i in range(n)]
dp[0] = list(map(int, input().split()))
for i in range(1, n):
    S = list(map(int, input().split()))
    for j in range(3):
        dp[i][j] = max(dp[i - 1][j - 1], dp[i - 1][j - 2]) + S[j]
print((max(dp[n - 1][0], dp[n - 1][1], dp[n - 1][2])))
# dp[i][j]=i番目にjを選んだ時の最大値(jはa,b,cに対応している。)

-S = [[0 for i in range(3)] for i in range(n)]

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

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


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import numpy as np

N = int(eval(input()))

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

dp = np.zeros((N, 3), dtype=int)

for i in range(N):

    dp[i][0] = L[0][0] if i == 0 else max(dp[i-1][1]+L[i][0], dp[i-1][2]+L[i][0])

    dp[i][1] = L[0][1] if i == 0 else max(dp[i-1][0]+L[i][1], dp[i-1][2]+L[i][1])

    dp[i][2] = L[0][2] if i == 0 else max(dp[i-1][0]+L[i][2], dp[i-1][1]+L[i][2])

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

# optimized version of the same code:

N = int(eval(input()))

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

dp = [[0 for i in range(3)] for j in range(N+1)]

for i in range(N):

    dp[i+1][0] = max(dp[i][1]+abc[i][0], dp[i][2]+abc[i][0])

    dp[i+1][1] = max(dp[i][0]+abc[i][1], dp[i][2]+abc[i][1])

    dp[i+1][2] = max(dp[i][0]+abc[i][2], dp[i][1]+abc[i][2])

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

N = int(eval(input()))
abc = [list(map(int, input().split())) for i in range(N)]
dp = [[0 for i in range(3)] for j in range(N + 1)]
for i in range(N):
    dp[i + 1][0] = max(dp[i][1] + abc[i][0], dp[i][2] + abc[i][0])
    dp[i + 1][1] = max(dp[i][0] + abc[i][1], dp[i][2] + abc[i][1])
    dp[i + 1][2] = max(dp[i][0] + abc[i][2], dp[i][1] + abc[i][2])
print((max(dp[-1])))

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

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

+dp = [[0 for i in range(3)] for j 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:

import math

N = int(eval(input()))

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

# optimized version of the same code:

ans=1

n=int(eval(input()))

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

    ans*=i

    ans=ans%(10**9+7)

print(ans)

import math

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

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

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

def main():

    import math

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

    a=[]

    for i in range(M):

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

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

        c=0

        for j in range(len(tmpc)):

            c+=2**(tmpc[j]-1)

        tmp[1]=c

        a+=[tmp]

    dp=[[10**10 for j in range(2**N)] for i in range(M)]

    dp[0][0]=0

    dp[0][a[0][1]]=a[0][0]

    for i in range(1,M):

        dp[i]=dp[i-1]

        for j in range(2**N):

            z,p=a[i][0],a[i][1]

            q=j|p

            x=dp[i-1][j]+z

            if dp[i][q]>x: dp[i][q]=x

    ans=dp[M-1][2**N-1]

    print((ans if ans<10**10 else -1))

if __name__ == '__main__':

    main()

# optimized version of the same code:

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

L=2**n

cost=[0]+[10**8 for i in range(L-1)]

for i in range(m):

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

    c=sum([2**(int(i)-1) for i in input().split()])

    for j in range(L):

        q=j|c

        x=cost[j]+a

        if cost[q]>x:

            cost[q]=x

print((cost[L-1] if cost[L-1]<10**8 else -1))

def main():
    import math

    N, M = list(map(int, input().split()))
    a = []
    for i in range(M):
        tmp = list(map(int, input().split()))
        tmpc = list(map(int, input().split()))
        c = 0
        for j in range(len(tmpc)):
            c += 2 ** (tmpc[j] - 1)
        tmp[1] = c
        a += [tmp]
    dp = [[10**10 for j in range(2**N)] for i in range(M)]
    dp[0][0] = 0
    dp[0][a[0][1]] = a[0][0]
    for i in range(1, M):
        dp[i] = dp[i - 1]
        for j in range(2**N):
            z, p = a[i][0], a[i][1]
            q = j | p
            x = dp[i - 1][j] + z
            if dp[i][q] > x:
                dp[i][q] = x
    ans = dp[M - 1][2**N - 1]
    print((ans if ans < 10**10 else -1))

if __name__ == "__main__":
    main()

n, m = list(map(int, input().split()))
L = 2**n
cost = [0] + [10**8 for i in range(L - 1)]
for i in range(m):
    a, b = list(map(int, input().split()))
    c = sum([2 ** (int(i) - 1) for i in input().split()])
    for j in range(L):
        q = j | c
        x = cost[j] + a
        if cost[q] > x:
            cost[q] = x
print((cost[L - 1] if cost[L - 1] < 10**8 else -1))

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

-        tmp = list(map(int, input().split()))

-        tmpc = list(map(int, input().split()))

-    dp = [[10**10 for j in range(2**N)] for i in range(M)]

-    print((ans if ans < 10**10 else -1))

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

+    c = sum([2 ** (int(i) - 1) for i in input().split()])

+print((cost[L - 1] if cost[L - 1] < 10**8 else -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:

#!/usr/bin/env pypy3

# N,M = map(int,sys.stdin.readline().split())

# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param

# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param

# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param

# s = sys.stdin.readline().rstrip()

# N = int(sys.stdin.readline())

# INF = float("inf")

import math,sys

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

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

#n = int(input())

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

g = math.gcd(a[0],a[1])

for i in range(2,n):

    g = math.gcd(g,a[i])

M = max(a)

acc = a[0]

for i in range(n):

    acc = math.gcd(acc,a[i])

if acc != 1:

    print("not coprime")

    exit()

LIMIT=max(a)

minPrime = [0]*(LIMIT+1)

minPrime[1] = 1

def make():

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

        if minPrime[i] == 0:

            minPrime[i] = i

            #print(i)

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

                #print(i,j)

                if minPrime[j] == 0:

                    minPrime[j] = i

make()

def factrial(N):

     ret = []

     while minPrime[N] != N:

         ret.append(minPrime[N])

         N = N//minPrime[N]

     if N != 1:

         ret.append(N)

     return ret

judge = set([])

pc = True

pairwise = True

p = set() #all prime

for e in a:

    if not pairwise:

        break

    asf = set(factrial(e))

    if judge & asf != set():

        pc = False

    #     #pairwise = False

    #     print("setwise coprime")

    #     exit(0)

    judge |= asf

# for i in a:

#     if not pc:

#         break

#     asf = set(factrial(i))

#     if judge & asf != set():

#         pc = False

#     judge |= asf

if pc:

    print("pairwise coprime")

elif g == 1:

    print("setwise coprime")

else:

    print("not coprime")

# optimized version of the same code:

#!/usr/bin/env pypy3

# N,M = map(int,sys.stdin.readline().split())

# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param

# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param

# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param

# s = sys.stdin.readline().rstrip()

# N = int(sys.stdin.readline())

# INF = float("inf")

import math,sys

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

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

#n = int(input())

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

g = math.gcd(a[0],a[1])

for i in range(2,n):

    g = math.gcd(g,a[i])

M = max(a)

acc = a[0]

for i in range(n):

    acc = math.gcd(acc,a[i])

if acc != 1:

    print("not coprime")

    exit()

LIMIT=max(a)

minPrime = [0]*(LIMIT+1)

minPrime[1] = 1

def make():

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

        if minPrime[i] == 0:

            minPrime[i] = i

            #print(i)

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

                #print(i,j)

                if minPrime[j] == 0:

                    minPrime[j] = i

make()

def factrial(N):

     ret = []

     while minPrime[N] != N:

         ret.append(minPrime[N])

         N = N//minPrime[N]

     if N != 1:

         ret.append(N)

     return ret

judge = set([])

for e in a:

    asf = set(factrial(e))

    if judge & asf != set():

        print("setwise coprime")

        exit()

    judge |= asf

    #judge = judge | asf #too slow

print("pairwise coprime")

#!/usr/bin/env pypy3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import math, sys

n = int(sys.stdin.readline())
a = tuple(map(int, sys.stdin.readline().split()))
# n = int(input())
# a = list(map(int,input().split()))
g = math.gcd(a[0], a[1])
for i in range(2, n):
    g = math.gcd(g, a[i])
M = max(a)
acc = a[0]
for i in range(n):
    acc = math.gcd(acc, a[i])
if acc != 1:
    print("not coprime")
    exit()
LIMIT = max(a)
minPrime = [0] * (LIMIT + 1)
minPrime[1] = 1

def make():
    for i in range(2, LIMIT + 1):
        if minPrime[i] == 0:
            minPrime[i] = i
            # print(i)
            for j in range(i + i, LIMIT + 1, i):
                # print(i,j)
                if minPrime[j] == 0:
                    minPrime[j] = i

make()

def factrial(N):
    ret = []
    while minPrime[N] != N:
        ret.append(minPrime[N])
        N = N // minPrime[N]
    if N != 1:
        ret.append(N)
    return ret

judge = set([])
pc = True
pairwise = True
p = set()  # all prime
for e in a:
    if not pairwise:
        break
    asf = set(factrial(e))
    if judge & asf != set():
        pc = False
    #     #pairwise = False
    #     print("setwise coprime")
    #     exit(0)
    judge |= asf
# for i in a:
#     if not pc:
#         break
#     asf = set(factrial(i))
#     if judge & asf != set():
#         pc = False
#     judge |= asf
if pc:
    print("pairwise coprime")
elif g == 1:
    print("setwise coprime")
else:
    print("not coprime")

#!/usr/bin/env pypy3
# N,M = map(int,sys.stdin.readline().split())
# a = tuple(map(int,sys.stdin.readline().split())) # single line with multi param
# a = tuple(int(sys.stdin.readline()) for _ in range(N)) # multi line with single param
# a = tuple(tuple(map(int,sys.stdin.readline().rstrip().split())) for _ in range(N)) # multi line with multi param
# s = sys.stdin.readline().rstrip()
# N = int(sys.stdin.readline())
# INF = float("inf")
import math, sys

n = int(sys.stdin.readline())
a = tuple(map(int, sys.stdin.readline().split()))
# n = int(input())
# a = list(map(int,input().split()))
g = math.gcd(a[0], a[1])
for i in range(2, n):
    g = math.gcd(g, a[i])
M = max(a)
acc = a[0]
for i in range(n):
    acc = math.gcd(acc, a[i])
if acc != 1:
    print("not coprime")
    exit()
LIMIT = max(a)
minPrime = [0] * (LIMIT + 1)
minPrime[1] = 1

def make():
    for i in range(2, LIMIT + 1):
        if minPrime[i] == 0:
            minPrime[i] = i
            # print(i)
            for j in range(i + i, LIMIT + 1, i):
                # print(i,j)
                if minPrime[j] == 0:
                    minPrime[j] = i

make()

def factrial(N):
    ret = []
    while minPrime[N] != N:
        ret.append(minPrime[N])
        N = N // minPrime[N]
    if N != 1:
        ret.append(N)
    return ret

judge = set([])
for e in a:
    asf = set(factrial(e))
    if judge & asf != set():
        print("setwise coprime")
        exit()
    judge |= asf
    # judge = judge | asf #too slow
print("pairwise coprime")

-pc = True
-pairwise = True
-p = set()  # all prime
-    if not pairwise:
-        break
-        pc = False
-    #     #pairwise = False
-    #     print("setwise coprime")
-    #     exit(0)
+        print("setwise coprime")
+        exit()
-# for i in a:
-#     if not pc:
-#         break
-#     asf = set(factrial(i))
-#     if judge & asf != set():
-#         pc = False
-#     judge |= asf
-if pc:
-    print("pairwise coprime")
-elif g == 1:
-    print("setwise coprime")
-else:
-    print("not coprime")
+    # judge = judge | asf #too slow
+print("pairwise coprime")


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:

NN = 19

XX = [0] * (2**(NN+1)-1)

def addvalue(j, x):

    i = 2**NN + j - 1

    while i >= 0:

        XX[i] += x

        i = (i-1) // 2

def rangesum(a, b):

    l = a + (1<<NN)

    r = b + (1<<NN)

    s = 0

    while l < r:

        if l%2:

            s += XX[l-1]

            l += 1

        if r%2:

            r -= 1

            s += XX[r-1]

        l >>= 1

        r >>= 1

    return s

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

C = [int(a) - 1 for a in input().split()]

X = [[] for _ in range(N)]

for i in range(Q):

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

    X[r-1].append((l - 1, i))

last = [-1] * N

ANS = [-1] * Q

addvalue(1, N)

for r in range(N):

    c = C[r]

    addvalue(last[c] + 2, -1)

    addvalue(r + 2, 1)

    last[c] = r

    for l, i in X[r]:

        ANS[i] = rangesum(l + 2, 1 << NN)

print(*ANS, sep = "\n")

# optimized version of the same code:

##### https://atcoder.jp/contests/abc174/submissions/15644075 を1次元化

import sys

INF = 1 << 60

MOD = 10**9 + 7 # 998244353

sys.setrecursionlimit(2147483647)

input = lambda:sys.stdin.buffer.readline().rstrip()

class SegmentTree(object):

    def __init__(self, A, dot, unit):

        n = 1 << (len(A) - 1).bit_length()

        tree = [unit] * (2 * n)

        for i, v in enumerate(A):

            tree[i + n] = v

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

            tree[i] = dot(tree[i << 1], tree[i << 1 | 1])

        self._n = n

        self._tree = tree

        self._dot = dot

        self._unit = unit

    def __getitem__(self, i):

        return self._tree[i + self._n]

    def update(self, i, v):

        i += self._n

        self._tree[i] = v

        while i != 1:

            i >>= 1

            self._tree[i] = self._dot(self._tree[i << 1], self._tree[i << 1 | 1])

    def add(self, i, v):

        self.update(i, self[i] + v)

    def sum(self, l, r):

        l += self._n

        r += self._n

        l_val = r_val = self._unit

        while l < r:

            if l & 1:

                l_val = self._dot(l_val, self._tree[l])

                l += 1

            if r & 1:

                r -= 1

                r_val = self._dot(self._tree[r], r_val)

            l >>= 1

            r >>= 1

        return self._dot(l_val, r_val)

from operator import add

def resolve():

    n, q = map(int, input().split())

    C = list(map(lambda x : int(x) - 1, input().split()))

    A = [0] * n

    used = [0] * n

    for i, c in enumerate(C):

        if used[c]:

            continue

        used[c] = 1

        A[i] = 1

    tree = SegmentTree(A, add, 0)

    next = [-1] * n

    used = [-1] * n

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

        c = C[i]

        if used[c] != -1:

            next[i] = used[c]

        used[c] = i

    queries = [None] * q

    for i in range(q):

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

        queries[i] = (l - 1 << 40) + (r << 20) + i

    queries.sort(reverse = 1)

    m = (1 << 20) - 1

    ans = [0] * q

    for l in range(n):

        while queries and queries[-1] >> 40 == l:

            lri = queries.pop()

            l = lri >> 40

            r = (lri >> 20) & m

            i = lri & m

            ans[i] = tree.sum(l, r)

        if next[l] != -1:

            tree.add(next[l], 1)

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

resolve()

NN = 19
XX = [0] * (2 ** (NN + 1) - 1)

def addvalue(j, x):
    i = 2**NN + j - 1
    while i >= 0:
        XX[i] += x
        i = (i - 1) // 2

def rangesum(a, b):
    l = a + (1 << NN)
    r = b + (1 << NN)
    s = 0
    while l < r:
        if l % 2:
            s += XX[l - 1]
            l += 1
        if r % 2:
            r -= 1
            s += XX[r - 1]
        l >>= 1
        r >>= 1
    return s

N, Q = map(int, input().split())
C = [int(a) - 1 for a in input().split()]
X = [[] for _ in range(N)]
for i in range(Q):
    l, r = map(int, input().split())
    X[r - 1].append((l - 1, i))
last = [-1] * N
ANS = [-1] * Q
addvalue(1, N)
for r in range(N):
    c = C[r]
    addvalue(last[c] + 2, -1)
    addvalue(r + 2, 1)
    last[c] = r
    for l, i in X[r]:
        ANS[i] = rangesum(l + 2, 1 << NN)
print(*ANS, sep="\n")

##### https://atcoder.jp/contests/abc174/submissions/15644075 を1次元化
import sys

INF = 1 << 60
MOD = 10**9 + 7  # 998244353
sys.setrecursionlimit(2147483647)
input = lambda: sys.stdin.buffer.readline().rstrip()

class SegmentTree(object):
    def __init__(self, A, dot, unit):
        n = 1 << (len(A) - 1).bit_length()
        tree = [unit] * (2 * n)
        for i, v in enumerate(A):
            tree[i + n] = v
        for i in range(n - 1, 0, -1):
            tree[i] = dot(tree[i << 1], tree[i << 1 | 1])
        self._n = n
        self._tree = tree
        self._dot = dot
        self._unit = unit

    def __getitem__(self, i):
        return self._tree[i + self._n]

    def update(self, i, v):
        i += self._n
        self._tree[i] = v
        while i != 1:
            i >>= 1
            self._tree[i] = self._dot(self._tree[i << 1], self._tree[i << 1 | 1])

    def add(self, i, v):
        self.update(i, self[i] + v)

    def sum(self, l, r):
        l += self._n
        r += self._n
        l_val = r_val = self._unit
        while l < r:
            if l & 1:
                l_val = self._dot(l_val, self._tree[l])
                l += 1
            if r & 1:
                r -= 1
                r_val = self._dot(self._tree[r], r_val)
            l >>= 1
            r >>= 1
        return self._dot(l_val, r_val)

from operator import add

def resolve():
    n, q = map(int, input().split())
    C = list(map(lambda x: int(x) - 1, input().split()))
    A = [0] * n
    used = [0] * n
    for i, c in enumerate(C):
        if used[c]:
            continue
        used[c] = 1
        A[i] = 1
    tree = SegmentTree(A, add, 0)
    next = [-1] * n
    used = [-1] * n
    for i in range(n - 1, -1, -1):
        c = C[i]
        if used[c] != -1:
            next[i] = used[c]
        used[c] = i
    queries = [None] * q
    for i in range(q):
        l, r = map(int, input().split())
        queries[i] = (l - 1 << 40) + (r << 20) + i
    queries.sort(reverse=1)
    m = (1 << 20) - 1
    ans = [0] * q
    for l in range(n):
        while queries and queries[-1] >> 40 == l:
            lri = queries.pop()
            l = lri >> 40
            r = (lri >> 20) & m
            i = lri & m
            ans[i] = tree.sum(l, r)
        if next[l] != -1:
            tree.add(next[l], 1)
    print(*ans, sep="\n")

resolve()

+input = lambda: sys.stdin.buffer.readline().rstrip()

+            self._tree[i] = self._dot(self._tree[i << 1], self._tree[i << 1 | 1])

+                l_val = self._dot(l_val, self._tree[l])

+                r_val = self._dot(self._tree[r], r_val)

-C = [int(a) - 1 for a in input().split()]

-        ANS[i] = rangesum(l + 2, 1 << NN)

+    C = list(map(lambda x: int(x) - 1, input().split()))

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

+        while queries and queries[-1] >> 40 == 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:

alph = eval(input())

if alph.isupper():

    print("A")

else:

    print("a")

# optimized version of the same code:

a = eval(input())

if a.isupper():

    print("A")

else:

    print("a")

-alph = eval(input())
-if alph.isupper():
+a = eval(input())
+if a.isupper():


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

mod = 1000000007

def pow(x, n):

    ret = 1

    while n > 0:

        if (n & 1) == 1:

            ret = (ret * x) % mod

        x = (x * x) % mod

        n >>= 1

    return ret

fac = [1]

inv = [1]

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

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

    inv.append(pow(fac[i], mod - 2))

def cmb(n, k):

    return (fac[n] * inv[k] * inv[n - k]) % mod

def doit(n, m, k):

    ret = 0

    for d in range(m):

        ret = (ret + d * (m - d)) % mod

    return (ret * n * n * cmb(n * m - 2, k - 2)) % mod

print(((doit(n, m, k) + doit(m, n, k)) % mod))

# optimized version of the same code:

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

mod = 1000000007

fac = [1]

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

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

def pow(x, n):

    ret = 1

    while n > 0:

        if (n & 1) == 1:

            ret = (ret * x) % mod

        x = (x * x) % mod

        n >>= 1

    return ret

def inv(i):

    return pow(fac[i], mod - 2)

def cmb(n, k):

    return (fac[n] * inv(k) * inv(n - k)) % mod

x = sum(d * (m - d) for d in range(m)) % mod

y = sum(d * (n - d) for d in range(n)) % mod

c = cmb(n * m - 2, k - 2)

x = (x * n * n * c) % mod

y = (y * m * m * c) % mod

print(((x + y) % mod))

-    return (fac[n] * inv[k] * inv[n - k]) % mod

+    return (fac[n] * inv(k) * inv(n - k)) % mod

-        ret = (ret + d * (m - d)) % mod

-    return (ret * n * n * cmb(n * m - 2, k - 2)) % mod

-print(((doit(n, m, k) + doit(m, n, k)) % mod))

+x = sum(d * (m - d) for d in range(m)) % mod

+y = sum(d * (n - d) for d in range(n)) % mod


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

s=int(eval(input()))

p=10**9+7

if s<=2:

    print((0))

    exit()

n=s//3

ans=0

def f(n,k,p):

    if k==0:

        return 1

    elif k%2==0:

        return (f(n,k//2,p)**2)%p

    else:

        return (n*f(n,k-1,p))%p

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

    a=1

    b=1

    for j in range(k-1):

        a=(a*(s-3*k+1+j))%p

        b=(b*(j+1))%p

    ans=(ans+a*f(b,p-2,p))%p

print((ans%p))

# optimized version of the same code:

s = int(eval(input()))
p = 10**9 + 7
if s <= 2:
    print((0))
    exit()
n = s // 3
ans = 0

def f(n, k, p):
    if k == 0:
        return 1
    elif k % 2 == 0:
        return (f(n, k // 2, p) ** 2) % p
    else:
        return (n * f(n, k - 1, p)) % p

for k in range(1, n + 1):
    a = 1
    b = 1
    for j in range(k - 1):
        a = (a * (s - 3 * k + 1 + j)) % p
        b = (b * (j + 1)) % p
    ans = (ans + a * f(b, p - 2, p)) % p
print((ans % p))

-        return (n * f(n, k - 1, p)) % p


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

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

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

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

    dp[i][0] = max(dp[i - 1][1] + abc[i - 1][1], dp[i - 1][2] + abc[i - 1][2])

    dp[i][1] = max(dp[i - 1][0] + abc[i - 1][0], dp[i - 1][2] + abc[i - 1][2])

    dp[i][2] = max(dp[i - 1][1] + abc[i - 1][1], dp[i - 1][0] + abc[i - 1][0])

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

# optimized version of the same code:

-abc = np.array([list(map(int, input().split())) for i in range(N)])

+    A[i], B[i], C[i] = 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,x,y=list(map(int,input().split()));print((min(k*c*2+a*max(x-k,0)+b*max(y-k,0)for k in range(max(x,y)*3))))

# optimized version of the same code:

a, b, c, x, y = list(map(int, input().split()))
print(
    (
        min(
            k * c * 2 + a * max(x - k, 0) + b * max(y - k, 0)
            for k in range(max(x, y) * 3)
        )
    )
)

a, b, c, x, y = list(map(int, input().split()))
print(
    (min(x * a + y * b, 2 * x * c + b * max(0, y - x), 2 * y * c + a * max(0, x - y)))
)

-            for k in range(max(x, y) * 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:

import math

import string

import collections

from collections import Counter

def readints():

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

def nCr(n, r):

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

def has_duplicates2(seq):

    seen = []

    for item in seq:

        if not(item in seen):

            seen.append(item)

    return len(seq) != len(seen)

def divisor(n):

    divisor = []

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

        if n % i == 0:

            divisor.append(i)

    return divisor

# coordinates

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

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

a, b, c, d = list(map(int, eval(input())))

#print(a, b, c, d)

if a+b+c+d == 7:

    print((str(a)+'+'+str(b)+'+'+str(c)+'+'+str(d)+'=7'))

    exit()

if a+b-c+d == 7:

    print((str(a)+'+'+str(b)+'-'+str(c)+'+'+str(d)+'=7'))

    exit()

if a+b+c-d == 7:

    print((str(a)+'+'+str(b)+'+'+str(c)+'-'+str(d)+'=7'))

    exit()

if a+b-c-d == 7:

    print((str(a)+'+'+str(b)+'-'+str(c)+'-'+str(d)+'=7'))

    exit()

if a-b+c+d == 7:

    print((str(a)+'-'+str(b)+'+'+str(c)+'+'+str(d)+'=7'))

    exit()

if a-b-c+d == 7:

    print((str(a)+'-'+str(b)+'-'+str(c)+'+'+str(d)+'=7'))

    exit()

if a-b+c-d == 7:

    print((str(a)+'-'+str(b)+'+'+str(c)+'-'+str(d)+'=7'))

    exit()

if a-b-c-d == 7:

    print((str(a)+'-'+str(b)+'-'+str(c)+'-'+str(d)+'=7'))

    exit()

# optimized version of the same code:

from copy import deepcopy

import math

import string

import collections

from collections import Counter

from collections import deque

from decimal import Decimal

import sys

import fractions

from operator import itemgetter

import itertools

import copy

def readints():

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

def nCr(n, r):

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

def has_duplicates2(seq):

    seen = []

    for item in seq:

        if not(item in seen):

            seen.append(item)

    return len(seq) != len(seen)

def divisor(n):

    divisor = []

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

        if n % i == 0:

            divisor.append(i)

    return divisor

# coordinates

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

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

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

if s[0]+s[1]+s[2]+s[3] == 7:

    print(str(s[0]), '+', str(s[1]), '+',

          str(s[2]), '+', str(s[3]), '=', 7, sep='')

    exit()

if s[0]+s[1]-s[2]+s[3] == 7:

    print(str(s[0]), '+', str(s[1]), '-', str(s[2]),

          '+', str(s[3]),  '=', 7, sep='')

    exit()

if s[0]-s[1]+s[2]+s[3] == 7:

    print(str(s[0]), '-', str(s[1]), '+', str(s[2]),

          '+', str(s[3]),  '=', 7, sep='')

    exit()

if s[0]-s[1]-s[2]+s[3] == 7:

    print(str(s[0]), '-', str(s[1]), '-', str(s[2]),

          '+', str(s[3]),  '=', 7, sep='')

    exit()

if s[0]+s[1]+s[2]-s[3] == 7:

    print(str(s[0]), '+', str(s[1]), '+', str(s[2]),

          '-', str(s[3]),  '=', 7, sep='')

    exit()

if s[0]-s[1]-s[2]-s[3] == 7:

    print(str(s[0]), '-', str(s[1]), '-', str(s[2]),

          '-', str(s[3]),  '=', 7, sep='')

    exit()

if s[0]-s[1]+s[2]-s[3] == 7:

    print(str(s[0]), '-', str(s[1]), '+', str(s[2]),

          '-', str(s[3]),  '=', 7, sep='')

    exit()

if s[0]+s[1]-s[2]-s[3] == 7:

    print(str(s[0]), '+', str(s[1]), '-', str(s[2]),

          '-', str(s[3]),  '=', 7, sep='')

    exit()

import math
import string
import collections
from collections import Counter

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

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

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

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

# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
a, b, c, d = list(map(int, eval(input())))
# print(a, b, c, d)
if a + b + c + d == 7:
    print((str(a) + "+" + str(b) + "+" + str(c) + "+" + str(d) + "=7"))
    exit()
if a + b - c + d == 7:
    print((str(a) + "+" + str(b) + "-" + str(c) + "+" + str(d) + "=7"))
    exit()
if a + b + c - d == 7:
    print((str(a) + "+" + str(b) + "+" + str(c) + "-" + str(d) + "=7"))
    exit()
if a + b - c - d == 7:
    print((str(a) + "+" + str(b) + "-" + str(c) + "-" + str(d) + "=7"))
    exit()
if a - b + c + d == 7:
    print((str(a) + "-" + str(b) + "+" + str(c) + "+" + str(d) + "=7"))
    exit()
if a - b - c + d == 7:
    print((str(a) + "-" + str(b) + "-" + str(c) + "+" + str(d) + "=7"))
    exit()
if a - b + c - d == 7:
    print((str(a) + "-" + str(b) + "+" + str(c) + "-" + str(d) + "=7"))
    exit()
if a - b - c - d == 7:
    print((str(a) + "-" + str(b) + "-" + str(c) + "-" + str(d) + "=7"))
    exit()

from copy import deepcopy
import math
import string
import collections
from collections import Counter
from collections import deque
from decimal import Decimal
import sys
import fractions
from operator import itemgetter
import itertools
import copy

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

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

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

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

# coordinates
dx = [-1, -1, -1, 0, 0, 1, 1, 1]
dy = [-1, 0, 1, -1, 1, -1, 0, 1]
s = list(map(int, input()))
if s[0] + s[1] + s[2] + s[3] == 7:
    print(str(s[0]), "+", str(s[1]), "+", str(s[2]), "+", str(s[3]), "=", 7, sep="")
    exit()
if s[0] + s[1] - s[2] + s[3] == 7:
    print(str(s[0]), "+", str(s[1]), "-", str(s[2]), "+", str(s[3]), "=", 7, sep="")
    exit()
if s[0] - s[1] + s[2] + s[3] == 7:
    print(str(s[0]), "-", str(s[1]), "+", str(s[2]), "+", str(s[3]), "=", 7, sep="")
    exit()
if s[0] - s[1] - s[2] + s[3] == 7:
    print(str(s[0]), "-", str(s[1]), "-", str(s[2]), "+", str(s[3]), "=", 7, sep="")
    exit()
if s[0] + s[1] + s[2] - s[3] == 7:
    print(str(s[0]), "+", str(s[1]), "+", str(s[2]), "-", str(s[3]), "=", 7, sep="")
    exit()
if s[0] - s[1] - s[2] - s[3] == 7:
    print(str(s[0]), "-", str(s[1]), "-", str(s[2]), "-", str(s[3]), "=", 7, sep="")
    exit()
if s[0] - s[1] + s[2] - s[3] == 7:
    print(str(s[0]), "-", str(s[1]), "+", str(s[2]), "-", str(s[3]), "=", 7, sep="")
    exit()
if s[0] + s[1] - s[2] - s[3] == 7:
    print(str(s[0]), "+", str(s[1]), "-", str(s[2]), "-", str(s[3]), "=", 7, sep="")
    exit()

-a, b, c, d = list(map(int, eval(input())))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

import numpy as np

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

Bsize = 700

def Mo_argsort(LR):

    L = LR[:, 0]

    R = LR[:, 1]

    key1 = L // Bsize

    key2 = np.where(key1 & 1, -R, R)

    key = (key1 << 32) + key2

    return np.argsort(key)

def main(A, LR):

    N = len(A)

    Q = len(LR)

    ind = Mo_argsort(LR)

    count = np.zeros(N + 1, np.int64)

    ans = 0

    def add(x):

        nonlocal ans

        if not count[x]:

            ans += 1

        count[x] += 1

    def rem(x):

        nonlocal ans

        count[x] -= 1

        if not count[x]:

            ans -= 1

    answers = np.empty(Q, np.int64)

    nl, nr = 0, 0

    for i in ind:

        l, r = LR[i]

        l -= 1

        # 区間 [l, r) に対する計算

        while nl > l:

            nl -= 1

            add(A[nl])

        while nr < r:

            add(A[nr])

            nr += 1

        while nl < l:

            rem(A[nl])

            nl += 1

        while nr > r:

            nr -= 1

            rem(A[nr])

        #  答を求めて ans[i] に格納する

        answers[i] = ans

    return answers

if sys.argv[-1] == 'ONLINE_JUDGE':

    import numba

    from numba.pycc import CC

    i4 = numba.int32

    i8 = numba.int64

    cc = CC('my_module')

    def cc_export(f, signature):

        cc.export(f.__name__, signature)(f)

        return numba.njit(f)

    Mo_argsort = cc_export(Mo_argsort, (i8[:,:],))

    main = cc_export(main, (i8[:], i8[:, :]))

    cc.compile()

from my_module import main

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

A = np.array(readline().split(), np.int64)

LR = np.array(read().split(), np.int64).reshape(Q, 2)

ans = main(A, LR)

print(('\n'.join(map(str, ans.tolist()))))

# optimized version of the same code:

import sys

import numpy as np

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

Bsize = 1000

def Mo_argsort(LR):

    L = LR[:, 0]

    R = LR[:, 1]

    key1 = L // Bsize

    key2 = np.where(key1 & 1, -R, R)

    key = (key1 << 32) + key2

    return np.argsort(key)

def main(A, LR):

    N = len(A)

    Q = len(LR)

    ind = Mo_argsort(LR)

    count = np.zeros(N + 1, np.int64)

    ans = 0

    def add(x):

        nonlocal ans

        if not count[x]:

            ans += 1

        count[x] += 1

    def rem(x):

        nonlocal ans

        count[x] -= 1

        if not count[x]:

            ans -= 1

    answers = np.empty(Q, np.int64)

    nl, nr = 0, 0

    for i in ind:

        l, r = LR[i]

        l -= 1

        # 区間 [l, r) に対する計算

        while nl > l:

            nl -= 1

            add(A[nl])

        while nr < r:

            add(A[nr])

            nr += 1

        while nl < l:

            rem(A[nl])

            nl += 1

        while nr > r:

            nr -= 1

            rem(A[nr])

        #  答を求めて ans[i] に格納する

        answers[i] = ans

    return answers

if sys.argv[-1] == 'ONLINE_JUDGE':

    import numba

    from numba.pycc import CC

    i4 = numba.int32

    i8 = numba.int64

    cc = CC('my_module')

    def cc_export(f, signature):

        cc.export(f.__name__, signature)(f)

        return numba.njit(f)

    Mo_argsort = cc_export(Mo_argsort, (i8[:,:],))

    main = cc_export(main, (i8[:], i8[:, :]))

    cc.compile()

from my_module import main

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

A = np.array(readline().split(), np.int64)

LR = np.array(read().split(), np.int64).reshape(Q, 2)

ans = main(A, LR)

print(('\n'.join(map(str, ans.tolist()))))

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
Bsize = 700

def Mo_argsort(LR):
    L = LR[:, 0]
    R = LR[:, 1]
    key1 = L // Bsize
    key2 = np.where(key1 & 1, -R, R)
    key = (key1 << 32) + key2
    return np.argsort(key)

def main(A, LR):
    N = len(A)
    Q = len(LR)
    ind = Mo_argsort(LR)
    count = np.zeros(N + 1, np.int64)
    ans = 0

    def add(x):
        nonlocal ans
        if not count[x]:
            ans += 1
        count[x] += 1

    def rem(x):
        nonlocal ans
        count[x] -= 1
        if not count[x]:
            ans -= 1

    answers = np.empty(Q, np.int64)
    nl, nr = 0, 0
    for i in ind:
        l, r = LR[i]
        l -= 1
        # 区間 [l, r) に対する計算
        while nl > l:
            nl -= 1
            add(A[nl])
        while nr < r:
            add(A[nr])
            nr += 1
        while nl < l:
            rem(A[nl])
            nl += 1
        while nr > r:
            nr -= 1
            rem(A[nr])
        #  答を求めて ans[i] に格納する
        answers[i] = ans
    return answers

if sys.argv[-1] == "ONLINE_JUDGE":
    import numba
    from numba.pycc import CC

    i4 = numba.int32
    i8 = numba.int64
    cc = CC("my_module")

    def cc_export(f, signature):
        cc.export(f.__name__, signature)(f)
        return numba.njit(f)

    Mo_argsort = cc_export(Mo_argsort, (i8[:, :],))
    main = cc_export(main, (i8[:], i8[:, :]))
    cc.compile()
from my_module import main

N, Q = list(map(int, readline().split()))
A = np.array(readline().split(), np.int64)
LR = np.array(read().split(), np.int64).reshape(Q, 2)
ans = main(A, LR)
print(("\n".join(map(str, ans.tolist()))))

import sys
import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
Bsize = 1000

def Mo_argsort(LR):
    L = LR[:, 0]
    R = LR[:, 1]
    key1 = L // Bsize
    key2 = np.where(key1 & 1, -R, R)
    key = (key1 << 32) + key2
    return np.argsort(key)

def main(A, LR):
    N = len(A)
    Q = len(LR)
    ind = Mo_argsort(LR)
    count = np.zeros(N + 1, np.int64)
    ans = 0

    def add(x):
        nonlocal ans
        if not count[x]:
            ans += 1
        count[x] += 1

    def rem(x):
        nonlocal ans
        count[x] -= 1
        if not count[x]:
            ans -= 1

    answers = np.empty(Q, np.int64)
    nl, nr = 0, 0
    for i in ind:
        l, r = LR[i]
        l -= 1
        # 区間 [l, r) に対する計算
        while nl > l:
            nl -= 1
            add(A[nl])
        while nr < r:
            add(A[nr])
            nr += 1
        while nl < l:
            rem(A[nl])
            nl += 1
        while nr > r:
            nr -= 1
            rem(A[nr])
        #  答を求めて ans[i] に格納する
        answers[i] = ans
    return answers

if sys.argv[-1] == "ONLINE_JUDGE":
    import numba
    from numba.pycc import CC

    i4 = numba.int32
    i8 = numba.int64
    cc = CC("my_module")

    def cc_export(f, signature):
        cc.export(f.__name__, signature)(f)
        return numba.njit(f)

    Mo_argsort = cc_export(Mo_argsort, (i8[:, :],))
    main = cc_export(main, (i8[:], i8[:, :]))
    cc.compile()
from my_module import main

N, Q = list(map(int, readline().split()))
A = np.array(readline().split(), np.int64)
LR = np.array(read().split(), np.int64).reshape(Q, 2)
ans = main(A, LR)
print(("\n".join(map(str, ans.tolist()))))


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

d=0

while d<10**5:

    if a%2==1 or b%2==1 or c%2==1:break

    a,b,c=b/2+c/2,a/2+c/2,a/2+b/2

    d+=1

else:d=-1

print(d)

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

# https://atcoder.jp/contests/abc129/tasks/abc129_c

# 典型的なDP

MOD = 10**9 + 7

import numpy as np

# dp[i]をi段目までの通りの数とする。

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

to_zero = np.full((N + 1), False).tolist()

for _ in range(M):

    to_zero[int(eval(input()))] = True  # 床が抜けているところ

# dpテーブルの用意

dp = np.full((N + 1), -1).tolist()

dp[0] = 1

dp[1] = 0 if to_zero[1] else 1

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

    dp[i] = 0 if to_zero[i] else dp[i - 2] + dp[i - 1]

    if dp[i] > MOD:

        dp[i] %= MOD

print((dp[-1]))

# optimized version of the same code:

# https://atcoder.jp/contests/abc129/tasks/abc129_c

# 典型的なDP

def full(shape, full_value):

    if isinstance(shape, tuple):

        NotImplementedError()

    else:

        return [full_value] * shape

MOD = 10**9 + 7

# dp[i]をi段目までの通りの数とする。

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

to_zero = full((N + 1), False)

for _ in range(M):

    to_zero[int(eval(input()))] = True  # 床が抜けているところ

# dpテーブルの用意

dp = full((N + 1), -1)

dp[0] = 1

dp[1] = 0 if to_zero[1] else 1

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

    dp[i] = 0 if to_zero[i] else dp[i - 2] + dp[i - 1]

    if dp[i] > MOD:

        dp[i] %= MOD

print((dp[-1]))

-to_zero = np.full((N + 1), False).tolist()


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

import numpy as np

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

r = np.zeros(n)

for i in range(m):

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

	r[a-1] += 1

	r[b-1] += 1

for i in range(n):

	print((int(r[i])))

# optimized version of the same code:

import sys

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

r = [0]*n

for _ in range(m):

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

	r[a-1] += 1

	r[b-1] += 1

for i in r:

	print(i)

import sys
import numpy as np

n, m = [int(x) for x in sys.stdin.readline().split()]
r = np.zeros(n)
for i in range(m):
    a, b = [int(x) for x in sys.stdin.readline().split()]
    r[a - 1] += 1
    r[b - 1] += 1
for i in range(n):
    print((int(r[i])))

import sys

n, m = [int(x) for x in sys.stdin.readline().split()]
r = [0] * n
for _ in range(m):
    a, b = [int(x) for x in sys.stdin.readline().split()]
    r[a - 1] += 1
    r[b - 1] += 1
for i in r:
    print(i)

-import numpy as np
-r = np.zeros(n)
-for i in range(m):
+r = [0] * n
+for _ in range(m):
-for i in range(n):
-    print((int(r[i])))
+for i in r:
+    print(i)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import statistics

N = int(eval(input()))

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

ans = 0

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

  a[i-1] -= i

b = statistics.median(a)

for i in range(N):

  ans += abs(a[i]-b)

print((int(ans)))

# optimized version of the same code:

N = int(eval(input()))

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

C = [A[i]-i for i in range(N)]

C.sort()

ans = 0

med = C[N//2]

for i in range(N):

  ans += abs(C[i]-med)

print(ans)

import statistics

N = int(eval(input()))
a = [int(i) for i in input().split()]
ans = 0
for i in range(1, N + 1):
    a[i - 1] -= i
b = statistics.median(a)
for i in range(N):
    ans += abs(a[i] - b)
print((int(ans)))

N = int(eval(input()))
A = [int(i) for i in input().split()]
C = [A[i] - i for i in range(N)]
C.sort()
ans = 0
med = C[N // 2]
for i in range(N):
    ans += abs(C[i] - med)
print(ans)

-import statistics
-a = [int(i) for i in input().split()]
+A = [int(i) for i in input().split()]
+C = [A[i] - i for i in range(N)]
+C.sort()
-for i in range(1, N + 1):
-    a[i - 1] -= i
-b = statistics.median(a)
+med = C[N // 2]
-    ans += abs(a[i] - b)
-print((int(ans)))
+    ans += abs(C[i] - med)
+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

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

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

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

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

A = -np.sort(-A) #要チェックや

B = -np.sort(-B)

C = -np.sort(-C)

D = []

for i in range(min(K, X)):

    for j in range(min(K, Y)):

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

            break

        for k in range(min(K, Z)):

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

                break

            else:

                D.append(A[i] + B[j] + C[k])

X = np.array(D)

X = -np.sort(-X)

for i in range(K):

    print((X[i]))

# optimized version of the same code:

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

A = sorted([int(i) for i in input().split()], reverse=True)

B = sorted([int(i) for i in input().split()], reverse=True)

C = sorted([int(i) for i in input().split()], reverse=True)

D = []

for i in range(min(K, X)):

    for j in range(min(K, Y)):

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

            break

        for k in range(min(K, Z)):

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

                break

            else:

                D.append(A[i] + B[j] + C[k])

D.sort(reverse=True)

for i in range(K):

    print((D[i]))

import numpy as np

X, Y, Z, K = list(map(int, input().split()))
A = np.array([int(i) for i in input().split()])
B = np.array([int(i) for i in input().split()])
C = np.array([int(i) for i in input().split()])
A = -np.sort(-A)  # 要チェックや
B = -np.sort(-B)
C = -np.sort(-C)
D = []
for i in range(min(K, X)):
    for j in range(min(K, Y)):
        if (i + 1) * (j + 1) > K:
            break
        for k in range(min(K, Z)):
            if (i + 1) * (j + 1) * (k + 1) > K:
                break
            else:
                D.append(A[i] + B[j] + C[k])
X = np.array(D)
X = -np.sort(-X)
for i in range(K):
    print((X[i]))

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

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

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

+A = sorted([int(i) for i in input().split()], reverse=True)

+B = sorted([int(i) for i in input().split()], reverse=True)

+C = sorted([int(i) for i in input().split()], 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:

n = int(eval(input()))

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

ans = 0

nodes_min = [0] * (n + 1)

nodes_max = [0] * (n + 1)

nodes_min[n] = leaves[n]

nodes_max[n] = leaves[n]

for depth in range(n, 0, -1):

    root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2

    nodes_min[depth - 1] = leaves[depth - 1] + root_min

    root_max = nodes_max[depth]

    nodes_max[depth - 1] = leaves[depth - 1] + root_max

nodes = [0] * (n + 1)

nodes[0] = 1

if nodes[0] < nodes_min[0]:

    print((-1))

else:

    for depth in range(n):

        roots = nodes[depth]-leaves[depth]

        nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])

        if nodes[depth+1] < nodes_min[depth+1]:

            print((-1))

            break

    else:

        print((sum(nodes)))

# optimized version of the same code:

n = int(eval(input()))

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

sum_leaves = [0]*(n+1)

sum_leaves[0] = leaves[0]

for depth in range(n):

    sum_leaves[depth+1] = sum_leaves[depth] + leaves[depth+1]

ans = 0

root = [None] * (n + 1)

if n == 0:

    root[0] = 0

else:

    root[0] = 1

if root[0] + leaves[0] != 1:

    print((-1))

else:

    for depth in range(n):

        root[depth+1] = min(2*root[depth]-leaves[depth+1],

                            sum_leaves[n]-sum_leaves[depth+1])

        if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth+1] < 0:

            print((-1))

            break

    else:

        print((sum(root)+sum(leaves)))

n = int(eval(input()))
leaves = list(map(int, input().split()))
ans = 0
nodes_min = [0] * (n + 1)
nodes_max = [0] * (n + 1)
nodes_min[n] = leaves[n]
nodes_max[n] = leaves[n]
for depth in range(n, 0, -1):
    root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2
    nodes_min[depth - 1] = leaves[depth - 1] + root_min
    root_max = nodes_max[depth]
    nodes_max[depth - 1] = leaves[depth - 1] + root_max
nodes = [0] * (n + 1)
nodes[0] = 1
if nodes[0] < nodes_min[0]:
    print((-1))
else:
    for depth in range(n):
        roots = nodes[depth] - leaves[depth]
        nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])
        if nodes[depth + 1] < nodes_min[depth + 1]:
            print((-1))
            break
    else:
        print((sum(nodes)))

n = int(eval(input()))
leaves = list(map(int, input().split()))
sum_leaves = [0] * (n + 1)
sum_leaves[0] = leaves[0]
for depth in range(n):
    sum_leaves[depth + 1] = sum_leaves[depth] + leaves[depth + 1]
ans = 0
root = [None] * (n + 1)
if n == 0:
    root[0] = 0
else:
    root[0] = 1
if root[0] + leaves[0] != 1:
    print((-1))
else:
    for depth in range(n):
        root[depth + 1] = min(
            2 * root[depth] - leaves[depth + 1], sum_leaves[n] - sum_leaves[depth + 1]
        )
        if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth + 1] < 0:
            print((-1))
            break
    else:
        print((sum(root) + sum(leaves)))

+    sum_leaves[depth + 1] = sum_leaves[depth] + leaves[depth + 1]

-    root_min = nodes_min[depth] // 2 + nodes_min[depth] % 2

-    nodes_min[depth - 1] = leaves[depth - 1] + root_min

-    nodes_max[depth - 1] = leaves[depth - 1] + root_max

-        roots = nodes[depth] - leaves[depth]

-        nodes[depth + 1] = min(roots * 2, nodes_max[depth + 1])

-        if nodes[depth + 1] < nodes_min[depth + 1]:

+            2 * root[depth] - leaves[depth + 1], sum_leaves[n] - sum_leaves[depth + 1]

+        if root[depth + 1] < root[depth] - leaves[depth + 1] or root[depth + 1] < 0:

+        print((sum(root) + sum(leaves)))


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

def cmb(n, r, mod, g1, g2):

    if ( r<0 or r>n ):

        return 0

    r = min(r, n-r)

    return g1[n] * g2[r] * g2[n-r] % mod

def main():

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

    A = [-1] + [int(eval(input())) for i in range(M)] + [N + 1]

    mod = 10**9+7 #出力の制限

    N = 10**5

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

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

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

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

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

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

        g2.append( (g2[-1] * inverse[-1]) % mod )

    d = [0] * (len(A) - 1)

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

        if A[i+1] - A[i] == 1:

            print((0))

            exit(0)

        d[i] = A[i+1] - 1 - (A[i] + 1)

    ans = 1

    for dd in d:

        if dd > 1:

            tmp = 0

            for j in range(dd//2 + 1):

                tmp += cmb(dd - j, j, mod, g1, g2)

            ans *= tmp

    print((ans % 1000000007))

if __name__ == '__main__':

    main()

# optimized version of the same code:

def main():

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

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

    a = 0

    b = 1

    j = 0

    tmp = 0

    if N == 1:

        print((1))

    else:

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

            if A[j] == i:

                if tmp == 1:

                    print((0))

                    exit()

                tmp = 1

                j += 1

                a = 0

            else:

                if tmp == 1:

                    b = a + b

                    a = 0

                else:

                    c = a + b

                    a = b

                    b = c

                tmp = 0

        print((b % 1000000007))

if __name__ == '__main__':

    main()

import math

def cmb(n, r, mod, g1, g2):
    if r < 0 or r > n:
        return 0
    r = min(r, n - r)
    return g1[n] * g2[r] * g2[n - r] % mod

def main():
    N, M = list(map(int, input().split()))
    A = [-1] + [int(eval(input())) for i in range(M)] + [N + 1]
    mod = 10**9 + 7  # 出力の制限
    N = 10**5
    g1 = [1, 1]  # 元テーブル
    g2 = [1, 1]  # 逆元テーブル
    inverse = [0, 1]  # 逆元テーブル計算用テーブル
    for i in range(2, N + 1):
        g1.append((g1[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod // i)) % mod)
        g2.append((g2[-1] * inverse[-1]) % mod)
    d = [0] * (len(A) - 1)
    for i in range(len(A) - 1):
        if A[i + 1] - A[i] == 1:
            print((0))
            exit(0)
        d[i] = A[i + 1] - 1 - (A[i] + 1)
    ans = 1
    for dd in d:
        if dd > 1:
            tmp = 0
            for j in range(dd // 2 + 1):
                tmp += cmb(dd - j, j, mod, g1, g2)
            ans *= tmp
    print((ans % 1000000007))

if __name__ == "__main__":
    main()

def main():
    N, M = list(map(int, input().split()))
    A = [int(eval(input())) for i in range(M)] + [0]
    a = 0
    b = 1
    j = 0
    tmp = 0
    if N == 1:
        print((1))
    else:
        for i in range(1, N + 1):
            if A[j] == i:
                if tmp == 1:
                    print((0))
                    exit()
                tmp = 1
                j += 1
                a = 0
            else:
                if tmp == 1:
                    b = a + b
                    a = 0
                else:
                    c = a + b
                    a = b
                    b = c
                tmp = 0
        print((b % 1000000007))

if __name__ == "__main__":
    main()

-    return g1[n] * g2[r] * g2[n - r] % mod

-    A = [-1] + [int(eval(input())) for i in range(M)] + [N + 1]

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

-        g2.append((g2[-1] * inverse[-1]) % mod)

-            for j in range(dd // 2 + 1):

-                tmp += cmb(dd - j, j, mod, g1, g2)

+    A = [int(eval(input())) for i in range(M)] + [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 = int(eval(input()))

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

dp = [0] * 10 ** 7

ans = 0

for i in range(N):

    x = i + 1 - A[i]

    if x >= 0:

        ans += dp[x]

    y = i + 1 + A[i]

    if y < 10 ** 7:

        dp[y] += 1

print(ans)

# optimized version of the same code:

N = int(eval(input()))

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

INF = 2 * 10 ** 5

dp = [0] * INF

ans = 0

for i in range(N):

    i_i_ = i + 1 - A[i]

    if 0 < i_i_ < INF:

        ans += dp[i_i_]

    i_ = i + 1 + A[i]

    if 0 < i_ < INF:

        dp[i_] += 1

print(ans)

N = int(eval(input()))
A = [int(i) for i in input().split()]
dp = [0] * 10**7
ans = 0
for i in range(N):
    x = i + 1 - A[i]
    if x >= 0:
        ans += dp[x]
    y = i + 1 + A[i]
    if y < 10**7:
        dp[y] += 1
print(ans)

N = int(eval(input()))
A = [int(i) for i in input().split()]
INF = 2 * 10**5
dp = [0] * INF
ans = 0
for i in range(N):
    i_i_ = i + 1 - A[i]
    if 0 < i_i_ < INF:
        ans += dp[i_i_]
    i_ = i + 1 + A[i]
    if 0 < i_ < INF:
        dp[i_] += 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:

a,b=2,1

for i in[0]*int(eval(input())):a,b=b,a+b

print(a)

# optimized version of the same code:

a,b=2,1

for i in[0]*eval(input()):a,b=b,a+b

print(a)

a, b = 2, 1
for i in [0] * int(eval(input())):
    a, b = b, a + b
print(a)

a, b = 2, 1
for i in [0] * eval(input()):
    a, b = b, a + b
print(a)

-for i in [0] * int(eval(input())):
+for i in [0] * eval(input()):


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

mod = 10**9+7

dp = [0]*(S+1)

dp[0] = 1

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

    for j in range(0,(i-3)+1):

        dp[i] += dp[j]

        dp[i] %= mod

print((dp[S]))

# optimized version of the same code:

S = int(eval(input()))
mod = 10**9 + 7
dp = [0] * (S + 1)
dp[0] = 1
for i in range(1, S + 1):
    for j in range(0, (i - 3) + 1):
        dp[i] += dp[j]
        dp[i] %= mod
print((dp[S]))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

# ABC 120 C

import re

S = eval(input())

l0 = 0

l1 = 0

for i in range(len(S)):

    if S[i] == '0':

        l0 += 1

    elif S[i] == '1':

        l1 += 1

print((min(l0, l1) * 2))

# optimized version of the same code:

def resolve():

  S = eval(input())

  arr = []

  for s in S:

    if len(arr) != 0 and arr[-1] != s:

      arr.pop()

    else:

      arr.append(s)

  print((len(S) - len(arr)))

  return

if __name__ == "__main__":

  resolve()

# ABC 120 C
import re

S = eval(input())
l0 = 0
l1 = 0
for i in range(len(S)):
    if S[i] == "0":
        l0 += 1
    elif S[i] == "1":
        l1 += 1
print((min(l0, l1) * 2))

+        if len(arr) != 0 and arr[-1] != s: