Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

input = sys.stdin.readline

from scipy.sparse.csgraph import dijkstra

import numpy as np

"""

最小カット

"""

N = int(eval(input()))

start = 0

goal = N+1

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

INF = 10 ** 12

graph = np.zeros((N+2,N+2),dtype=np.int64)

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

    if a >= 0:

        graph[start,i] = a

    else:

        graph[i,goal] = -a

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

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

        if A[i] < 0 and A[j] > 0:

            graph[j][i] = INF

def max_flow(graph):

    flow = 0

    while True:

        dist,pred = dijkstra(graph, indices = start, return_predecessors = True, unweighted = True)

        if dist[goal] == np.inf:

            return flow

        path = []

        v = goal

        while True:

            path.append((pred[v],v))

            v = pred[v]

            if v == start:

                break

        add_flow = min(graph[x][y] for x,y in path)

        for x,y in path:

            graph[x][y] -= add_flow

            graph[y][x] += add_flow

        flow += add_flow

answer = sum(x for x in A if x > 0) - max_flow(graph)

print(answer)

# optimized version of the same code:

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

from collections import deque

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

class Dinic:

    def __init__(self, N, source, sink):

        self.N = N

        self.G = [[] for _ in range(N)]

        self.source = source

        self.sink = sink

    def add_edge(self, fr, to, cap):

        n1 = len(self.G[fr])

        n2 = len(self.G[to])

        self.G[fr].append([to, cap, n2])

        self.G[to].append([fr, 0, n1]) # 逆辺を cap 0 で追加

    def add_edge_undirected(self, fr, to, cap):

        n1 = len(self.G[fr])

        n2 = len(self.G[to])

        self.G[fr].append([to, cap, n2])

        self.G[to].append([fr, cap, n1])

    def bfs(self):

        level = [0] * self.N

        G = self.G; source = self.source; sink = self.sink

        q = deque([source])

        level[source] = 1

        pop = q.popleft; append = q.append

        while q:

            v = pop()

            lv = level[v] + 1

            for to, cap, rev in G[v]:

                if not cap:

                    continue

                if level[to]:

                    continue

                level[to] = lv

                if to == sink:

                    self.level = level

                    return

                append(to)

        self.level = level

    def dfs(self,v,f):

        if v == self.sink:

            return f

        G = self.G

        prog = self.progress

        level = self.level

        lv = level[v]

        E = G[v]

        for i in range(prog[v],len(E)):

            to, cap, rev = E[i]

            prog[v] = i

            if not cap:

                continue

            if level[to] <= lv:

                continue

            x = f if f < cap else cap

            ff = self.dfs(to, x)

            if ff:

                E[i][1] -= ff

                G[to][rev][1] += ff

                return ff

        return 0

    def max_flow(self):

        INF = 10**18

        flow = 0

        while True:

            self.bfs()

            if not self.level[self.sink]:

                return flow

            self.progress = [0] * self.N

            while True:

                f = self.dfs(self.source, INF)

                if not f:

                    break

                flow += f

        return flow

source = 0; sink = N+1; INF = 10 ** 18

dinic = Dinic(N+2,source,sink)

add = dinic.add_edge

for i,x in enumerate(A,1):

    if x < 0:

        # source側：割るものを表現。sink側にうつすときにカット-xが必要。

        add(source,i,-x)

    else:

        # sink側：割らないものを表現。source側にうつすときにカットxが必要。

        add(i,sink,x)

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

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

        # iを割るならjも割る。iを割ってjを割らないのは禁止

        # iがsourceでjがsinkなのは禁止

        add(i,j,INF)

f = dinic.max_flow()

x = sum(x for x in A if x >= 0)

answer = x - f

print(answer)

import sys

input = sys.stdin.readline
from scipy.sparse.csgraph import dijkstra
import numpy as np

"""
最小カット
"""
N = int(eval(input()))
start = 0
goal = N + 1
A = [0] + [int(x) for x in input().split()]
INF = 10**12
graph = np.zeros((N + 2, N + 2), dtype=np.int64)
for i, a in enumerate(A[1:], 1):
    if a >= 0:
        graph[start, i] = a
    else:
        graph[i, goal] = -a
for i in range(1, N + 1):
    for j in range(2 * i, N + 1, i):
        if A[i] < 0 and A[j] > 0:
            graph[j][i] = INF

def max_flow(graph):
    flow = 0
    while True:
        dist, pred = dijkstra(
            graph, indices=start, return_predecessors=True, unweighted=True
        )
        if dist[goal] == np.inf:
            return flow
        path = []
        v = goal
        while True:
            path.append((pred[v], v))
            v = pred[v]
            if v == start:
                break
        add_flow = min(graph[x][y] for x, y in path)
        for x, y in path:
            graph[x][y] -= add_flow
            graph[y][x] += add_flow
        flow += add_flow

answer = sum(x for x in A if x > 0) - max_flow(graph)
print(answer)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import deque

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

class Dinic:
    def __init__(self, N, source, sink):
        self.N = N
        self.G = [[] for _ in range(N)]
        self.source = source
        self.sink = sink

    def add_edge(self, fr, to, cap):
        n1 = len(self.G[fr])
        n2 = len(self.G[to])
        self.G[fr].append([to, cap, n2])
        self.G[to].append([fr, 0, n1])  # 逆辺を cap 0 で追加

    def add_edge_undirected(self, fr, to, cap):
        n1 = len(self.G[fr])
        n2 = len(self.G[to])
        self.G[fr].append([to, cap, n2])
        self.G[to].append([fr, cap, n1])

    def bfs(self):
        level = [0] * self.N
        G = self.G
        source = self.source
        sink = self.sink
        q = deque([source])
        level[source] = 1
        pop = q.popleft
        append = q.append
        while q:
            v = pop()
            lv = level[v] + 1
            for to, cap, rev in G[v]:
                if not cap:
                    continue
                if level[to]:
                    continue
                level[to] = lv
                if to == sink:
                    self.level = level
                    return
                append(to)
        self.level = level

    def dfs(self, v, f):
        if v == self.sink:
            return f
        G = self.G
        prog = self.progress
        level = self.level
        lv = level[v]
        E = G[v]
        for i in range(prog[v], len(E)):
            to, cap, rev = E[i]
            prog[v] = i
            if not cap:
                continue
            if level[to] <= lv:
                continue
            x = f if f < cap else cap
            ff = self.dfs(to, x)
            if ff:
                E[i][1] -= ff
                G[to][rev][1] += ff
                return ff
        return 0

    def max_flow(self):
        INF = 10**18
        flow = 0
        while True:
            self.bfs()
            if not self.level[self.sink]:
                return flow
            self.progress = [0] * self.N
            while True:
                f = self.dfs(self.source, INF)
                if not f:
                    break
                flow += f
        return flow

source = 0
sink = N + 1
INF = 10**18
dinic = Dinic(N + 2, source, sink)
add = dinic.add_edge
for i, x in enumerate(A, 1):
    if x < 0:
        # source側：割るものを表現。sink側にうつすときにカット-xが必要。
        add(source, i, -x)
    else:
        # sink側：割らないものを表現。source側にうつすときにカットxが必要。
        add(i, sink, x)
for i in range(1, N + 1):
    for j in range(i + i, N + 1, i):
        # iを割るならjも割る。iを割ってjを割らないのは禁止
        # iがsourceでjがsinkなのは禁止
        add(i, j, INF)
f = dinic.max_flow()
x = sum(x for x in A if x >= 0)
answer = x - f
print(answer)

-from scipy.sparse.csgraph import dijkstra

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

-graph = np.zeros((N + 2, N + 2), dtype=np.int64)

-            graph, indices=start, return_predecessors=True, unweighted=True

+    def __init__(self, N, source, sink):

+        self.G = [[] for _ in range(N)]

+        self.G[fr].append([to, cap, n2])

+        self.G[to].append([fr, 0, n1])  # 逆辺を cap 0 で追加

+    def add_edge_undirected(self, fr, to, cap):

+        self.G[fr].append([to, cap, n2])

+        self.G[to].append([fr, cap, n1])

+        for i in range(prog[v], len(E)):

-        add_flow = min(graph[x][y] for x, y in path)

+            if not self.level[self.sink]:

+            self.progress = [0] * self.N

+                f = self.dfs(self.source, INF)

-answer = sum(x for x in A if x > 0) - max_flow(graph)

+        # source側：割るものを表現。sink側にうつすときにカット-xが必要。

+        # sink側：割らないものを表現。source側にうつすときにカットxが必要。

+        # iを割るならjも割る。iを割ってjを割らないのは禁止


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

import numpy as np

from fractions import gcd

from functools import reduce

sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))

N, M = lr()

A = np.array(lr())

B = A // 2

# Bの要素が全て2の同じ冪乗

# Bの最小公倍数を求める

def merge(a, b):

    g = gcd(a, b)

    a, b = a // g, b // g

    if a%2 == 0 or b%2 == 0:

        return 0

    ret = a * b * g

    if ret > 10 ** 9:

        return 0

    return ret

x = reduce(merge, B)

if x == 0:

    answer = 0

else:

    answer = M // x - M // (2*x)

print(answer)

# 56

# optimized version of the same code:

import sys

from fractions import gcd

sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))

# A が2で何回割れるか

N, M = lr()

A = lr()

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

cnt = 0

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

    cnt += 1

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

if any(x%2 == 0 for x in A):

    print((0)); exit()

lcm = 1

for a in A:

    lcm *= a // gcd(lcm, a)

answer = M // (2 ** cnt * lcm) - M // (2 ** (cnt+1) * lcm)

print(answer)

# 21

import sys
import numpy as np
from fractions import gcd
from functools import reduce

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, M = lr()
A = np.array(lr())
B = A // 2
# Bの要素が全て2の同じ冪乗
# Bの最小公倍数を求める
def merge(a, b):
    g = gcd(a, b)
    a, b = a // g, b // g
    if a % 2 == 0 or b % 2 == 0:
        return 0
    ret = a * b * g
    if ret > 10**9:
        return 0
    return ret

x = reduce(merge, B)
if x == 0:
    answer = 0
else:
    answer = M // x - M // (2 * x)
print(answer)
# 56

import sys
from fractions import gcd

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
# A が2で何回割れるか
N, M = lr()
A = lr()
A = [x // 2 for x in A]
cnt = 0
while all(x % 2 == 0 for x in A):
    cnt += 1
    A = [x // 2 for x in A]
if any(x % 2 == 0 for x in A):
    print((0))
    exit()
lcm = 1
for a in A:
    lcm *= a // gcd(lcm, a)
answer = M // (2**cnt * lcm) - M // (2 ** (cnt + 1) * lcm)
print(answer)
# 21

+# A が2で何回割れるか

-# Bの要素が全て2の同じ冪乗

-# Bの最小公倍数を求める


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

x = int(eval(input()))

print((0 if x==1 else 1))

# optimized version of the same code:

s = eval(input())

if s == '0':

  print((1))

else:

  print((0))

x = int(eval(input()))
print((0 if x == 1 else 1))

s = eval(input())
if s == "0":
    print((1))
else:
    print((0))

-x = int(eval(input()))
-print((0 if x == 1 else 1))
+s = eval(input())
+if s == "0":
+    print((1))
+else:
+    print((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:

def binarySearch():

    n = int(eval(input()))

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

    q = int(eval(input()))

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

    print((len(S.intersection(T))))

binarySearch()

# optimized version of the same code:

def binarySearch():

    n = int(eval(input()))

    S = set(input().split())

    q = int(eval(input()))

    T = set(input().split())

    print((len(S.intersection(T))))

binarySearch()

-    S = set(map(int, input().split()))
+    S = set(input().split())
-    T = set(map(int, input().split()))
+    T = set(input().split())


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

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

ans=0

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

    buf=str(i)

    #print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])

    str1=buf[0:int(len(buf)/2)]

    str2=buf[int(len(buf)/2+1):]

    if str1[0]==str2[1] and str1[1]==str2[0]:

        ans+=1

print(ans)

# optimized version of the same code:

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

ans=0

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

    buf=str(i)

    str1=buf[::-1]

    if buf==str1:

        ans+=1

print(ans)

a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
    buf = str(i)
    # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])
    str1 = buf[0 : int(len(buf) / 2)]
    str2 = buf[int(len(buf) / 2 + 1) :]
    if str1[0] == str2[1] and str1[1] == str2[0]:
        ans += 1
print(ans)

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

-    # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])

-    str2 = buf[int(len(buf) / 2 + 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:

#template

def inputlist(): return [int(j) for j in input().split()]

#template

#issueから始める

K,N = inputlist()

A = inputlist()

lia = [0]*N

for i in range(1,N):

    k = A[i] - A[i-1]

    lia[i] = k

lia[0] = (K+A[0]-A[-1])

lia.sort()

ans = 0

for i in range(N-1):

    ans += lia[i]

print(ans)

# optimized version of the same code:

#template

def inputlist(): return [int(j) for j in input().split()]

def listinput(): return input().split()

#template

K,N = inputlist()

A = inputlist()

dis = [0]*(N)

for i in range(N):

    if i == N-1:

        dis[i] = K+A[0] - A[i]

        continue

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

dis.sort()

print((sum(dis[:-1])))

# template
def inputlist():
    return [int(j) for j in input().split()]

# template
# issueから始める
K, N = inputlist()
A = inputlist()
lia = [0] * N
for i in range(1, N):
    k = A[i] - A[i - 1]
    lia[i] = k
lia[0] = K + A[0] - A[-1]
lia.sort()
ans = 0
for i in range(N - 1):
    ans += lia[i]
print(ans)

# template
def inputlist():
    return [int(j) for j in input().split()]

def listinput():
    return input().split()

# template
K, N = inputlist()
A = inputlist()
dis = [0] * (N)
for i in range(N):
    if i == N - 1:
        dis[i] = K + A[0] - A[i]
        continue
    dis[i] = A[i + 1] - A[i]
dis.sort()
print((sum(dis[:-1])))

+def listinput():
+    return input().split()
+
+
-# issueから始める
-lia = [0] * N
-for i in range(1, N):
-    k = A[i] - A[i - 1]
-    lia[i] = k
-lia[0] = K + A[0] - A[-1]
-lia.sort()
-ans = 0
-for i in range(N - 1):
-    ans += lia[i]
-print(ans)
+dis = [0] * (N)
+for i in range(N):
+    if i == N - 1:
+        dis[i] = K + A[0] - A[i]
+        continue
+    dis[i] = A[i + 1] - A[i]
+dis.sort()
+print((sum(dis[:-1])))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

import numpy as np

sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))

N, X = lr()

L = np.array([0] + lr())

Lcum = L.cumsum()

i = np.searchsorted(Lcum, X, side='right')

print(i)

#

# optimized version of the same code:

# coding: utf-8

import sys

sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))

N, X = lr()

L = lr()

cnt = 1

cur = 0

for l in L:

    cur += l

    if cur > X:

        break

    cnt += 1

answer = cnt

print(answer)

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, X = lr()
L = np.array([0] + lr())
Lcum = L.cumsum()
i = np.searchsorted(Lcum, X, side="right")
print(i)
#

-i = np.searchsorted(Lcum, X, side="right")


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

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

printV = lambda x: print(*x, sep="\n")

printH = lambda x: print(" ".join(map(str,x)))

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

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

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

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

def LI1(): return list(map(int1, sys.stdin.readline().split()))

def LII(rows_number): return [II() for _ in range(rows_number)]

def LLI(rows_number): return [LI() for _ in range(rows_number)]

def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():

	N = II()

	X = LI()

	X = np.array(X)

	m = round(np.sum(X) / N)

	print(int(np.sum((X-m)**2)))

if __name__ == '__main__':

	main()

# optimized version of the same code:

import sys

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

printV = lambda x: print(*x, sep="\n")

printH = lambda x: print(" ".join(map(str,x)))

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

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

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

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

def LI1(): return list(map(int1, sys.stdin.readline().split()))

def LII(rows_number): return [II() for _ in range(rows_number)]

def LLI(rows_number): return [LI() for _ in range(rows_number)]

def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():

	N = II()

	X = LI()

	m = round(sum(X) / N)

	ans = 0

	for x in X:

		ans += ((x-m)**2)

	print(ans)

if __name__ == '__main__':

	main()

import sys
import numpy as np

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str, x)))

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

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

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

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

def LI1():
    return list(map(int1, sys.stdin.readline().split()))

def LII(rows_number):
    return [II() for _ in range(rows_number)]

def LLI(rows_number):
    return [LI() for _ in range(rows_number)]

def LLI1(rows_number):
    return [LI1() for _ in range(rows_number)]

def main():
    N = II()
    X = LI()
    X = np.array(X)
    m = round(np.sum(X) / N)
    print(int(np.sum((X - m) ** 2)))

if __name__ == "__main__":
    main()

import sys

sys.setrecursionlimit(10**6)
int1 = lambda x: int(x) - 1
printV = lambda x: print(*x, sep="\n")
printH = lambda x: print(" ".join(map(str, x)))

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

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

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

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

def LI1():
    return list(map(int1, sys.stdin.readline().split()))

def LII(rows_number):
    return [II() for _ in range(rows_number)]

def LLI(rows_number):
    return [LI() for _ in range(rows_number)]

def LLI1(rows_number):
    return [LI1() for _ in range(rows_number)]

def main():
    N = II()
    X = LI()
    m = round(sum(X) / N)
    ans = 0
    for x in X:
        ans += (x - m) ** 2
    print(ans)

if __name__ == "__main__":
    main()

-import numpy as np
-    X = np.array(X)
-    m = round(np.sum(X) / N)
-    print(int(np.sum((X - m) ** 2)))
+    m = round(sum(X) / N)
+    ans = 0
+    for x in X:
+        ans += (x - m) ** 2
+    print(ans)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

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

RD = list(list(map(int, input().split())) for _ in range(m))

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

    ans = 0

    for j in RD:

        ans += j.count(i)

    print(ans)

# optimized version of the same code:

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

NRD = list(0 for i in range(n))

for i in range(m):

    r1, r2 = list(map(int, input().split()))

    NRD[r1 - 1] += 1

    NRD[r2 - 1] += 1

for i in range(n):

    print((NRD[i]))

-RD = list(list(map(int, input().split())) for _ in range(m))

+    r1, r2 = 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()))

ans=a*x+b*y

for HaH in range(0,2*max(x,y)+1,2):

    ans = min(ans, c*HaH+max(0, a*(x-HaH//2))+max(0, b*(y-HaH//2)))

print(ans)

# optimized version of the same code:

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

ans=0

m=min(x,y)

if a+b>=2*c: #Half and Half購入で安くなる可能性あるパターン

    # HaHをm枚買って残りHaH購入,または全部HaH購入,このいずれかしかあり得ない

    ans = min(2*c*m+a*(x-m)+b*(y-m), 2*c*max(x,y))

else:

    ans = a*x+b*y

print(ans)

a, b, c, x, y = list(map(int, input().split()))
ans = a * x + b * y
for HaH in range(0, 2 * max(x, y) + 1, 2):
    ans = min(ans, c * HaH + max(0, a * (x - HaH // 2)) + max(0, b * (y - HaH // 2)))
print(ans)

a, b, c, x, y = list(map(int, input().split()))
ans = 0
m = min(x, y)
if a + b >= 2 * c:  # Half and Half購入で安くなる可能性あるパターン
    # HaHをm枚買って残りHaH購入,または全部HaH購入,このいずれかしかあり得ない
    ans = min(2 * c * m + a * (x - m) + b * (y - m), 2 * c * max(x, y))
else:
    ans = a * x + b * y
print(ans)

-for HaH in range(0, 2 * max(x, y) + 1, 2):

+if a + b >= 2 * c:  # Half and Half購入で安くなる可能性あるパターン

+    # HaHをm枚買って残りHaH購入,または全部HaH購入,このいずれかしかあり得ない


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

sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))

N, L = lr()

A = np.arange(1, N+1)

A += (L - 1)

answer = A.sum() - A[np.argmin(np.abs(A))]

print(answer)

# optimized version of the same code:

import sys

sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))

N, L = lr()

total = sum(range(L, L+N))

sub = min(list(range(L, L+N)), key=abs)

print((total-sub))

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, L = lr()
A = np.arange(1, N + 1)
A += L - 1
answer = A.sum() - A[np.argmin(np.abs(A))]
print(answer)

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N, L = lr()
total = sum(range(L, L + N))
sub = min(list(range(L, L + N)), key=abs)
print((total - sub))

-answer = A.sum() - A[np.argmin(np.abs(A))]

+sub = min(list(range(L, L + N)), key=abs)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import numpy as np

def main():

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

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

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

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

    AB = np.array(np.meshgrid(A, B)).T.reshape(-1, 2).sum(axis=1)

    AB[::-1].sort()

    AB = AB[:min([K, X * Y])]

    ABC = np.array(np.meshgrid(AB, C)).T.reshape(-1, 2).sum(axis=1)

    ABC[::-1].sort()

    for ans in ABC[:K]:

        print(ans)

if __name__ == '__main__':

    main()

# optimized version of the same code:

from heapq import heappush, heappop

from collections import defaultdict

def main():

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

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

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

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

    A.sort(reverse=True)

    B.sort(reverse=True)

    C.sort(reverse=True)

    que = [(- A[0] - B[0] - C[0], 0, 0, 0)]  # multiply -1 to change min to max

    already_inserted = defaultdict(int)

    answer = list()

    for _ in range(K):

        q, i, j, k = heappop(que)

        answer.append(-q)

        if i + 1 < X:

            item_a = (- A[i + 1] - B[j] - C[k], i + 1, j, k)

            if already_inserted[item_a] == 0:

                heappush(que, item_a)

                already_inserted[item_a] = 1

        if j + 1 < Y:

            item_b = (- A[i] - B[j + 1] - C[k], i, j + 1, k)

            if already_inserted[item_b] == 0:

                heappush(que, item_b)

                already_inserted[item_b] = 1

        if k + 1 < Z:

            item_c = (- A[i] - B[j] - C[k + 1], i, j, k + 1)

            if already_inserted[item_c] == 0:

                heappush(que, item_c)

                already_inserted[item_c] = 1

    for ans in answer:

        print(ans)

if __name__ == '__main__':

    main()

import numpy as np

def main():
    X, Y, Z, K = list(map(int, input().split(" ")))
    A = np.array(list(map(int, input().split(" "))))
    B = np.array(list(map(int, input().split(" "))))
    C = np.array(list(map(int, input().split(" "))))
    AB = np.array(np.meshgrid(A, B)).T.reshape(-1, 2).sum(axis=1)
    AB[::-1].sort()
    AB = AB[: min([K, X * Y])]
    ABC = np.array(np.meshgrid(AB, C)).T.reshape(-1, 2).sum(axis=1)
    ABC[::-1].sort()
    for ans in ABC[:K]:
        print(ans)

if __name__ == "__main__":
    main()

from heapq import heappush, heappop
from collections import defaultdict

def main():
    X, Y, Z, K = list(map(int, input().split(" ")))
    A = list(map(int, input().split(" ")))
    B = list(map(int, input().split(" ")))
    C = list(map(int, input().split(" ")))
    A.sort(reverse=True)
    B.sort(reverse=True)
    C.sort(reverse=True)
    que = [(-A[0] - B[0] - C[0], 0, 0, 0)]  # multiply -1 to change min to max
    already_inserted = defaultdict(int)
    answer = list()
    for _ in range(K):
        q, i, j, k = heappop(que)
        answer.append(-q)
        if i + 1 < X:
            item_a = (-A[i + 1] - B[j] - C[k], i + 1, j, k)
            if already_inserted[item_a] == 0:
                heappush(que, item_a)
                already_inserted[item_a] = 1
        if j + 1 < Y:
            item_b = (-A[i] - B[j + 1] - C[k], i, j + 1, k)
            if already_inserted[item_b] == 0:
                heappush(que, item_b)
                already_inserted[item_b] = 1
        if k + 1 < Z:
            item_c = (-A[i] - B[j] - C[k + 1], i, j, k + 1)
            if already_inserted[item_c] == 0:
                heappush(que, item_c)
                already_inserted[item_c] = 1
    for ans in answer:
        print(ans)

if __name__ == "__main__":
    main()

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

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

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

-    AB = np.array(np.meshgrid(A, B)).T.reshape(-1, 2).sum(axis=1)

-    ABC = np.array(np.meshgrid(AB, C)).T.reshape(-1, 2).sum(axis=1)

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

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

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

+    que = [(-A[0] - B[0] - C[0], 0, 0, 0)]  # multiply -1 to change min to max

+    already_inserted = defaultdict(int)

+            if already_inserted[item_a] == 0:

+                already_inserted[item_a] = 1

+            if already_inserted[item_b] == 0:

+                already_inserted[item_b] = 1

+            if already_inserted[item_c] == 0:

+                already_inserted[item_c] = 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()))

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

cnt = 0

for i in x:

  while i % 2 == 0:

    cnt += 1

    i /= 2

print(cnt)

# optimized version of the same code:

n = int(eval(input()))

ans = 0

for i in map(int, input().split()):

    cnt = 0

    while i % 2 == 0:

        i >>= 1

        cnt += 1

    ans += cnt

print(ans)

-N = int(eval(input()))
-x = list(map(int, input().split()))
-cnt = 0
-for i in x:
+n = int(eval(input()))
+ans = 0
+for i in map(int, input().split()):
+    cnt = 0
+        i >>= 1
-        i /= 2
-print(cnt)
+    ans += cnt
+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:

# coding: utf-8

import sys

import numpy as np

sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))

H, W = lr()

B = np.array([list(sr()) for _ in range(H)])

A = [[1 if x == '#' else 0 for x in b] for b in B]

row = np.sum(A, axis=1)

column = np.sum(A, axis=0)

r = row != 0

c = column != 0

answer = B[r]

answer = answer[:, c].tolist()

for a in answer:

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

# optimized version of the same code:

# coding: utf-8

import sys

sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))

H, W = lr()

A = [sr() for _ in range(H)]

B = []

for a in A:

    if '#' in a:

        B.append(a)

B = zip(*[b for b in zip(*B) if '#' in b])

for b in B:

    print(*b, sep='')

# coding: utf-8
import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
B = np.array([list(sr()) for _ in range(H)])
A = [[1 if x == "#" else 0 for x in b] for b in B]
row = np.sum(A, axis=1)
column = np.sum(A, axis=0)
r = row != 0
c = column != 0
answer = B[r]
answer = answer[:, c].tolist()
for a in answer:
    print(("".join(a)))

# coding: utf-8
import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
H, W = lr()
A = [sr() for _ in range(H)]
B = []
for a in A:
    if "#" in a:
        B.append(a)
B = zip(*[b for b in zip(*B) if "#" in b])
for b in B:
    print(*b, sep="")

-B = np.array([list(sr()) for _ in range(H)])

-A = [[1 if x == "#" else 0 for x in b] for b in B]

+B = zip(*[b for b in zip(*B) if "#" in b])


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

def popcount(x):

    x = x - ((x >> 1) & 0x55555555)

    x = (x & 0x33333333) + ((x >> 2) & 0x33333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f

    x = x + (x >> 8)

    x = x + (x >> 16)

    return x & 0x0000007f

cmb=[[0 for i in range(51)] for j in range(51)]

cmb[0][0]=1

for i in range(51):

    for j in range(51):

        if i!=50 and j!=50:

            cmb[i+1][j+1]+=cmb[i][j]

        if i!=50:

            cmb[i+1][j]+=cmb[i][j]

for i in range(1,51):

    for j in range(2,51):

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

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

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

must0=[i for i in range(18) if S>>i &1==0]

must1=[i for i in range(18) if T>>i &1==1]

A=[]

for val in a:

    check=True

    for j in must0:

        check=check&(val>>j &1==0)

    for j in must1:

        check=check&(val>>j &1==1)

    if check:

        A.append(val)

if not A:

    print((0))

    exit()

bit=[]

for i in range(18):

    if i not in must0 and i not in must1:

        bit.append(i)

for i in range(len(A)):

    temp=0

    for j in range(len(bit)):

        temp+=(A[i]>>bit[j] &1==1)*2**j

    A[i]=temp

ans=0

n=len(bit)

data=[0]*(2**n)

for i in range(2**n):

    t=set([])

    for a in A:

        data[a&i]+=1

        t.add(a&i)

    temp=0

    for val in t:

        temp+=cmb[data[val]][min(K,data[val])]

    ans+=temp*(-1)**popcount(i)

    for val in t:

        data[val]=0

print(ans)

# optimized version of the same code:

def popcount(x):

    x = x - ((x >> 1) & 0x55555555)

    x = (x & 0x33333333) + ((x >> 2) & 0x33333333)

    x = (x + (x >> 4)) & 0x0f0f0f0f

    x = x + (x >> 8)

    x = x + (x >> 16)

    return x & 0x0000007f

cmb=[[0 for i in range(51)] for j in range(51)]

cmb[0][0]=1

for i in range(51):

    for j in range(51):

        if i!=50:

            cmb[i+1][j]+=cmb[i][j]

        if j!=50 and i!=50:

            cmb[i+1][j+1]+=cmb[i][j]

for i in range(1,51):

    for j in range(2,51):

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

import random

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

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

must0=[i for i in range(18) if S>>i &1==0]

must1=[i for i in range(18) if T>>i &1==1]

A=[]

for val in a:

    check=True

    for j in must0:

        check=check&(val>>j &1==0)

    for j in must1:

        check=check&(val>>j &1==1)

    if check:

        A.append(val)

if not A:

    print((0))

    exit()

bit=[]

for i in range(18):

    if i not in must0 and i not in must1:

        bit.append(i)

for i in range(len(A)):

    temp=0

    for j in range(len(bit)):

        temp+=(A[i]>>bit[j] &1==1)*2**j

    A[i]=temp

ans=0

n=len(bit)

data=[0]*(2**n)

pc=[popcount(i) for i in range(2**n)]

for i in range(2**n):

    for a in A:

        data[a&i]+=1

    for a in A:

        if data[a&i]:

            ans+=cmb[data[a&i]][min(K,data[a&i])]*(-1)**pc[i]

            data[a&i]=0

print(ans)

def popcount(x):
    x = x - ((x >> 1) & 0x55555555)
    x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
    x = (x + (x >> 4)) & 0x0F0F0F0F
    x = x + (x >> 8)
    x = x + (x >> 16)
    return x & 0x0000007F

cmb = [[0 for i in range(51)] for j in range(51)]
cmb[0][0] = 1
for i in range(51):
    for j in range(51):
        if i != 50 and j != 50:
            cmb[i + 1][j + 1] += cmb[i][j]
        if i != 50:
            cmb[i + 1][j] += cmb[i][j]
for i in range(1, 51):
    for j in range(2, 51):
        cmb[i][j] += cmb[i][j - 1]
N, K, T, S = list(map(int, input().split()))
a = list(map(int, input().split()))
must0 = [i for i in range(18) if S >> i & 1 == 0]
must1 = [i for i in range(18) if T >> i & 1 == 1]
A = []
for val in a:
    check = True
    for j in must0:
        check = check & (val >> j & 1 == 0)
    for j in must1:
        check = check & (val >> j & 1 == 1)
    if check:
        A.append(val)
if not A:
    print((0))
    exit()
bit = []
for i in range(18):
    if i not in must0 and i not in must1:
        bit.append(i)
for i in range(len(A)):
    temp = 0
    for j in range(len(bit)):
        temp += (A[i] >> bit[j] & 1 == 1) * 2**j
    A[i] = temp
ans = 0
n = len(bit)
data = [0] * (2**n)
for i in range(2**n):
    t = set([])
    for a in A:
        data[a & i] += 1
        t.add(a & i)
    temp = 0
    for val in t:
        temp += cmb[data[val]][min(K, data[val])]
    ans += temp * (-1) ** popcount(i)
    for val in t:
        data[val] = 0
print(ans)

def popcount(x):
    x = x - ((x >> 1) & 0x55555555)
    x = (x & 0x33333333) + ((x >> 2) & 0x33333333)
    x = (x + (x >> 4)) & 0x0F0F0F0F
    x = x + (x >> 8)
    x = x + (x >> 16)
    return x & 0x0000007F

cmb = [[0 for i in range(51)] for j in range(51)]
cmb[0][0] = 1
for i in range(51):
    for j in range(51):
        if i != 50:
            cmb[i + 1][j] += cmb[i][j]
        if j != 50 and i != 50:
            cmb[i + 1][j + 1] += cmb[i][j]
for i in range(1, 51):
    for j in range(2, 51):
        cmb[i][j] += cmb[i][j - 1]
import random

N, K, T, S = list(map(int, input().split()))
a = list(map(int, input().split()))
must0 = [i for i in range(18) if S >> i & 1 == 0]
must1 = [i for i in range(18) if T >> i & 1 == 1]
A = []
for val in a:
    check = True
    for j in must0:
        check = check & (val >> j & 1 == 0)
    for j in must1:
        check = check & (val >> j & 1 == 1)
    if check:
        A.append(val)
if not A:
    print((0))
    exit()
bit = []
for i in range(18):
    if i not in must0 and i not in must1:
        bit.append(i)
for i in range(len(A)):
    temp = 0
    for j in range(len(bit)):
        temp += (A[i] >> bit[j] & 1 == 1) * 2**j
    A[i] = temp
ans = 0
n = len(bit)
data = [0] * (2**n)
pc = [popcount(i) for i in range(2**n)]
for i in range(2**n):
    for a in A:
        data[a & i] += 1
    for a in A:
        if data[a & i]:
            ans += cmb[data[a & i]][min(K, data[a & i])] * (-1) ** pc[i]
            data[a & i] = 0
print(ans)

+pc = [popcount(i) for i in range(2**n)]

-        temp += cmb[data[val]][min(K, data[val])]

+            ans += cmb[data[a & i]][min(K, data[a & i])] * (-1) ** pc[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 sys

#import numpy as np

s2nn = lambda s: [int(c) for c in s.split(' ')]

ss2nn = lambda ss: [int(s) for s in ss]

ss2nnn = lambda ss: [s2nn(s) for s in ss]

i2s = lambda: sys.stdin.readline().rstrip()

i2n = lambda: int(i2s())

i2nn = lambda: s2nn(i2s())

ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]

ii2nn = lambda n: ss2nn(ii2ss(n))

ii2nnn = lambda n: ss2nnn(ii2ss(n))

N = 10000

def tokey(i, j, k):

    return i*N*N + j*N + k

def dekey(n):

    i = int(n / N / N)

    j = int(n / N) % N

    k = n % N

    return i, j, k

def main():

    X, Y, Z, K = i2nn()

    A = i2nn()

    B = i2nn()

    C = i2nn()

    A.sort()

    A.reverse()

    B.sort()

    B.reverse()

    C.sort()

    C.reverse()

    Q = [(A[0] + B[0] + C[0], 0, 0, 0)]

    loop = 0

    stored = set()

    def next(i, j, k):

        if i >= X or j >= Y or k >= Z:

            return

        key = tokey(i, j, k)

        if key not in stored:

            stored.add(key)

            n = A[i] + B[j] + C[k]

            Q.append((n, i, j, k))

    while True:

        v = max(Q, key=lambda v: v[0])

        Q.remove(v)

        print((v[0]))

        loop += 1

        if loop >= K:

            break

        next(v[1]+1, v[2], v[3])

        next(v[1], v[2]+1, v[3])

        next(v[1], v[2], v[3]+1)

main()

# optimized version of the same code:

import sys

from collections import deque  # 双方向キュー

from collections import defaultdict  # 初期化済み辞書

from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー

from bisect import bisect_left, bisect_right  # 二分探索

#import numpy as np  # 1.8.2

#import scipy  # 0.13.3

#sys.setrecursionlimit(int(1e+6))

s2nn = lambda s: [int(c) for c in s.split(' ')]

ss2nn = lambda ss: [int(s) for s in ss]

ss2nnn = lambda ss: [s2nn(s) for s in ss]

i2s = lambda: sys.stdin.readline().rstrip()

i2n = lambda: int(i2s())

i2nn = lambda: s2nn(i2s())

ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]

ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]

ii2nn = lambda n: ss2nn(ii2ss(n))

ii2nnn = lambda n: ss2nnn(ii2ss(n))

MOD = int(1e+9) + 7

def main():

    X, Y, Z, K = i2nn()

    A = i2nn()

    B = i2nn()

    C = i2nn()

    A.sort()

    A.reverse()

    B.sort()

    B.reverse()

    C.sort()

    C.reverse()

    s = set()

    hq = []

    n = 0

    heappush(hq, ((A[0] + B[0] + C[0]) * -1, (0, 0, 0)))

    while n < K:

        t, abc = heappop(hq)

        if abc in s:

            continue

        s.add(abc)

        (a, b, c) = abc

        if a+1 < X:

            heappush(hq, ((A[a+1] + B[b] + C[c]) * -1, (a+1, b, c)))

        if b+1 < Y:

            heappush(hq, ((A[a] + B[b+1] + C[c]) * -1, (a, b+1, c)))

        if c+1 < Z:

            heappush(hq, ((A[a] + B[b] + C[c+1]) * -1, (a, b, c+1)))

        print((-t))

        n += 1

main()

import sys

# import numpy as np
s2nn = lambda s: [int(c) for c in s.split(" ")]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))
N = 10000

def tokey(i, j, k):
    return i * N * N + j * N + k

def dekey(n):
    i = int(n / N / N)
    j = int(n / N) % N
    k = n % N
    return i, j, k

def main():
    X, Y, Z, K = i2nn()
    A = i2nn()
    B = i2nn()
    C = i2nn()
    A.sort()
    A.reverse()
    B.sort()
    B.reverse()
    C.sort()
    C.reverse()
    Q = [(A[0] + B[0] + C[0], 0, 0, 0)]
    loop = 0
    stored = set()

    def next(i, j, k):
        if i >= X or j >= Y or k >= Z:
            return
        key = tokey(i, j, k)
        if key not in stored:
            stored.add(key)
            n = A[i] + B[j] + C[k]
            Q.append((n, i, j, k))

    while True:
        v = max(Q, key=lambda v: v[0])
        Q.remove(v)
        print((v[0]))
        loop += 1
        if loop >= K:
            break
        next(v[1] + 1, v[2], v[3])
        next(v[1], v[2] + 1, v[3])
        next(v[1], v[2], v[3] + 1)

main()

import sys
from collections import deque  # 双方向キュー
from collections import defaultdict  # 初期化済み辞書
from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー
from bisect import bisect_left, bisect_right  # 二分探索

# import numpy as np  # 1.8.2
# import scipy  # 0.13.3
# sys.setrecursionlimit(int(1e+6))
s2nn = lambda s: [int(c) for c in s.split(" ")]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))
MOD = int(1e9) + 7

def main():
    X, Y, Z, K = i2nn()
    A = i2nn()
    B = i2nn()
    C = i2nn()
    A.sort()
    A.reverse()
    B.sort()
    B.reverse()
    C.sort()
    C.reverse()
    s = set()
    hq = []
    n = 0
    heappush(hq, ((A[0] + B[0] + C[0]) * -1, (0, 0, 0)))
    while n < K:
        t, abc = heappop(hq)
        if abc in s:
            continue
        s.add(abc)
        (a, b, c) = abc
        if a + 1 < X:
            heappush(hq, ((A[a + 1] + B[b] + C[c]) * -1, (a + 1, b, c)))
        if b + 1 < Y:
            heappush(hq, ((A[a] + B[b + 1] + C[c]) * -1, (a, b + 1, c)))
        if c + 1 < Z:
            heappush(hq, ((A[a] + B[b] + C[c + 1]) * -1, (a, b, c + 1)))
        print((-t))
        n += 1

main()

+from collections import deque  # 双方向キュー

+from collections import defaultdict  # 初期化済み辞書

+from heapq import heapify, heappush, heappop, heappushpop  # プライオリティキュー

+from bisect import bisect_left, bisect_right  # 二分探索

+ii2sss = lambda n: [list(sys.stdin.readline().rstrip()) for _ 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 sys

from fractions import gcd

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

sys.setrecursionlimit(10 ** 9)

INF = 1 << 60

def lcm(x, y):

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

def main():

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

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

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

    semi_lcm = 1

    for a in A:

        semi_lcm = lcm(semi_lcm, a)

        if semi_lcm > M:

            print((0))

            return

    for a in A:

        if semi_lcm // a % 2 == 0:

            print((0))

            return

    print(((M // semi_lcm + 1) // 2))

    return

if __name__ == '__main__':

    main()

# optimized version of the same code:

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

sys.setrecursionlimit(10 ** 9)

INF = 1 << 60

def gcd(a, b):

    while b:

        a, b = b, a % b

    return a

def lcm(a, b):

    return a * b // gcd(a, b)

def main():

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

    A = list(set(A))

    B = A.copy()

    while not any(b % 2 for b in B):

        B = [b // 2 for b in B]

    if not all(b % 2 for b in B):

        print((0))

        return

    semi_lcm = 1

    for a in A:

        semi_lcm = lcm(semi_lcm, a // 2)

    print(((M // semi_lcm + 1) // 2))

    return

if __name__ == '__main__':

    main()

import sys
from fractions import gcd

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60

def lcm(x, y):
    return x * y // gcd(x, y)

def main():
    N, M = list(map(int, input().split()))
    A = list(set(map(int, input().split(" "))))
    A = [a // 2 for a in A]
    semi_lcm = 1
    for a in A:
        semi_lcm = lcm(semi_lcm, a)
        if semi_lcm > M:
            print((0))
            return
    for a in A:
        if semi_lcm // a % 2 == 0:
            print((0))
            return
    print(((M // semi_lcm + 1) // 2))
    return

if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10**9)
INF = 1 << 60

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def lcm(a, b):
    return a * b // gcd(a, b)

def main():
    N, M, *A = list(map(int, read().split()))
    A = list(set(A))
    B = A.copy()
    while not any(b % 2 for b in B):
        B = [b // 2 for b in B]
    if not all(b % 2 for b in B):
        print((0))
        return
    semi_lcm = 1
    for a in A:
        semi_lcm = lcm(semi_lcm, a // 2)
    print(((M // semi_lcm + 1) // 2))
    return

if __name__ == "__main__":
    main()

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

-    A = list(set(map(int, input().split(" "))))

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

+        semi_lcm = lcm(semi_lcm, a // 2)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import numpy as np

s = eval(input())

y = 2019

dp = np.zeros(y, dtype="int64")

tmp = np.zeros(y, dtype="int64")

k = 1

r = 0

for c in s[::-1]:

    i = int(c)*k%y

    tmp[i:] = dp[:y-i]

    tmp[:i] = dp[y-i:]

    tmp[i] += 1

    dp, tmp = tmp, dp

    r += dp[0]

    k *= 10

    k %= y

print(r)

# optimized version of the same code:

import numpy as np

s = eval(input())
y = 2019
dp = np.zeros(y, dtype="int64")
tmp = np.zeros(y, dtype="int64")
k = 1
r = 0
for c in s[::-1]:
    i = int(c) * k % y
    tmp[i:] = dp[: y - i]
    tmp[:i] = dp[y - i :]
    tmp[i] += 1
    dp, tmp = tmp, dp
    r += dp[0]
    k *= 10
    k %= y
print(r)

-import numpy as np
-s = eval(input())
-dp = np.zeros(y, dtype="int64")
-tmp = np.zeros(y, dtype="int64")
+a = [0] * y
-r = 0
-for c in s[::-1]:
-    i = int(c) * k % y
-    tmp[i:] = dp[: y - i]
-    tmp[:i] = dp[y - i :]
-    tmp[i] += 1
-    dp, tmp = tmp, dp
-    r += dp[0]
+r = p = 0
+for c in input()[::-1]:
+    a[p] += 1
+    p -= int(c) * k
+    p %= y
+    r += a[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 sys

import numpy as np

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

if M == 0:

    if N == 1:

        print("0")

    else:

        ans = [0] * N

        ans[0] = 1

        print(("".join(map(str, ans))))

    sys.exit()

S, C = np.array([[int(_) for _ in input().split()] for i in range(M)]).T

ans = [-1] * N

for i in range(M):

    j = int(S[i]) - 1

    if ans[j] == -1 or ans[j] == C[i]:

        ans[j] = C[i]

    else:

        print("-1")

        sys.exit()

if N >= 2 and ans[0] == 0:

    print("-1")

    sys.exit()

if N >= 2 and ans[0] == -1:

    ans[0] = 1

for i in range(1, N):

    if ans[i] == -1:

        ans[i] = 0

s = "".join(map(str, ans))

print(s)

# optimized version of the same code:

import sys

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

SC = [[int(_) for _ in input().split()] for i in range(M)]

if N == 1:

    start = 0

    end = 10

else:

    start = 10 ** (N - 1)

    end = 10 ** N

for i in range(start, end):

    ans = list(map(int, str(i)))

    valid = True

    for s, c in SC:

        if ans[s-1] != c:

            valid = False

            break

    if valid:

        print(i)

        sys.exit()

print((-1))

import sys

N, M = [int(_) for _ in input().split()]
SC = [[int(_) for _ in input().split()] for i in range(M)]
if N == 1:
    start = 0
    end = 10
else:
    start = 10 ** (N - 1)
    end = 10**N
for i in range(start, end):
    ans = list(map(int, str(i)))
    valid = True
    for s, c in SC:
        if ans[s - 1] != c:
            valid = False
            break
    if valid:
        print(i)
        sys.exit()
print((-1))

-        print(("".join(map(str, ans))))

-S, C = np.array([[int(_) for _ in input().split()] for i in range(M)]).T

+SC = [[int(_) for _ in input().split()] for i in range(M)]


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import numpy

N=int(eval(input()))

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

B=list(numpy.cumsum(A))+[0]

C=sorted(B)

d=C[0]

cnt=1

ans=0

for i in range(N):

  if C[i+1]==d:

    cnt+=1

  else:

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

    cnt=1

    d=C[i+1]

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

print(ans)

# optimized version of the same code:

N=int(eval(input()))

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

D=[0]

d=0

for i in A:

  d+=i

  D.append(d)

D=sorted(D)

ans=0

d=-10**9+1

D.append(10**9+1)

cnt=0

for i in range(N+2):

  if D[i]==d:

    cnt+=1

  else:

    if cnt>1:

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

      cnt=1

    else:

      cnt=1

    d=D[i]

print(ans)

import numpy

N = int(eval(input()))
A = list(map(int, input().split()))
B = list(numpy.cumsum(A)) + [0]
C = sorted(B)
d = C[0]
cnt = 1
ans = 0
for i in range(N):
    if C[i + 1] == d:
        cnt += 1
    else:
        ans += cnt * (cnt - 1) // 2
        cnt = 1
        d = C[i + 1]
ans += cnt * (cnt - 1) // 2
print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
D = [0]
d = 0
for i in A:
    d += i
    D.append(d)
D = sorted(D)
ans = 0
d = -(10**9) + 1
D.append(10**9 + 1)
cnt = 0
for i in range(N + 2):
    if D[i] == d:
        cnt += 1
    else:
        if cnt > 1:
            ans += cnt * (cnt - 1) // 2
            cnt = 1
        else:
            cnt = 1
        d = D[i]
print(ans)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

sys.setrecursionlimit(10**6)

def dfs(v,p,d):

    for i, j in tree[v]:

        if i != p:

            depth[i] = d + j

            dfs(i,v,d+j)

N = int(eval(input()))

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

for i in range(N-1):

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

    a -= 1

    b -= 1

    tree[a].append((b,c))

    tree[b].append((a,c))

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

depth = [0 for i in range(N)]

depth[K-1] = 0

dfs(K-1,-1,0)

for _ in range(Q):

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

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

# optimized version of the same code:

import heapq

import sys

input = sys.stdin.readline

def dijkstra(s, edge, N):

    d = [float('inf')] * N

    used = [True] * N

    d[s] = 0

    used[s] = False

    edgelist = []

    for a, b in edge[s]:

        heapq.heappush(edgelist, a * (10 ** 6) + b)

    while len(edgelist):

        minedge = heapq.heappop(edgelist)

        if not used[minedge%(10 ** 6)]:

            continue

        v = minedge % (10 ** 6)

        d[v] = minedge // (10 ** 6)

        used[v] = False

        for e in edge[v]:

            if used[e[1]]:

                heapq.heappush(edgelist, (e[0] + d[v]) * (10 ** 6) + e[1])

    return d

def main():

    N = int(eval(input()))

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

    for _ in range(N-1):

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

        a -= 1

        b -= 1

        edge[a].append([c,b])

        edge[b].append([c,a])

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

    K -= 1

    d = dijkstra(K, edge, N)

    for _ in range(Q):

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

        x -= 1

        y -= 1

        print((d[x] + d[y]))

if __name__ == "__main__":

    main()

import sys

sys.setrecursionlimit(10**6)

def dfs(v, p, d):
    for i, j in tree[v]:
        if i != p:
            depth[i] = d + j
            dfs(i, v, d + j)

N = int(eval(input()))
tree = [[] for _ in range(N)]
for i in range(N - 1):
    a, b, c = list(map(int, input().split()))
    a -= 1
    b -= 1
    tree[a].append((b, c))
    tree[b].append((a, c))
Q, K = list(map(int, input().split()))
depth = [0 for i in range(N)]
depth[K - 1] = 0
dfs(K - 1, -1, 0)
for _ in range(Q):
    x, y = list(map(int, input().split()))
    print((depth[x - 1] + depth[y - 1]))

import heapq
import sys

input = sys.stdin.readline

def dijkstra(s, edge, N):
    d = [float("inf")] * N
    used = [True] * N
    d[s] = 0
    used[s] = False
    edgelist = []
    for a, b in edge[s]:
        heapq.heappush(edgelist, a * (10**6) + b)
    while len(edgelist):
        minedge = heapq.heappop(edgelist)
        if not used[minedge % (10**6)]:
            continue
        v = minedge % (10**6)
        d[v] = minedge // (10**6)
        used[v] = False
        for e in edge[v]:
            if used[e[1]]:
                heapq.heappush(edgelist, (e[0] + d[v]) * (10**6) + e[1])
    return d

def main():
    N = int(eval(input()))
    edge = [[] for _ in range(N)]
    for _ in range(N - 1):
        a, b, c = list(map(int, input().split()))
        a -= 1
        b -= 1
        edge[a].append([c, b])
        edge[b].append([c, a])
    Q, K = list(map(int, input().split()))
    K -= 1
    d = dijkstra(K, edge, N)
    for _ in range(Q):
        x, y = list(map(int, input().split()))
        x -= 1
        y -= 1
        print((d[x] + d[y]))

if __name__ == "__main__":
    main()

+        heapq.heappush(edgelist, a * (10**6) + b)

+        minedge = heapq.heappop(edgelist)

+        if not used[minedge % (10**6)]:

+                heapq.heappush(edgelist, (e[0] + d[v]) * (10**6) + e[1])

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

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

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

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

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

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


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import math

n = int(eval(input()))

power = math.factorial(n)

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

# optimized version of the same code:

import math

n = int(eval(input()))

power = 1

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

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

print(power)

import math

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

-power = math.factorial(n)
-print((power % (10**9 + 7)))
+power = 1
+for i in range(1, n + 1):
+    power = i * power % (10**9 + 7)
+print(power)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

#!/usr/bin/env python3

import sys

INF = float("inf")

from bisect import bisect_left

def solve(N: int, K: int, A: "List[int]", F: "List[int]"):

    A.sort()

    F.sort(reverse=True)

    h = []

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

        h.append((a*f, a, f))

    h.sort()

    maxtime = h[-1][0]

    def isOK(y):

        i = bisect_left(h, (y+1, -1, -1))

        counter = 0

        # print(h[i:])

        for p, a, f in h[i:]:

            counter += a-y//f

        return counter <= K

    def binary_search(x):

        ng = -1

        ok = len(x)

        while abs(ok - ng) > 1:

            mid = (ok + ng)//2

            # print("mid: {}, in ({}, {})".format(mid, ng, ok))

            if isOK(mid):

                ok = mid

            else:

                ng = mid

        return ng, ok

    ng, ok = binary_search(list(range(maxtime)))

    print(ok)

    # while k > 0:

    #     p1, a1, f1 = heapq.heappop(h)

    #     p2, a2, f2 = heapq.heappop(h)

    #     p1, p2 = -p1, -p2

    #     sub = min(a1 - math.ceil((p2/f1)-1), k)

    #     a1 -= sub

    #     k -= sub

    #     heapq.heappush(h, (-a1*f1, a1, f1))

    #     heapq.heappush(h, (-a2*f2, a2, f2))

    # # print(h)

    # p, a, f = heapq.heappop(h)

    # print(-p)

    return

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

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

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

    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"

    F = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"

    solve(N, K, A, F)

if __name__ == '__main__':

    main()

# optimized version of the same code:

#!/usr/bin/env python3

import sys

INF = float("inf")

import numpy as np

def solve(N: int, K: int, A: "List[int]", F: "List[int]"):

    A.sort()

    F.sort(reverse=True)

    A = np.asarray(A, dtype=np.int)

    F = np.asarray(F, dtype=np.int)

    Asum = A.sum()

    def isOK(y):

        return Asum-np.minimum(A, y//F).sum() <= K

    def binary_search(x):

        ng = -1

        ok = len(x)

        while abs(ok - ng) > 1:

            mid = (ok + ng)//2

            # print("mid: {}, in ({}, {})".format(mid, ng, ok))

            if isOK(mid):

                ok = mid

            else:

                ng = mid

        return ng, ok

    ng, ok = binary_search(list(range(A.max()*F.max())))

    print(ok)

    # while k > 0:

    #     p1, a1, f1 = heapq.heappop(h)

    #     p2, a2, f2 = heapq.heappop(h)

    #     p1, p2 = -p1, -p2

    #     sub = min(a1 - math.ceil((p2/f1)-1), k)

    #     a1 -= sub

    #     k -= sub

    #     heapq.heappush(h, (-a1*f1, a1, f1))

    #     heapq.heappush(h, (-a2*f2, a2, f2))

    # # print(h)

    # p, a, f = heapq.heappop(h)

    # print(-p)

    return

def main():

    def iterate_tokens():

        for line in sys.stdin:

            for word in line.split():

                yield word

    tokens = iterate_tokens()

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

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

    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"

    F = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"

    solve(N, K, A, F)

if __name__ == '__main__':

    main()

#!/usr/bin/env python3
import sys

INF = float("inf")
from bisect import bisect_left

def solve(N: int, K: int, A: "List[int]", F: "List[int]"):
    A.sort()
    F.sort(reverse=True)
    h = []
    for a, f in zip(A, F):
        h.append((a * f, a, f))
    h.sort()
    maxtime = h[-1][0]

    def isOK(y):
        i = bisect_left(h, (y + 1, -1, -1))
        counter = 0
        # print(h[i:])
        for p, a, f in h[i:]:
            counter += a - y // f
        return counter <= K

    def binary_search(x):
        ng = -1
        ok = len(x)
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            # print("mid: {}, in ({}, {})".format(mid, ng, ok))
            if isOK(mid):
                ok = mid
            else:
                ng = mid
        return ng, ok

    ng, ok = binary_search(list(range(maxtime)))
    print(ok)
    # while k > 0:
    #     p1, a1, f1 = heapq.heappop(h)
    #     p2, a2, f2 = heapq.heappop(h)
    #     p1, p2 = -p1, -p2
    #     sub = min(a1 - math.ceil((p2/f1)-1), k)
    #     a1 -= sub
    #     k -= sub
    #     heapq.heappush(h, (-a1*f1, a1, f1))
    #     heapq.heappush(h, (-a2*f2, a2, f2))
    # # print(h)
    # p, a, f = heapq.heappop(h)
    # print(-p)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    F = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, A, F)

if __name__ == "__main__":
    main()

#!/usr/bin/env python3
import sys

INF = float("inf")
import numpy as np

def solve(N: int, K: int, A: "List[int]", F: "List[int]"):
    A.sort()
    F.sort(reverse=True)
    A = np.asarray(A, dtype=np.int)
    F = np.asarray(F, dtype=np.int)
    Asum = A.sum()

    def isOK(y):
        return Asum - np.minimum(A, y // F).sum() <= K

    def binary_search(x):
        ng = -1
        ok = len(x)
        while abs(ok - ng) > 1:
            mid = (ok + ng) // 2
            # print("mid: {}, in ({}, {})".format(mid, ng, ok))
            if isOK(mid):
                ok = mid
            else:
                ng = mid
        return ng, ok

    ng, ok = binary_search(list(range(A.max() * F.max())))
    print(ok)
    # while k > 0:
    #     p1, a1, f1 = heapq.heappop(h)
    #     p2, a2, f2 = heapq.heappop(h)
    #     p1, p2 = -p1, -p2
    #     sub = min(a1 - math.ceil((p2/f1)-1), k)
    #     a1 -= sub
    #     k -= sub
    #     heapq.heappush(h, (-a1*f1, a1, f1))
    #     heapq.heappush(h, (-a2*f2, a2, f2))
    # # print(h)
    # p, a, f = heapq.heappop(h)
    # print(-p)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word

    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    F = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, K, A, F)

if __name__ == "__main__":
    main()

+        return Asum - np.minimum(A, y // F).sum() <= K

-    ng, ok = binary_search(list(range(maxtime)))

+    ng, ok = binary_search(list(range(A.max() * F.max())))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

'''

無向グラフの橋の数を調べる

ループ無し/2重辺無し

'''

def main():

    import sys

    #input = sys.stdin.readline

    sys.setrecursionlimit(10000000)

    from collections import Counter, deque

    #from collections import defaultdict

    from itertools import combinations

    #from itertools import accumulate, product, permutations

    from math import floor, ceil

    #mod = 1000000007

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

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

    res = 0

    def dfs(num):

        flag[num-1] = 1

        for x, y in edge:

            if x==num:

                if not flag[y-1]:

                    dfs(y)

            if y==num:

                if not flag[x-1]:

                    dfs(x)

    for i in range(m):

        bridge = edge.pop(i)

        flag = [0]*node

        s = edge[0][0]

        dfs(s)

        if not all(flag):

            res += 1

        edge.insert(i, bridge)

    print(res)

if __name__ == '__main__':

    main()

# optimized version of the same code:

'''

https://atcoder.jp/contests/abc075/tasks/abc075_c?lang=ja

深さ優先探索でも解ける

'''

def main():

    import sys

    #input = sys.stdin.readline

    sys.setrecursionlimit(10000000)

    from collections import Counter, deque

    #from collections import defaultdict

    from itertools import combinations, permutations

    #from itertools import accumulate, product

    from bisect import bisect_left,bisect_right

    from math import floor, ceil

    #from operator import itemgetter

    #mod = 1000000007

    class UnionFind():

        #n個の要素を番号0~n-1で管理する

        #parents:要素の親(1つ上), 要素が根の場合サイズを表す

        def __init__(self, n):

            self.n = n

            self.parents = [-1] * n

        #要素xの根を返す, その過程で経路圧縮も行う

        def find(self, x):

            if self.parents[x] < 0:

                return x

            else:

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

                return self.parents[x]

        def union(self, x, y):

            x = self.find(x)

            y = self.find(y)

            if x == y:

                return

            #それぞれのsizeで比べる

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

                x, y = y, x

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

            self.parents[y] = x #根をくっつける(片方を親にする)

        #xが属するグループのsize

        def size(self, x):

            return -self.parents[self.find(x)]

        #xとyが同じグループかどうか

        def same(self, x, y):

            return self.find(x) == self.find(y)

        #xが属するグループの要素全てを返す

        def members(self, x):

            root = self.find(x)

            return [i for i in range(self.n) if self.find(i) == root]

        #全ての根の要素を返す

        def roots(self):

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

        #各グループの要素を辞書で返す

        def all_group_members(self):

            return {r: self.members(r) for r in self.roots()}

        #print(uf)

        def __str__(self):

            return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

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

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

    res = 0

    for i in range(m):

        uf = UnionFind(n)

        for j in range(m):

            if i==j:

                continue

            a,b = edge[j]

            uf.union(a-1,b-1)

        if uf.size(0)!=n:

            res += 1

    print(res)

if __name__ == '__main__':

    main()

"""
無向グラフの橋の数を調べる
ループ無し/2重辺無し
"""

def main():
    import sys

    # input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque

    # from collections import defaultdict
    from itertools import combinations

    # from itertools import accumulate, product, permutations
    from math import floor, ceil

    # mod = 1000000007
    node, m = list(map(int, input().split()))
    edge = [list(map(int, input().split())) for _ in range(m)]
    res = 0

    def dfs(num):
        flag[num - 1] = 1
        for x, y in edge:
            if x == num:
                if not flag[y - 1]:
                    dfs(y)
            if y == num:
                if not flag[x - 1]:
                    dfs(x)

    for i in range(m):
        bridge = edge.pop(i)
        flag = [0] * node
        s = edge[0][0]
        dfs(s)
        if not all(flag):
            res += 1
        edge.insert(i, bridge)
    print(res)

if __name__ == "__main__":
    main()

"""
https://atcoder.jp/contests/abc075/tasks/abc075_c?lang=ja
深さ優先探索でも解ける
"""

def main():
    import sys

    # input = sys.stdin.readline
    sys.setrecursionlimit(10000000)
    from collections import Counter, deque

    # from collections import defaultdict
    from itertools import combinations, permutations

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

    # from operator import itemgetter
    # mod = 1000000007
    class UnionFind:
        # n個の要素を番号0~n-1で管理する
        # parents:要素の親(1つ上), 要素が根の場合サイズを表す
        def __init__(self, n):
            self.n = n
            self.parents = [-1] * n

        # 要素xの根を返す, その過程で経路圧縮も行う
        def find(self, x):
            if self.parents[x] < 0:
                return x
            else:
                self.parents[x] = self.find(self.parents[x])
                return self.parents[x]

        def union(self, x, y):
            x = self.find(x)
            y = self.find(y)
            if x == y:
                return
            # それぞれのsizeで比べる
            if self.parents[x] > self.parents[y]:
                x, y = y, x
            self.parents[x] += self.parents[y]
            self.parents[y] = x  # 根をくっつける(片方を親にする)

        # xが属するグループのsize
        def size(self, x):
            return -self.parents[self.find(x)]

        # xとyが同じグループかどうか
        def same(self, x, y):
            return self.find(x) == self.find(y)

        # xが属するグループの要素全てを返す
        def members(self, x):
            root = self.find(x)
            return [i for i in range(self.n) if self.find(i) == root]

        # 全ての根の要素を返す
        def roots(self):
            return [i for i, x in enumerate(self.parents) if x < 0]

        # 各グループの要素を辞書で返す
        def all_group_members(self):
            return {r: self.members(r) for r in self.roots()}

        # print(uf)
        def __str__(self):
            return "\n".join("{}: {}".format(r, self.members(r)) for r in self.roots())

    n, m = list(map(int, input().split()))
    edge = [list(map(int, input().split())) for _ in range(m)]
    res = 0
    for i in range(m):
        uf = UnionFind(n)
        for j in range(m):
            if i == j:
                continue
            a, b = edge[j]
            uf.union(a - 1, b - 1)
        if uf.size(0) != n:
            res += 1
    print(res)

if __name__ == "__main__":
    main()

-無向グラフの橋の数を調べる

-ループ無し/2重辺無し

+深さ優先探索でも解ける

+    from itertools import combinations, permutations

-    # from itertools import accumulate, product, permutations

+    # from itertools import accumulate, product

+    from bisect import bisect_left, bisect_right

-    node, m = list(map(int, input().split()))

+        # n個の要素を番号0~n-1で管理する

+        # parents:要素の親(1つ上), 要素が根の場合サイズを表す

+        # 要素xの根を返す, その過程で経路圧縮も行う

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

+            # それぞれのsizeで比べる

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

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

+            self.parents[y] = x  # 根をくっつける(片方を親にする)

+        # xが属するグループのsize

+            return -self.parents[self.find(x)]

+        # xとyが同じグループかどうか

+            return self.find(x) == self.find(y)

+        # xが属するグループの要素全てを返す

+            return [i for i in range(self.n) if self.find(i) == root]

+        # 全ての根の要素を返す

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

+        # 各グループの要素を辞書で返す

+            return {r: self.members(r) for r in self.roots()}

+            return "\n".join("{}: {}".format(r, self.members(r)) for r in self.roots())

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


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import math

n = int(eval(input()))

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

# optimized version of the same code:

n = int(eval(input()))

pw = 1

for i in range(n):

  pw *= (i+1)

  pw %= 10**9+7

print(pw)

import math

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

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

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

import heapq

N = int(eval(input()))

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

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

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

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

INFTY = 10**15

for a,b,c in abc:

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

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

cost = [[INFTY,False] for _  in range(N)]

cost[K-1][0] = 0

q = [(0,K-1)]

while q:

    _,i = heapq.heappop(q)

    if cost[i][1]:

        continue

    cost[i][1] = True

    ci0 = cost[i][0]

    for j,c in connect[i]:

        if cost[j][1]:

            continue

        tmp_cost = ci0+c

        if tmp_cost < cost[j][0]:

            cost[j][0] = tmp_cost

            heapq.heappush(q,(tmp_cost,j))

for x,y in xy:

    print((cost[x-1][0] + cost[y-1][0]))

# optimized version of the same code:

N = int(eval(input()))

ABC = [list(map(int,input().split())) for _ in [0]*(N-1)]

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

XY = [list(map(int,input().split())) for _ in [0]*Q]

E = [{} for _ in [0]*N]

for a,b,c in ABC:

    E[a-1][b-1] = c

    E[b-1][a-1] = c

def dist_dfs_tree(N,E,start):

    d = [-1]*N

    d[start] = 0

    q = [start]

    while q:

        i = q.pop()

        ci = d[i]

        for j,cj in list(E[i].items()):

            if d[j] !=-1:continue

            d[j] = ci+cj

            q.append(j)

    return d

d = dist_dfs_tree(N,E,K-1)

for x,y in XY:

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

import heapq

N = int(eval(input()))
abc = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = list(map(int, input().split()))
xy = [list(map(int, input().split())) for _ in range(Q)]
connect = [[] for _ in range(N)]
INFTY = 10**15
for a, b, c in abc:
    connect[a - 1].append([b - 1, c])
    connect[b - 1].append([a - 1, c])
cost = [[INFTY, False] for _ in range(N)]
cost[K - 1][0] = 0
q = [(0, K - 1)]
while q:
    _, i = heapq.heappop(q)
    if cost[i][1]:
        continue
    cost[i][1] = True
    ci0 = cost[i][0]
    for j, c in connect[i]:
        if cost[j][1]:
            continue
        tmp_cost = ci0 + c
        if tmp_cost < cost[j][0]:
            cost[j][0] = tmp_cost
            heapq.heappush(q, (tmp_cost, j))
for x, y in xy:
    print((cost[x - 1][0] + cost[y - 1][0]))

N = int(eval(input()))
ABC = [list(map(int, input().split())) for _ in [0] * (N - 1)]
Q, K = list(map(int, input().split()))
XY = [list(map(int, input().split())) for _ in [0] * Q]
E = [{} for _ in [0] * N]
for a, b, c in ABC:
    E[a - 1][b - 1] = c
    E[b - 1][a - 1] = c

def dist_dfs_tree(N, E, start):
    d = [-1] * N
    d[start] = 0
    q = [start]
    while q:
        i = q.pop()
        ci = d[i]
        for j, cj in list(E[i].items()):
            if d[j] != -1:
                continue
            d[j] = ci + cj
            q.append(j)
    return d

d = dist_dfs_tree(N, E, K - 1)
for x, y in XY:
    print((d[x - 1] + d[y - 1]))

+ABC = [list(map(int, input().split())) for _ in [0] * (N - 1)]

+XY = [list(map(int, input().split())) for _ in [0] * Q]

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

-xy = [list(map(int, input().split())) for _ in range(Q)]

-cost = [[INFTY, False] for _ in range(N)]

-            heapq.heappush(q, (tmp_cost, j))

+        for j, cj in list(E[i].items()):


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

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

def kaibun(n):

	key = 0

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

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

			key += 1

	return key

print((kaibun(B)-kaibun(A-1)))

# optimized version of the same code:

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

def kaibun(m, n):

	key = 0

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

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

			key += 1

	return key

print((kaibun(A,B)))

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

def kaibun(n):
    key = 0
    for i in range(1, n + 1):
        if str(i) == str(i)[::-1]:
            key += 1
    return key

print((kaibun(B) - kaibun(A - 1)))

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

def kaibun(m, n):
    key = 0
    for i in range(m, n + 1):
        if str(i) == str(i)[::-1]:
            key += 1
    return key

print((kaibun(A, B)))

-def kaibun(n):
+def kaibun(m, n):
-    for i in range(1, n + 1):
+    for i in range(m, n + 1):
-print((kaibun(B) - kaibun(A - 1)))
+print((kaibun(A, B)))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

from scipy.sparse.csgraph import dijkstra

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

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

# 隣接行列

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

for i, j in edge:

  graph[i][j] = 1

ans = 0

INF = 10 ** 9

for a, b in edge:

  # 辺を取り除く-> INF

  graph[a][b] = INF

  dist = dijkstra(graph, indices=a, directed=False) # directed=False -> 無効グラフ用

  if dist[b] >= INF:

    ans += 1

  # 元に戻す -> 1

  graph[a][b] = 1

print(ans)

# optimized version of the same code:

# C - Bridge

# https://atcoder.jp/contests/abc075/tasks/abc075_c

from collections import deque

def dfs(n, start, graph):

  visited = [False] * n

  stack = deque()

  stack.append(start)

  visited[start] = True

  while stack:

    q = stack.popleft()

    nxts = graph[q]

    for nxt in nxts:

      if not visited[nxt]:

        visited[nxt] = True

        stack.append(nxt)

  return visited

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

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

ans = 0

for i in range(m):

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

  for itr, (a, b) in enumerate(edge):

    if itr != i:

      graph[a - 1].append(b - 1)

      graph[b - 1].append(a - 1)

  if not all(dfs(n, 0, graph)):

    ans += 1

print(ans)

from scipy.sparse.csgraph import dijkstra

N, M = list(map(int, input().split()))
edge = [list(map(int, input().split())) for _ in range(M)]
# 隣接行列
graph = [[0] * (N + 1) for _ in range(N + 1)]
for i, j in edge:
    graph[i][j] = 1
ans = 0
INF = 10**9
for a, b in edge:
    # 辺を取り除く-> INF
    graph[a][b] = INF
    dist = dijkstra(graph, indices=a, directed=False)  # directed=False -> 無効グラフ用
    if dist[b] >= INF:
        ans += 1
    # 元に戻す -> 1
    graph[a][b] = 1
print(ans)

-from scipy.sparse.csgraph import dijkstra

-edge = [list(map(int, input().split())) for _ in range(M)]

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

+edge = [list(map(int, input().split())) for _ in range(m)]

-    dist = dijkstra(graph, indices=a, directed=False)  # directed=False -> 無効グラフ用

+    for itr, (a, b) in enumerate(edge):


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

from sys import stdin

def solve():

    s = int(stdin.readline())

    mod = 10**9+7

    if s < 3: return 0

    dp = [0]*(s+1)

    dp[0] = 1

    for i in range(3,s+1):

        for x in range(3,i+1):

            if x in [i-1,i-2]:

                continue

            dp[i] += dp[i-x]

    return dp[s]%mod

print((solve()))

# optimized version of the same code:

from sys import stdin

def solve():

    s = int(stdin.readline())

    mod = 10**9+7

    if s < 3: return 0

    dp = [0]*(s+1)

    dp[0] = 1

    for i in range(3,s+1):

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

    return dp[s]%mod

print((solve()))

from sys import stdin

def solve():
    s = int(stdin.readline())
    mod = 10**9 + 7
    if s < 3:
        return 0
    dp = [0] * (s + 1)
    dp[0] = 1
    for i in range(3, s + 1):
        for x in range(3, i + 1):
            if x in [i - 1, i - 2]:
                continue
            dp[i] += dp[i - x]
    return dp[s] % mod

print((solve()))

from sys import stdin

def solve():
    s = int(stdin.readline())
    mod = 10**9 + 7
    if s < 3:
        return 0
    dp = [0] * (s + 1)
    dp[0] = 1
    for i in range(3, s + 1):
        dp[i] = dp[i - 1] + dp[i - 3]
    return dp[s] % mod

print((solve()))

-        for x in range(3, i + 1):
-            if x in [i - 1, i - 2]:
-                continue
-            dp[i] += dp[i - x]
+        dp[i] = dp[i - 1] + dp[i - 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 numpy as np

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

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

p += 1

sum_E = np.cumsum(p)

sum_e = np.append([0], sum_E)

ans = -1

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

    ans = max(ans, sum_e[i+k] - sum_e[i])

print((ans/2))

# optimized version of the same code:

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

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

def calc(x):

    return (x + 1) / 2

w = 0

for i in range(k):

    w += calc(p[i])

ans = w

for i in range(k, n):

    w += calc(p[i]) - calc(p[i - k])

    ans = max(ans, w)

print(ans)

import numpy as np

n, k = list(map(int, input().split()))
p = np.array(list(map(int, input().split())))
p += 1
sum_E = np.cumsum(p)
sum_e = np.append([0], sum_E)
ans = -1
for i in range(n - k + 1):
    ans = max(ans, sum_e[i + k] - sum_e[i])
print((ans / 2))

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

-    ans = max(ans, sum_e[i + k] - sum_e[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 numpy as np

def main(n, m, a):

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

    dp[0] = 1

    dp[1] = 1 if 1 not in a else 0

    for i in range(2, len(dp)):

        dp[i] = dp[i - 1] + dp[i - 2] if i not in a else 0

        dp[i] %= 1000000007

    return dp[-1]

if __name__ == '__main__':

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

    A = set()

    for _ in range(M):

        A.add(int(eval(input())))

    print((main(N, M, A)))

# optimized version of the same code:

import math

MOD = int(math.pow(10, 9)) + 7

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

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

dp = [0] * (N + 1)

dp[0] = 1

if 1 not in broken_steps:

    dp[1] = 1

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

    if step not in broken_steps:

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

print((dp[N]))

import numpy as np

def main(n, m, a):
    dp = np.zeros(n + 1, dtype=int)
    dp[0] = 1
    dp[1] = 1 if 1 not in a else 0
    for i in range(2, len(dp)):
        dp[i] = dp[i - 1] + dp[i - 2] if i not in a else 0
        dp[i] %= 1000000007
    return dp[-1]

if __name__ == "__main__":
    N, M = list(map(int, input().split()))
    A = set()
    for _ in range(M):
        A.add(int(eval(input())))
    print((main(N, M, A)))

import math

MOD = int(math.pow(10, 9)) + 7
N, M = list(map(int, input().split(" ")))
broken_steps = {int(eval(input())) for _ in range(M)}
dp = [0] * (N + 1)
dp[0] = 1
if 1 not in broken_steps:
    dp[1] = 1
for step in range(2, N + 1):
    if step not in broken_steps:
        dp[step] = (dp[step - 1] + dp[step - 2]) % MOD
print((dp[N]))

-        dp[i] = dp[i - 1] + dp[i - 2] if i not in a else 0

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

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

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

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


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import numpy as np

x = int(eval(input()))

tmp_list=[]

c=0

tmp_2=0

while(1):

    tmp_1=c**5

    if (tmp_1 - tmp_2)<=x:

        tmp_list+=[tmp_1]

    else:

        break

    tmp_2=tmp_1

    c+=1

def せいがわ(target:list,x) -> list:

    for i in np.flipud(target):

        for j in target:

            tmp=i+j

            if tmp==x:

                return [int(i**(1/5)),int(j**(1/5))*-1]

            if tmp>x:

                break

    return 0

def ふがわ(target:list,x) -> list:

    for i in np.flipud(target):

        for j in target:

            tmp=i-j

            if tmp==x:

                return [int(i**(1/5)),int(j**(1/5))]

            if tmp<x:

                break

    return 0

ans=ふがわ(tmp_list,x)

if ans==0:

    ans=せいがわ(tmp_list,x)

print((ans[0],ans[1]))

# optimized version of the same code:

import numpy as np

x = int(eval(input()))
tmp_list = []
c = 0
tmp_2 = 0
while 1:
    tmp_1 = c**5
    if (tmp_1 - tmp_2) <= x:
        tmp_list += [tmp_1]
    else:
        break
    tmp_2 = tmp_1
    c += 1

def せいがわ(target: list, x) -> list:
    for i in np.flipud(target):
        for j in target:
            tmp = i + j
            if tmp == x:
                return [int(i ** (1 / 5)), int(j ** (1 / 5)) * -1]
            if tmp > x:
                break
    return 0

def ふがわ(target: list, x) -> list:
    for i in np.flipud(target):
        for j in target:
            tmp = i - j
            if tmp == x:
                return [int(i ** (1 / 5)), int(j ** (1 / 5))]
            if tmp < x:
                break
    return 0

ans = ふがわ(tmp_list, x)
if ans == 0:
    ans = せいがわ(tmp_list, x)
print((ans[0], 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:

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

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

A.sort()

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

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

i = 0#bcの添え字

j = 0#Aの添え字

while 1:

	if i >= m or j >= n:

		#print('iかjが超えた！')

		break

	if bc[i][1] < A[j]:

		#print('Aでっか')

		break

	for k in range(bc[i][0]):

		#print(i,j,k)

		A[j] = bc[i][1]

		j+=1

		if j >= n:

			#print('for文内、jが超えた')

			break

		if A[j] > bc[i][1]:

			#print('for文内、Aでっか')

			break

	i+=1

# print(A)

print((sum(A)))

# optimized version of the same code:

from heapq import heapify,heappop,heappush

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

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

heapify(A)

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

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

flag = 0

# print(A)

for b,c in bc:

	if flag:

		break

	for i in range(b):

		a = heappop(A)

		if c <= a:

			heappush(A,a)

			flag = 1

			break

		else:

			heappush(A,c)

print((sum(A)))

n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
A.sort()
bc = [list(map(int, input().split())) for _ in range(m)]
bc.sort(key=lambda x: x[1], reverse=1)
i = 0  # bcの添え字
j = 0  # Aの添え字
while 1:
    if i >= m or j >= n:
        # print('iかjが超えた！')
        break
    if bc[i][1] < A[j]:
        # print('Aでっか')
        break
    for k in range(bc[i][0]):
        # print(i,j,k)
        A[j] = bc[i][1]
        j += 1
        if j >= n:
            # print('for文内、jが超えた')
            break
        if A[j] > bc[i][1]:
            # print('for文内、Aでっか')
            break
    i += 1
# print(A)
print((sum(A)))

from heapq import heapify, heappop, heappush

n, m = list(map(int, input().split()))
A = list(map(int, input().split()))
heapify(A)
bc = [list(map(int, input().split())) for i in range(m)]
bc.sort(key=lambda x: x[1], reverse=1)
flag = 0
# print(A)
for b, c in bc:
    if flag:
        break
    for i in range(b):
        a = heappop(A)
        if c <= a:
            heappush(A, a)
            flag = 1
            break
        else:
            heappush(A, c)
print((sum(A)))

+from heapq import heapify, heappop, heappush

-bc = [list(map(int, input().split())) for _ in range(m)]

+bc = [list(map(int, input().split())) for i 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()))

s_list = {}

for i in range(N):

  S = eval(input())

  if S in list(s_list.keys()):

    s_list[S] += 1

  else:

    s_list[S] = 0

max = 0

maxs = []

for s,c in list(s_list.items()):

  if c > max:

    maxs = [s]

    max = c

  elif c == max:

    maxs.append(s)

maxs.sort()

for m in maxs:

  print(m)

# optimized version of the same code:

from collections import Counter

def solve():

  N = int(input())

  S = [input() for _ in range(N)]

  c = Counter(S)

  M = max(c.values())

  ans = []

  for k,v in c.items():

    if v==M:

      ans.append(k)

  ans.sort()

  return ans

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

N = int(eval(input()))
s_list = {}
for i in range(N):
    S = eval(input())
    if S in list(s_list.keys()):
        s_list[S] += 1
    else:
        s_list[S] = 0
max = 0
maxs = []
for s, c in list(s_list.items()):
    if c > max:
        maxs = [s]
        max = c
    elif c == max:
        maxs.append(s)
maxs.sort()
for m in maxs:
    print(m)

from collections import Counter

def solve():
    N = int(input())
    S = [input() for _ in range(N)]
    c = Counter(S)
    M = max(c.values())
    ans = []
    for k, v in c.items():
        if v == M:
            ans.append(k)
    ans.sort()
    return ans

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

-N = int(eval(input()))
-s_list = {}
-for i in range(N):
-    S = eval(input())
-    if S in list(s_list.keys()):
-        s_list[S] += 1
-    else:
-        s_list[S] = 0
-max = 0
-maxs = []
-for s, c in list(s_list.items()):
-    if c > max:
-        maxs = [s]
-        max = c
-    elif c == max:
-        maxs.append(s)
-maxs.sort()
-for m in maxs:
-    print(m)
+from collections import Counter
+
+
+def solve():
+    N = int(input())
+    S = [input() for _ in range(N)]
+    c = Counter(S)
+    M = max(c.values())
+    ans = []
+    for k, v in c.items():
+        if v == M:
+            ans.append(k)
+    ans.sort()
+    return ans
+
+
+print(*solve(), sep="\n")


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

# coding: utf-8

import numpy as np

def solve(*args: str) -> str:

    n = int(args[0])

    LR = [tuple(map(int, a.split())) for a in args[1:]]

    L, R = list(zip(*LR))

    ret = 0

    p, q = np.argmax(L), np.argmin(R)

    lp, rq = L[p], R[q]

    ret = max(0, 1+rq-lp) + max(0, max(1+r-l for l, r in LR))

    AB = [[max(0, 1+r-lp), max(0, 1+rq-l)] for l, r in LR]

    AB.sort(key=lambda x: (x[0], -x[1]))

    A, B = list(map(list, list(zip(*AB))))

    # for i in range(1, n):

    #     ret = max(ret, min(A[i:]) + min(B[:i]))

    b_min = 1+10**9

    for i in range(n-1):

        b_min = min(b_min, B[i])

        ret = max(ret, b_min + A[i+1])

    return str(ret)

if __name__ == "__main__":

    print((solve(*(open(0).read().splitlines()))))

# optimized version of the same code:

# coding: utf-8

def solve(*args: str) -> str:

    n = int(args[0])

    LR = [tuple(map(int, a.split())) for a in args[1:]]

    L, R = list(zip(*LR))

    ret = 0

    # lp, rq = max(L), min(R)

    lp, rq = 0, 1+10**9

    for l, r in LR:

        lp, rq = max(lp, l), min(rq, r)

    ret = max(0, 1+rq-lp) + max(0, max(1+r-l for l, r in LR))

    AB = [[max(0, 1+r-lp), max(0, 1+rq-l)] for l, r in LR]

    AB.sort(key=lambda x: (x[0], -x[1]))

    A, B = list(map(list, list(zip(*AB))))

    # for i in range(1, n):

    #     ret = max(ret, min(A[i:]) + min(B[:i]))

    b_min = 1+10**9

    for i in range(n-1):

        b_min = min(b_min, B[i])

        ret = max(ret, b_min + A[i+1])

    return str(ret)

if __name__ == "__main__":

    print((solve(*(open(0).read().splitlines()))))

# coding: utf-8
import numpy as np

def solve(*args: str) -> str:
    n = int(args[0])
    LR = [tuple(map(int, a.split())) for a in args[1:]]
    L, R = list(zip(*LR))
    ret = 0
    p, q = np.argmax(L), np.argmin(R)
    lp, rq = L[p], R[q]
    ret = max(0, 1 + rq - lp) + max(0, max(1 + r - l for l, r in LR))
    AB = [[max(0, 1 + r - lp), max(0, 1 + rq - l)] for l, r in LR]
    AB.sort(key=lambda x: (x[0], -x[1]))
    A, B = list(map(list, list(zip(*AB))))
    # for i in range(1, n):
    #     ret = max(ret, min(A[i:]) + min(B[:i]))
    b_min = 1 + 10**9
    for i in range(n - 1):
        b_min = min(b_min, B[i])
        ret = max(ret, b_min + A[i + 1])
    return str(ret)

if __name__ == "__main__":
    print((solve(*(open(0).read().splitlines()))))

# coding: utf-8
def solve(*args: str) -> str:
    n = int(args[0])
    LR = [tuple(map(int, a.split())) for a in args[1:]]
    L, R = list(zip(*LR))
    ret = 0
    # lp, rq = max(L), min(R)
    lp, rq = 0, 1 + 10**9
    for l, r in LR:
        lp, rq = max(lp, l), min(rq, r)
    ret = max(0, 1 + rq - lp) + max(0, max(1 + r - l for l, r in LR))
    AB = [[max(0, 1 + r - lp), max(0, 1 + rq - l)] for l, r in LR]
    AB.sort(key=lambda x: (x[0], -x[1]))
    A, B = list(map(list, list(zip(*AB))))
    # for i in range(1, n):
    #     ret = max(ret, min(A[i:]) + min(B[:i]))
    b_min = 1 + 10**9
    for i in range(n - 1):
        b_min = min(b_min, B[i])
        ret = max(ret, b_min + A[i + 1])
    return str(ret)

if __name__ == "__main__":
    print((solve(*(open(0).read().splitlines()))))

+        lp, rq = max(lp, l), min(rq, r)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

input = sys.stdin.readline

import numpy as np

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

dp = [10 ** 10] * N * (10 ** 4)

dp[0] = 0

dp = np.array(dp)

for i in range(N):

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

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

for i,count in enumerate(dp):

    if dp[i] <= W:

        ans = i

print(ans)

# optimized version of the same code:

import sys

input = sys.stdin.readline

import numpy as np

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

dp = [10 ** 10] * (N * (10 ** 3) + 1)

dp[0] = 0

dp = np.array(dp)

for i in range(N):

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

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

for i,count in enumerate(dp):

    if dp[i] <= W:

        ans = i

print(ans)

import sys

input = sys.stdin.readline
import numpy as np

N, W = list(map(int, input().split()))
dp = [10**10] * N * (10**4)
dp[0] = 0
dp = np.array(dp)
for i in range(N):
    w, v = list(map(int, input().split()))
    dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
for i, count in enumerate(dp):
    if dp[i] <= W:
        ans = i
print(ans)

import sys

input = sys.stdin.readline
import numpy as np

N, W = list(map(int, input().split()))
dp = [10**10] * (N * (10**3) + 1)
dp[0] = 0
dp = np.array(dp)
for i in range(N):
    w, v = list(map(int, input().split()))
    dp[v:] = np.minimum(dp[v:], dp[:-v] + w)
for i, count in enumerate(dp):
    if dp[i] <= W:
        ans = i
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 math

x = int(eval(input()))

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

# optimized version of the same code:

M = 1000000007

n=int(eval(input()))

f = 1

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

    f = (f * i) % M

print(f)

M = 1000000007
n = int(eval(input()))
f = 1
for i in range(1, n + 1):
    f = (f * i) % M
print(f)

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