Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

S = eval(input())

N = len(S)

left = S[:int(N/2)]

right = S[int((N+2)/2):]

S_reversed = "".join(reversed(list(S)))

left_reversed = "".join(reversed(list(left)))

right_reversed = "".join(reversed(list(right)))

if S == S_reversed and left == left_reversed and right == right_reversed:

    print("Yes")

else:

    print("No")

# optimized version of the same code:

S = eval(input())

N = len(S)

left = S[:int(N/2)]

right = S[int((N+2)/2):]

if S == S[::-1] and left == left[::-1] and right == right[::-1]:

    print("Yes")

else:

    print("No")

S = eval(input())
N = len(S)
left = S[: int(N / 2)]
right = S[int((N + 2) / 2) :]
S_reversed = "".join(reversed(list(S)))
left_reversed = "".join(reversed(list(left)))
right_reversed = "".join(reversed(list(right)))
if S == S_reversed and left == left_reversed and right == right_reversed:
    print("Yes")
else:
    print("No")

S = eval(input())
N = len(S)
left = S[: int(N / 2)]
right = S[int((N + 2) / 2) :]
if S == S[::-1] and left == left[::-1] and right == right[::-1]:
    print("Yes")
else:
    print("No")

-if S == S_reversed and left == left_reversed and right == right_reversed:

+if S == S[::-1] and left == left[::-1] and right == right[::-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:

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

ans=0

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

  if len(str(i))%2==0:

    p=list(str(i))[:len(str(i))//2]

    q=list(reversed(list(str(i))[len(str(i))//2:]))

    if p==q:

      ans+=1

  else:

    s=list(str(i))[:len(str(i))//2+1]

    d=list(reversed(list(str(i))[len(str(i))//2:]))

    if s==d:

      ans += 1

print(ans)

# optimized version of the same code:

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

ad=0

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

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

print(ad)

a, b = list(map(int, input().split()))
ans = 0
for i in range(b + 1)[a:]:
    if len(str(i)) % 2 == 0:
        p = list(str(i))[: len(str(i)) // 2]
        q = list(reversed(list(str(i))[len(str(i)) // 2 :]))
        if p == q:
            ans += 1
    else:
        s = list(str(i))[: len(str(i)) // 2 + 1]
        d = list(reversed(list(str(i))[len(str(i)) // 2 :]))
        if s == d:
            ans += 1
print(ans)

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

-        p = list(str(i))[: len(str(i)) // 2]

-        q = list(reversed(list(str(i))[len(str(i)) // 2 :]))

-        d = list(reversed(list(str(i))[len(str(i)) // 2 :]))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

import itertools

# import numpy as np

import time

import math

sys.setrecursionlimit(10 ** 7)

from collections import defaultdict

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

from functools import reduce

# from math import *

from fractions import *

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

A = list(sorted([int(x) // 2 for x in readline().split()]))

min_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)

# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))

if not all([(min_cm // x) % 2 == 1 for x in A]):

    print((0))

    exit(0)

if min_cm > M:

    print((0))

    exit(0)

ans = (M // min_cm + 1) // 2

print(ans)

# optimized version of the same code:

import sys

import itertools

# import numpy as np

import time

import math

import heapq

from collections import defaultdict

sys.setrecursionlimit(10 ** 7)

INF = 10 ** 9 + 7

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

# map(int, input().split())

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

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

def f(n):

    res = 0

    while n % 2 == 0:

        n //= 2

        res += 1

    return res

def gcd(a, b):

    if b == 0:

        return a

    return gcd(b, a % b)

x = f(A[0])

for a in A:

    y = f(a)

    if y != x:

        print((0))

        exit()

lcm = A[0]

for i in range(1, N):

    lcm = lcm * A[i] //  gcd(lcm, A[i])

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

import sys
import itertools

# import numpy as np
import time
import math

sys.setrecursionlimit(10**7)
from collections import defaultdict

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from functools import reduce

# from math import *
from fractions import *

N, M = list(map(int, readline().split()))
A = list(sorted([int(x) // 2 for x in readline().split()]))
min_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)
# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))
if not all([(min_cm // x) % 2 == 1 for x in A]):
    print((0))
    exit(0)
if min_cm > M:
    print((0))
    exit(0)
ans = (M // min_cm + 1) // 2
print(ans)

import sys
import itertools

# import numpy as np
import time
import math
import heapq
from collections import defaultdict

sys.setrecursionlimit(10**7)
INF = 10**9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
# map(int, input().split())
N, M = list(map(int, input().split()))
A = list([int(x) // 2 for x in input().split()])

def f(n):
    res = 0
    while n % 2 == 0:
        n //= 2
        res += 1
    return res

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a % b)

x = f(A[0])
for a in A:
    y = f(a)
    if y != x:
        print((0))
        exit()
lcm = A[0]
for i in range(1, N):
    lcm = lcm * A[i] // gcd(lcm, A[i])
print(((M // lcm + 1) // 2))

+A = list([int(x) // 2 for x in input().split()])

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

-A = list(sorted([int(x) // 2 for x in readline().split()]))

-min_cm = reduce(lambda a, b: (a * b) // gcd(a, b), A)

-# print(all(map(lambda x: (min_cm // x) % 2 == 1, A)))

-if not all([(min_cm // x) % 2 == 1 for x in A]):


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import operator

for e in iter(input,'0'):

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

    bx, by = target[0]

    target = {(x - bx, y - by) for x, y in target}

    max_tx = max(list(map(operator.itemgetter(0), target)))

    b = {tuple(map(int,input().split()))for _ in[0]*int(eval(input()))}

    max_sx = max(list(map(operator.itemgetter(0), b)))

    lim_x = max_sx - max_tx

    for x,y in b:

        if x > lim_x:continue

        for u,v in target:

            if (x + u, y + v) not in b:break

        else:

            print((x - bx, y - by))

            break

# optimized version of the same code:

import operator

for e in iter(input,'0'):

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

    bx, by = min(target)

    target = {(x - bx, y - by) for x, y in target}

    max_tx = max(list(map(operator.itemgetter(0), target)))

    b = {tuple(map(int,input().split()))for _ in[0]*int(eval(input()))}

    max_sx = max(list(map(operator.itemgetter(0), b)))

    lim_x = max_sx - max_tx

    for x,y in b:

        if x > lim_x:continue

        for u,v in target:

            if (x + u, y + v) not in b:break

        else:

            print((x - bx, y - by))

            break

import operator

for e in iter(input, "0"):
    target = [[*list(map(int, input().split()))] for _ in [0] * int(e)]
    bx, by = target[0]
    target = {(x - bx, y - by) for x, y in target}
    max_tx = max(list(map(operator.itemgetter(0), target)))
    b = {tuple(map(int, input().split())) for _ in [0] * int(eval(input()))}
    max_sx = max(list(map(operator.itemgetter(0), b)))
    lim_x = max_sx - max_tx
    for x, y in b:
        if x > lim_x:
            continue
        for u, v in target:
            if (x + u, y + v) not in b:
                break
        else:
            print((x - bx, y - by))
            break

import operator

for e in iter(input, "0"):
    target = [[*list(map(int, input().split()))] for _ in [0] * int(e)]
    bx, by = min(target)
    target = {(x - bx, y - by) for x, y in target}
    max_tx = max(list(map(operator.itemgetter(0), target)))
    b = {tuple(map(int, input().split())) for _ in [0] * int(eval(input()))}
    max_sx = max(list(map(operator.itemgetter(0), b)))
    lim_x = max_sx - max_tx
    for x, y in b:
        if x > lim_x:
            continue
        for u, v in target:
            if (x + u, y + v) not in b:
                break
        else:
            print((x - bx, y - by))
            break

-    bx, by = target[0]
+    bx, by = min(target)


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

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

# start = 0

# rows = 1,2,...,H

# cols = H+1,...,H+W

# goal = H+W+1

INF = 10 ** 9

start = 0

goal = H+W+1

V = H+W+2

graph = [[0] * V for _ in range(V)]

edges = [] # 隣接リスト

for i in range(H):

    row = eval(input())

    for j,cell in enumerate(row):

        if cell == 'o':

            graph[1+i][1+H+j] = 1

            graph[1+H+j][1+i] = 1

    s = row.find('S')

    t = row.find('T')

    if s != -1:

        graph[start][1+i] = INF

        graph[start][1+H+s] = INF

    if t != -1:

        graph[1+i][goal] = INF

        graph[1+H+t][goal] = INF

# あとは max flow を求めればよい

def max_flow(graph):

    f = 0

    while True:

        if f > 200:

            return -1

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

        if dist[goal] > INF:

            return f

        f += 1

        after = goal

        while after != start:

            before = pred[after]

            graph[before][after] -= 1

            graph[after][before] += 1

            after = before

answer = 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 defaultdict

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

A = [line.rstrip().decode('utf-8') for line in readlines()]

source = 0

sink = H+W+1

graph = [defaultdict(int) for _ in range(H+W+2)]

INF = 10 ** 18

for h in range(1,H+1):

    for w,ox in enumerate(A[h-1],1):

        if ox == 'x':

            continue

        elif ox == 'o':

            graph[h][H+w] = 1

            graph[H+w][h] = 1

        elif ox == 'S':

            graph[source][h] = INF

            graph[h][source] = INF

            graph[source][H+w] = INF

            graph[H+w][source] = INF

        elif ox == 'T':

            graph[sink][h] = INF

            graph[h][sink] = INF

            graph[sink][H+w] = INF

            graph[H+w][sink] = INF

class Dinic():

    def __init__(self,graph,V,source,sink):

        self.graph = graph

        self.sink = sink

        self.source = source

        self.V = V

#        self.compress()

        self.N = len(V)

    def compress(self):

        self.N = len(self.V)

        v_to_i = {x:i for i,x in enumerate(self.V)}

        self.sink = v_to_i[self.sink]

        self.source = v_to_i[self.source]

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

        for v,e in list(self.graph.items()):

            vn = v_to_i[v]

            g[vn] = {v_to_i[w]:c for w,c in list(e.items())}

        self.graph = g

    def bfs(self):

        level = [0]*self.N

        q = [self.source]

        level[self.source] = 1

        d = 1

        while q:

            if level[self.sink]:

                break

            qq = []

            d += 1

            for v in q:

                for w,cap in list(self.graph[v].items()):

                    if cap == 0:

                        continue

                    if level[w]:

                        continue

                    level[w] = d

                    qq.append(w)

            q = qq

        self.level = level

    def dfs(self,v,f):

        if v == self.sink:

            return f

        for w,cap in self.itr[v]:

            if cap == 0 or self.level[w] != self.level[v] + 1:

                continue

            d = self.dfs(w,min(f,cap))

            if d:

                self.graph[v][w] -= d

                self.graph[w][v] += d

                return d

        return 0

    def max_flow(self):

        INF = 10**18

        flow = 0

        while True:

            self.bfs()

            if self.level[self.sink] == 0:

                break

            self.itr = [iter(list(e.items())) for e in self.graph]

            while True:

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

                if f == 0:

                    break

                flow += f

        return flow

answer = Dinic(graph=graph,V=list(range(H+W+2)),source=0,sink=H+W+1).max_flow()

if answer >= INF:

    answer = -1

print(answer)

import sys

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

H, W = list(map(int, input().split()))
# start = 0
# rows = 1,2,...,H
# cols = H+1,...,H+W
# goal = H+W+1
INF = 10**9
start = 0
goal = H + W + 1
V = H + W + 2
graph = [[0] * V for _ in range(V)]
edges = []  # 隣接リスト
for i in range(H):
    row = eval(input())
    for j, cell in enumerate(row):
        if cell == "o":
            graph[1 + i][1 + H + j] = 1
            graph[1 + H + j][1 + i] = 1
    s = row.find("S")
    t = row.find("T")
    if s != -1:
        graph[start][1 + i] = INF
        graph[start][1 + H + s] = INF
    if t != -1:
        graph[1 + i][goal] = INF
        graph[1 + H + t][goal] = INF
# あとは max flow を求めればよい
def max_flow(graph):
    f = 0
    while True:
        if f > 200:
            return -1
        dist, pred = dijkstra(
            graph, indices=start, unweighted=True, return_predecessors=True
        )
        if dist[goal] > INF:
            return f
        f += 1
        after = goal
        while after != start:
            before = pred[after]
            graph[before][after] -= 1
            graph[after][before] += 1
            after = before

answer = 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 defaultdict

H, W = list(map(int, readline().split()))
A = [line.rstrip().decode("utf-8") for line in readlines()]
source = 0
sink = H + W + 1
graph = [defaultdict(int) for _ in range(H + W + 2)]
INF = 10**18
for h in range(1, H + 1):
    for w, ox in enumerate(A[h - 1], 1):
        if ox == "x":
            continue
        elif ox == "o":
            graph[h][H + w] = 1
            graph[H + w][h] = 1
        elif ox == "S":
            graph[source][h] = INF
            graph[h][source] = INF
            graph[source][H + w] = INF
            graph[H + w][source] = INF
        elif ox == "T":
            graph[sink][h] = INF
            graph[h][sink] = INF
            graph[sink][H + w] = INF
            graph[H + w][sink] = INF

class Dinic:
    def __init__(self, graph, V, source, sink):
        self.graph = graph
        self.sink = sink
        self.source = source
        self.V = V
        #        self.compress()
        self.N = len(V)

    def compress(self):
        self.N = len(self.V)
        v_to_i = {x: i for i, x in enumerate(self.V)}
        self.sink = v_to_i[self.sink]
        self.source = v_to_i[self.source]
        g = [dict() for _ in range(self.N)]
        for v, e in list(self.graph.items()):
            vn = v_to_i[v]
            g[vn] = {v_to_i[w]: c for w, c in list(e.items())}
        self.graph = g

    def bfs(self):
        level = [0] * self.N
        q = [self.source]
        level[self.source] = 1
        d = 1
        while q:
            if level[self.sink]:
                break
            qq = []
            d += 1
            for v in q:
                for w, cap in list(self.graph[v].items()):
                    if cap == 0:
                        continue
                    if level[w]:
                        continue
                    level[w] = d
                    qq.append(w)
            q = qq
        self.level = level

    def dfs(self, v, f):
        if v == self.sink:
            return f
        for w, cap in self.itr[v]:
            if cap == 0 or self.level[w] != self.level[v] + 1:
                continue
            d = self.dfs(w, min(f, cap))
            if d:
                self.graph[v][w] -= d
                self.graph[w][v] += d
                return d
        return 0

    def max_flow(self):
        INF = 10**18
        flow = 0
        while True:
            self.bfs()
            if self.level[self.sink] == 0:
                break
            self.itr = [iter(list(e.items())) for e in self.graph]
            while True:
                f = self.dfs(self.source, INF)
                if f == 0:
                    break
                flow += f
        return flow

answer = Dinic(
    graph=graph, V=list(range(H + W + 2)), source=0, sink=H + W + 1
).max_flow()
if answer >= INF:
    answer = -1
print(answer)

-from scipy.sparse.csgraph import dijkstra

-# あとは max flow を求めればよい

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

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

+A = [line.rstrip().decode("utf-8") for line in readlines()]

+graph = [defaultdict(int) for _ in range(H + W + 2)]

+    for w, ox in enumerate(A[h - 1], 1):

+    def __init__(self, graph, V, source, sink):

+        v_to_i = {x: i for i, x in enumerate(self.V)}

+        self.source = v_to_i[self.source]

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

+        for v, e in list(self.graph.items()):

+            g[vn] = {v_to_i[w]: c for w, c in list(e.items())}

+                for w, cap in list(self.graph[v].items()):

+            if cap == 0 or self.level[w] != self.level[v] + 1:

+            d = self.dfs(w, min(f, cap))

+            if self.level[self.sink] == 0:

+            self.itr = [iter(list(e.items())) for e in self.graph]

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

+    graph=graph, V=list(range(H + W + 2)), source=0, sink=H + W + 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:

while int(eval(input())) > 0:

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

    print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))

# optimized version of the same code:

while True:

    if int(eval(input())) == 0:

        break

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

    r = min(abs(x - y) for (x, y) in zip(s, s[1:]))

    print(r)

-    print((min(abs(a - b) for (a, b) in zip(s, s[1:]))))

+    r = min(abs(x - y) for (x, y) in zip(s, s[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:

# ABC150 D

si = lambda: eval(input())

ni = lambda: int(eval(input()))

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

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

from fractions import gcd

from math import ceil

def lcm(x, y):

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

n,m=nm()

a=nl()

ans=0

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

lcm_v=a[0]

for i in range(n):

    lcm_v=lcm(lcm_v,a[i])

ok_flg=[(lcm_v//i)%2==1 for i in a]

if all(ok_flg):

    ans=((m//lcm_v)+1)//2

print(ans)

# optimized version of the same code:

from math import gcd, ceil

def lcm(a, b):

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

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

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

for i in range(n):

    a[i] = a[i]//2

lcm_v = a[0]

for i in range(1, n):

    lcm_v = lcm(lcm_v, a[i])

ok = True

for aa in a:

    if (lcm_v//aa) % 2 != 1:

        ok = False

        break

ans = 0

if ok:

    ans = ((m//lcm_v)+1)//2

print(ans)

# ABC150 D
si = lambda: eval(input())
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
nl = lambda: list(map(int, input().split()))
from fractions import gcd
from math import ceil

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

n, m = nm()
a = nl()
ans = 0
a = [x // 2 for x in a]
lcm_v = a[0]
for i in range(n):
    lcm_v = lcm(lcm_v, a[i])
ok_flg = [(lcm_v // i) % 2 == 1 for i in a]
if all(ok_flg):
    ans = ((m // lcm_v) + 1) // 2
print(ans)

from math import gcd, ceil

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

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
for i in range(n):
    a[i] = a[i] // 2
lcm_v = a[0]
for i in range(1, n):
    lcm_v = lcm(lcm_v, a[i])
ok = True
for aa in a:
    if (lcm_v // aa) % 2 != 1:
        ok = False
        break
ans = 0
if ok:
    ans = ((m // lcm_v) + 1) // 2
print(ans)

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

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

-ok_flg = [(lcm_v // i) % 2 == 1 for i in a]


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

def main():

    while True:

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

        pattern = 0

        if n == x == 0:

            break

        else:

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

                for b in range(1, a):

                    for c in range(1, b):

                        pattern += 1 if a + b + c == x and a > b > c else 0

            print(pattern)

if __name__ == '__main__':

    main()

# optimized version of the same code:

def divide_two(c, z):

    min_b = z // 2 + 1

    max_b = min(c-1, z-1)

    return max(max_b-min_b+1, 0)

num_set = []

cnt = 0

while True:

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

    if (n, x) == (0, 0):

        break

    else:

        num_set.append((n, x))

        cnt += 1

for i in range(cnt):

    num_count = 0

    (n, x) = num_set[i]

    for c in range(x//3, n+1):

        num_count += divide_two(c, x-c)

    print(num_count)

def main():
    while True:
        n, x = tuple(map(int, input().split()))
        pattern = 0
        if n == x == 0:
            break
        else:
            for a in range(1, n + 1):
                for b in range(1, a):
                    for c in range(1, b):
                        pattern += 1 if a + b + c == x and a > b > c else 0
            print(pattern)

if __name__ == "__main__":
    main()

def divide_two(c, z):
    min_b = z // 2 + 1
    max_b = min(c - 1, z - 1)
    return max(max_b - min_b + 1, 0)

num_set = []
cnt = 0
while True:
    n, x = list(map(int, input().split()))
    if (n, x) == (0, 0):
        break
    else:
        num_set.append((n, x))
        cnt += 1
for i in range(cnt):
    num_count = 0
    (n, x) = num_set[i]
    for c in range(x // 3, n + 1):
        num_count += divide_two(c, x - c)
    print(num_count)

-        n, x = tuple(map(int, input().split()))

-                    for c in range(1, b):

-                        pattern += 1 if a + b + c == x and a > b > c else 0

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

+        num_count += divide_two(c, x - c)


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

numbers = list(range(A, B+1))

count = 0

for i in numbers:

    m = str(i)

    rm = ''.join(list(reversed(m)))

    if m == rm:

        count += 1

print(count)

# optimized version of the same code:

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

x = list(range(1,10))

y = list(range(10))

count = 0

for p in x:

    for q in y:

        for r in y:

            sakasama = int(str(p)+str(q)+str(r)+str(q)+str(p))

            if A <= sakasama <= B:

                count += 1

print(count)

A, B = list(map(int, input().split()))
numbers = list(range(A, B + 1))
count = 0
for i in numbers:
    m = str(i)
    rm = "".join(list(reversed(m)))
    if m == rm:
        count += 1
print(count)

A, B = list(map(int, input().split()))
x = list(range(1, 10))
y = list(range(10))
count = 0
for p in x:
    for q in y:
        for r in y:
            sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))
            if A <= sakasama <= B:
                count += 1
print(count)

+            sakasama = int(str(p) + str(q) + str(r) + str(q) + str(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

from operator import itemgetter

from heapq import heapify, heappop, heappush

MAX_INT = int(10e15)

MIN_INT = -MAX_INT

mod = 1000000007

sys.setrecursionlimit(1000000)

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

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

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

def S(): return eval(input())

N, T = IL()

ab = [IL() for i in range(N)]

ab.sort(key=itemgetter(0))

#print(ab)

dp = [[0]*(T+1+3000+1) for _ in range(N+1)]

ans = 0

for i in range(N):

  for j in range(T+1+3000+1):

    time, deli = ab[i]

    if 0 <= j-time < T:

      dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)

    else:

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

    ans = max(ans, dp[i + 1][j])

print(ans)

#print(dp)

# optimized version of the same code:

import sys

from collections import deque

MAX_INT = int(10e10)

MIN_INT = -MAX_INT

mod = 1000000007

sys.setrecursionlimit(1000000)

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

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

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

def S(): return eval(input())

N,T = IL()

ab = [IL() for i in range(N)]

ab.sort()

ans = 0

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

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

  a,b = ab[i-1]

  for j in range(T):

    if 0 <= j-a < T:

      dp[i][j] = max(dp[i-1][j], dp[i-1][j-a] + b)

    else:

      dp[i][j] = dp[i-1][j]

  else:

    ans = max(ans, dp[i-1][-1] + b)

print(ans)

import sys
from operator import itemgetter
from heapq import heapify, heappop, heappush

MAX_INT = int(10e15)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)

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

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

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

def S():
    return eval(input())

N, T = IL()
ab = [IL() for i in range(N)]
ab.sort(key=itemgetter(0))
# print(ab)
dp = [[0] * (T + 1 + 3000 + 1) for _ in range(N + 1)]
ans = 0
for i in range(N):
    for j in range(T + 1 + 3000 + 1):
        time, deli = ab[i]
        if 0 <= j - time < T:
            dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)
        else:
            dp[i + 1][j] = dp[i][j]
        ans = max(ans, dp[i + 1][j])
print(ans)
# print(dp)

import sys
from collections import deque

MAX_INT = int(10e10)
MIN_INT = -MAX_INT
mod = 1000000007
sys.setrecursionlimit(1000000)

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

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

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

def S():
    return eval(input())

N, T = IL()
ab = [IL() for i in range(N)]
ab.sort()
ans = 0
dp = [[0] * T for i in range(N + 1)]
for i in range(1, N + 1):
    a, b = ab[i - 1]
    for j in range(T):
        if 0 <= j - a < T:
            dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - a] + b)
        else:
            dp[i][j] = dp[i - 1][j]
    else:
        ans = max(ans, dp[i - 1][-1] + b)
print(ans)

-from heapq import heapify, heappop, heappush

-            dp[i + 1][j] = max(dp[i][j], dp[i][j - time] + deli)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

from functools import lru_cache

import sys

sys.setrecursionlimit(10 ** 7)

@lru_cache(maxsize=None)

def check(l, r, n, k=1):

    t = l + '0' * k + r

    e = l + '9' * k + r

    if int(e) <= n:

        return pow(10, k) + check(l, r, n, k + 1)

    if int(t) <= n < int(e):

        x = int(str(n)[1:-1])

        if int(str(n)[-1]) < int(r):

            x -= 1

        return x + 1

    if n < int(t):

        return 0

def main():

    n = int(eval(input()))

    ret = 0

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

        if x % 10 == 0:

            continue

        s = str(x)

        t = s[-1] + s[0]

        if s[0] == s[-1]:

            ret += 1

        if int(t) <= n:

            ret += 1

        ret += check(s[-1], s[0], n, k=1)

    print(ret)

if __name__ == '__main__':

    main()

# optimized version of the same code:

# 解説放送

def main():

    from collections import defaultdict

    n = int(eval(input()))

    d = defaultdict(int)

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

        if x % 10 == 0:

            continue

        tail = x % 10

        head = 0

        while x:

            head = x

            x //= 10

        d[head, tail] += 1

    ret = 0

    for (head, tail), cnt in tuple(d.items()):

        # RuntimeError: dictionary changed size during iteration

        # defaultdictの未定義(?)のkeyにアクセスするせいで、REになる

        # d.items()をtuple化して回避

        ret += d[head, tail] * d[tail, head]

        # (head,tail)の出現数を辞書で管理する

        # (head,tail)*(tail,head)の組み合わせがある

    print(ret)

if __name__ == '__main__':

    main()

from functools import lru_cache
import sys

sys.setrecursionlimit(10**7)

@lru_cache(maxsize=None)
def check(l, r, n, k=1):
    t = l + "0" * k + r
    e = l + "9" * k + r
    if int(e) <= n:
        return pow(10, k) + check(l, r, n, k + 1)
    if int(t) <= n < int(e):
        x = int(str(n)[1:-1])
        if int(str(n)[-1]) < int(r):
            x -= 1
        return x + 1
    if n < int(t):
        return 0

def main():
    n = int(eval(input()))
    ret = 0
    for x in range(1, n + 1):
        if x % 10 == 0:
            continue
        s = str(x)
        t = s[-1] + s[0]
        if s[0] == s[-1]:
            ret += 1
        if int(t) <= n:
            ret += 1
        ret += check(s[-1], s[0], n, k=1)
    print(ret)

if __name__ == "__main__":
    main()

# 解説放送
def main():
    from collections import defaultdict

    n = int(eval(input()))
    d = defaultdict(int)
    for x in range(1, n + 1):
        if x % 10 == 0:
            continue
        tail = x % 10
        head = 0
        while x:
            head = x
            x //= 10
        d[head, tail] += 1
    ret = 0
    for (head, tail), cnt in tuple(d.items()):
        # RuntimeError: dictionary changed size during iteration
        # defaultdictの未定義(?)のkeyにアクセスするせいで、REになる
        # d.items()をtuple化して回避
        ret += d[head, tail] * d[tail, head]
        # (head,tail)の出現数を辞書で管理する
        # (head,tail)*(tail,head)の組み合わせがある
    print(ret)

if __name__ == "__main__":
    main()

+    from collections import defaultdict

-        return pow(10, k) + check(l, r, n, k + 1)

+    for (head, tail), cnt in tuple(d.items()):

+        # RuntimeError: dictionary changed size during iteration

+        # defaultdictの未定義(?)のkeyにアクセスするせいで、REになる

+        ret += d[head, tail] * d[tail, head]

+        # (head,tail)*(tail,head)の組み合わせがある


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

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

def trial_division(n):

    factor = []

    tmp = int(math.sqrt(n)) + 1

    for _ in range(2,tmp):

        while n % 2 == 0:

            n //= 2

            factor.append(2)

    if not factor:

        return [n]

    else:

        factor.append(n)

        return factor

count = 0

for i in a:

    temp = trial_division(i)

    count += temp.count(2)

print(count)

# optimized version of the same code:

n = int(eval(input()))

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

def trial_division(n):

    #２で割った因数を格納するリスト

    factor = []

    #2で割れなくなった時点でストップ

    while n % 2 == 0:

        n //= 2    # ２で割った商を切り捨てて代入

        factor.append(2)

    #nが一度も２で割れなかったらそのまま返す

    if not factor:

        return [n]

    else:

        factor.append(n)

        return factor

count = 0

for i in a:

    temp = trial_division(i)

    count += temp.count(2)

print(count)

import math

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

def trial_division(n):
    factor = []
    tmp = int(math.sqrt(n)) + 1
    for _ in range(2, tmp):
        while n % 2 == 0:
            n //= 2
            factor.append(2)
    if not factor:
        return [n]
    else:
        factor.append(n)
        return factor

count = 0
for i in a:
    temp = trial_division(i)
    count += temp.count(2)
print(count)

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

def trial_division(n):
    # ２で割った因数を格納するリスト
    factor = []
    # 2で割れなくなった時点でストップ
    while n % 2 == 0:
        n //= 2  # ２で割った商を切り捨てて代入
        factor.append(2)
    # nが一度も２で割れなかったらそのまま返す
    if not factor:
        return [n]
    else:
        factor.append(n)
        return factor

count = 0
for i in a:
    temp = trial_division(i)
    count += temp.count(2)
print(count)

-import math
+    # ２で割った因数を格納するリスト
-    tmp = int(math.sqrt(n)) + 1
-    for _ in range(2, tmp):
-        while n % 2 == 0:
-            n //= 2
-            factor.append(2)
+    # 2で割れなくなった時点でストップ
+    while n % 2 == 0:
+        n //= 2  # ２で割った商を切り捨てて代入
+        factor.append(2)
+    # nが一度も２で割れなかったらそのまま返す


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

# N個の荷物、ナップザックの容量はW

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

w = [0] * N

v = [0] * N

for i in range(N):

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

    w[i] = a

    v[i] = b

# 1 <= W <= 10^9なので横軸をWにするとテーブルがでかすぎる

# そのかわりにVの方を横軸にする

# 価値の総合計はまだ不明なので、適当にでかい値にしとく

# 最上部と最左部に0が入るので、その分を+1

V = N*1000+1

dp = [ [float('inf') for _ in range(V+1)] for _ in range(N+1) ]

# 最小値を求めるので、上記でinfが入ってるので、初期値は0をいれる必要がある

dp[0][0] = 0

# dp[i][sum_v] = これまで(i-1)番目までの品物から価値がsum_v以上になるように選んだときの、重さの総和の最小値

for i in range(N):

    for sum_v in range(V):

        if sum_v - v[i] >= 0:

            dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v-v[i]]+w[i])

        dp[i+1][sum_v] = min(dp[i+1][sum_v], dp[i][sum_v])

# 中身がWなので、W以下であるうちのsum_vの最大値を求めればいい

for sum_v in range(V):

    # 最終行だけ見ればいいので、端からsum_vの最大値をなめるだけ

    if dp[N][sum_v] <= W:

        ans = sum_v

print(ans)

# optimized version of the same code:

import sys

input = sys.stdin.readline

sys.setrecursionlimit(2147483647)

INF=float("inf")

MOD=10**9+7

# A = [ int(input()) for _ in range(N) ]

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

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

w = []

v = []

for i in range(N):

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

    w.append(a)

    v.append(b)

V = sum(v)

dp = [ [INF for _ in range(V+1)] for _ in range(N+1) ]

dp[0][0] = 0

for i in range(N):

    for j in range(V+1):

        if j - v[i] < 0:

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

        else:

            dp[i+1][j] = min(dp[i][j], dp[i][j-v[i]]+w[i])

#print(dp[N])

ans = 0

for v in range(V+1):

    if dp[N][v] <= W:

        ans = v

print(ans)

# N個の荷物、ナップザックの容量はW
N, W = list(map(int, input().split()))
w = [0] * N
v = [0] * N
for i in range(N):
    a, b = list(map(int, input().split()))
    w[i] = a
    v[i] = b
# 1 <= W <= 10^9なので横軸をWにするとテーブルがでかすぎる
# そのかわりにVの方を横軸にする
# 価値の総合計はまだ不明なので、適当にでかい値にしとく
# 最上部と最左部に0が入るので、その分を+1
V = N * 1000 + 1
dp = [[float("inf") for _ in range(V + 1)] for _ in range(N + 1)]
# 最小値を求めるので、上記でinfが入ってるので、初期値は0をいれる必要がある
dp[0][0] = 0
# dp[i][sum_v] = これまで(i-1)番目までの品物から価値がsum_v以上になるように選んだときの、重さの総和の最小値
for i in range(N):
    for sum_v in range(V):
        if sum_v - v[i] >= 0:
            dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v - v[i]] + w[i])
        dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v])
# 中身がWなので、W以下であるうちのsum_vの最大値を求めればいい
for sum_v in range(V):
    # 最終行だけ見ればいいので、端からsum_vの最大値をなめるだけ
    if dp[N][sum_v] <= W:
        ans = sum_v
print(ans)

import sys

input = sys.stdin.readline
sys.setrecursionlimit(2147483647)
INF = float("inf")
MOD = 10**9 + 7
# A = [ int(input()) for _ in range(N) ]
##############################
N, W = list(map(int, input().split()))
w = []
v = []
for i in range(N):
    a, b = list(map(int, input().split()))
    w.append(a)
    v.append(b)
V = sum(v)
dp = [[INF for _ in range(V + 1)] for _ in range(N + 1)]
dp[0][0] = 0
for i in range(N):
    for j in range(V + 1):
        if j - v[i] < 0:
            dp[i + 1][j] = dp[i][j]
        else:
            dp[i + 1][j] = min(dp[i][j], dp[i][j - v[i]] + w[i])
# print(dp[N])
ans = 0
for v in range(V + 1):
    if dp[N][v] <= W:
        ans = v
print(ans)

-# N個の荷物、ナップザックの容量はW

+# A = [ int(input()) for _ in range(N) ]

-# 1 <= W <= 10^9なので横軸をWにするとテーブルがでかすぎる

-# そのかわりにVの方を横軸にする

-# 価値の総合計はまだ不明なので、適当にでかい値にしとく

-# 最上部と最左部に0が入るので、その分を+1

-dp = [[float("inf") for _ in range(V + 1)] for _ in range(N + 1)]

-# 最小値を求めるので、上記でinfが入ってるので、初期値は0をいれる必要がある

+dp = [[INF for _ in range(V + 1)] for _ in range(N + 1)]

-# dp[i][sum_v] = これまで(i-1)番目までの品物から価値がsum_v以上になるように選んだときの、重さの総和の最小値

-        dp[i + 1][sum_v] = min(dp[i + 1][sum_v], dp[i][sum_v])

-# 中身がWなので、W以下であるうちのsum_vの最大値を求めればいい

-    # 最終行だけ見ればいいので、端からsum_vの最大値をなめるだけ


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

sys.setrecursionlimit(10 ** 9)

INF = 1 << 60

MOD = 1000000007

# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/

# Python3 code to find number of

# distinct numbers in a subarray

MAX = 1000001

# structure to store queries

class Query:

    def __init__(self, l, r, idx):

        self.l = l

        self.r = r

        self.idx = idx

# updating the bit array

def update(idx, val, bit, n):

    while idx <= n:

        bit[idx] += val

        idx += idx & -idx

# querying the bit array

def query(idx, bit, n):

    summ = 0

    while idx:

        summ += bit[idx]

        idx -= idx & -idx

    return summ

def answeringQueries(arr, n, queries, q):

    # initialising bit array

    bit = [0] * (n + 1)

    # holds the rightmost index of

    # any number as numbers of a[i]

    # are less than or equal to 10^6

    last_visit = [-1] * MAX

    # answer for each query

    ans = [0] * q

    query_counter = 0

    for i in range(n):

        # If last visit is not -1 update -1 at the

        # idx equal to last_visit[arr[i]]

        if last_visit[arr[i]] != -1:

            update(last_visit[arr[i]] + 1, -1, bit, n)

        # Setting last_visit[arr[i]] as i and

        # updating the bit array accordingly

        last_visit[arr[i]] = i

        update(i + 1, 1, bit, n)

        # If i is equal to r of any query store answer

        # for that query in ans[]

        while query_counter < q and queries[query_counter].r == i:

            ans[queries[query_counter].idx] = query(queries[query_counter].r + 1, bit, n) - query(

                queries[query_counter].l, bit, n

            )

            query_counter += 1

    # print answer for each query

    for i in range(q):

        print((ans[i]))

# This code is contributed by

# sanjeev2552

def main():

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

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

    (*LR,) = list(map(int, read().split()))

    queries = [0] * Q

    for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):

        queries[i] = Query(l - 1, r - 1, i)

    queries.sort(key=lambda x: x.r)

    answeringQueries(C, N, queries, Q)

    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

MOD = 1000000007

class BIT:

    def __init__(self, n):

        self.n = n

        self.data = [0] * (n + 1)

    def add(self, i, x=1):

        i += 1

        while i <= self.n:

            self.data[i] += x

            i += i & -i

    def get_sum(self, i):

        i += 1

        x = 0

        while i > 0:

            x += self.data[i]

            i -= i & -i

        return x

    # Return sum for [l, r)

    def get_sum_range(self, l, r):

        return self.get_sum(r - 1) - self.get_sum(l - 1)

def main():

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

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

    LR = map(int, read().split())

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

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

    for i, c in enumerate(C):

        if prev[c] != -1:

            ps[prev[c]].append(i)

        prev[c] = i

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

    for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):

        l -= 1

        r -= 1

        qs[l].append((r, i))

    ans = [0] * Q

    bit = BIT(N)

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

        for r in ps[l]:

            bit.add(r)

        for r, i in qs[l]:

            ans[i] = (r - l + 1) - bit.get_sum(r)

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

    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
MOD = 1000000007
# Reference: https://www.geeksforgeeks.org/queries-number-distinct-elements-subarray/
# Python3 code to find number of
# distinct numbers in a subarray
MAX = 1000001
# structure to store queries
class Query:
    def __init__(self, l, r, idx):
        self.l = l
        self.r = r
        self.idx = idx

# updating the bit array
def update(idx, val, bit, n):
    while idx <= n:
        bit[idx] += val
        idx += idx & -idx

# querying the bit array
def query(idx, bit, n):
    summ = 0
    while idx:
        summ += bit[idx]
        idx -= idx & -idx
    return summ

def answeringQueries(arr, n, queries, q):
    # initialising bit array
    bit = [0] * (n + 1)
    # holds the rightmost index of
    # any number as numbers of a[i]
    # are less than or equal to 10^6
    last_visit = [-1] * MAX
    # answer for each query
    ans = [0] * q
    query_counter = 0
    for i in range(n):
        # If last visit is not -1 update -1 at the
        # idx equal to last_visit[arr[i]]
        if last_visit[arr[i]] != -1:
            update(last_visit[arr[i]] + 1, -1, bit, n)
        # Setting last_visit[arr[i]] as i and
        # updating the bit array accordingly
        last_visit[arr[i]] = i
        update(i + 1, 1, bit, n)
        # If i is equal to r of any query store answer
        # for that query in ans[]
        while query_counter < q and queries[query_counter].r == i:
            ans[queries[query_counter].idx] = query(
                queries[query_counter].r + 1, bit, n
            ) - query(queries[query_counter].l, bit, n)
            query_counter += 1
    # print answer for each query
    for i in range(q):
        print((ans[i]))

# This code is contributed by
# sanjeev2552
def main():
    N, Q = list(map(int, readline().split()))
    C = list(map(int, readline().split()))
    (*LR,) = list(map(int, read().split()))
    queries = [0] * Q
    for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):
        queries[i] = Query(l - 1, r - 1, i)
    queries.sort(key=lambda x: x.r)
    answeringQueries(C, N, queries, Q)
    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
MOD = 1000000007

class BIT:
    def __init__(self, n):
        self.n = n
        self.data = [0] * (n + 1)

    def add(self, i, x=1):
        i += 1
        while i <= self.n:
            self.data[i] += x
            i += i & -i

    def get_sum(self, i):
        i += 1
        x = 0
        while i > 0:
            x += self.data[i]
            i -= i & -i
        return x

    # Return sum for [l, r)
    def get_sum_range(self, l, r):
        return self.get_sum(r - 1) - self.get_sum(l - 1)

def main():
    N, Q = map(int, readline().split())
    C = list(map(int, readline().split()))
    LR = map(int, read().split())
    prev = [-1] * (N + 1)
    ps = [[] for _ in range(N)]
    for i, c in enumerate(C):
        if prev[c] != -1:
            ps[prev[c]].append(i)
        prev[c] = i
    qs = [[] for _ in range(N + 1)]
    for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):
        l -= 1
        r -= 1
        qs[l].append((r, i))
    ans = [0] * Q
    bit = BIT(N)
    for l in range(N - 1, -1, -1):
        for r in ps[l]:
            bit.add(r)
        for r, i in qs[l]:
            ans[i] = (r - l + 1) - bit.get_sum(r)
    print(*ans, sep="\n")
    return

if __name__ == "__main__":
    main()

+        return self.get_sum(r - 1) - self.get_sum(l - 1)

-def answeringQueries(arr, n, queries, q):

-        # If last visit is not -1 update -1 at the

-        # idx equal to last_visit[arr[i]]

-            update(last_visit[arr[i]] + 1, -1, bit, n)

-        # Setting last_visit[arr[i]] as i and

-        # updating the bit array accordingly

-        # If i is equal to r of any query store answer

-        while query_counter < q and queries[query_counter].r == i:

-            ans[queries[query_counter].idx] = query(

-                queries[query_counter].r + 1, bit, n

-            ) - query(queries[query_counter].l, bit, n)

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

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

-    (*LR,) = list(map(int, read().split()))

-        queries[i] = Query(l - 1, r - 1, i)

+            ans[i] = (r - l + 1) - bit.get_sum(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:

k = int(eval(input()))

num = 0

if not k%2:

    print((-1))

else:

    for i in range(k):

        num = (num*10+7)%k

        if num == 0:

            print((i+1))

            break

    else:

        print((-1))

# optimized version of the same code:

K = int(eval(input()))

ans = 1

num = 0

seven = 7

if not K%2:

    print((-1))

else:

    for i in range(K):

        num = num + seven

        seven = seven*10%K

        num = num%K

        if num == 0:

            print(ans)

            break

        ans += 1

    else:

        print((-1))

k = int(eval(input()))
num = 0
if not k % 2:
    print((-1))
else:
    for i in range(k):
        num = (num * 10 + 7) % k
        if num == 0:
            print((i + 1))
            break
    else:
        print((-1))

K = int(eval(input()))
ans = 1
num = 0
seven = 7
if not K % 2:
    print((-1))
else:
    for i in range(K):
        num = num + seven
        seven = seven * 10 % K
        num = num % K
        if num == 0:
            print(ans)
            break
        ans += 1
    else:
        print((-1))

-k = int(eval(input()))
+K = int(eval(input()))
+ans = 1
-if not k % 2:
+seven = 7
+if not K % 2:
-    for i in range(k):
-        num = (num * 10 + 7) % k
+    for i in range(K):
+        num = num + seven
+        seven = seven * 10 % K
+        num = num % K
-            print((i + 1))
+            print(ans)
+        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=int(eval(input()))

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

import numpy as np

d = np.array(d)

print(( ( (np.sum(d))**2 - np.sum(d**2) ) // 2 ))

# optimized version of the same code:

N=int(eval(input()))

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

cumsum = 0

for n in range(N):

    cumsum += d[n]

sub_cumsum = 0

ans = 0

for n in range(N):

    sub_cumsum += d[n]

    ans += d[n] * (cumsum-sub_cumsum)

print(ans)

N = int(eval(input()))
d = list(map(int, input().split()))
import numpy as np

d = np.array(d)
print((((np.sum(d)) ** 2 - np.sum(d**2)) // 2))

N = int(eval(input()))
d = list(map(int, input().split()))
cumsum = 0
for n in range(N):
    cumsum += d[n]
sub_cumsum = 0
ans = 0
for n in range(N):
    sub_cumsum += d[n]
    ans += d[n] * (cumsum - sub_cumsum)
print(ans)

+    ans += d[n] * (cumsum - sub_cumsum)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

k = int(eval(input()))

count = 1

n = 0

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

    print((-1))

else:

  while 1:

      n = (n * 10 + 7) % k

      if n == 0:

        break

      count += 1

  print(count)

# optimized version of the same code:

def main(h):

  count = 1

  n = 0

  for i in range (k):

    n = (n * 10 + 7) % k

    if n == 0:

      print(count)

      return 0

    count += 1

  print((-1))

if __name__ == '__main__':

  k = int(eval(input()))

  main(k)

def main(h):
    count = 1
    n = 0
    for i in range(k):
        n = (n * 10 + 7) % k
        if n == 0:
            print(count)
            return 0
        count += 1
    print((-1))

if __name__ == "__main__":
    k = int(eval(input()))
    main(k)

-k = int(eval(input()))
-count = 1
-n = 0
-if k % 2 == 0 or k % 5 == 0:
-    print((-1))
-else:
-    while 1:
+def main(h):
+    count = 1
+    n = 0
+    for i in range(k):
-            break
+            print(count)
+            return 0
-    print(count)
+    print((-1))
+
+
+if __name__ == "__main__":
+    k = int(eval(input()))
+    main(k)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

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

print((c*10 + b + a))

# optimized version of the same code:

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

print((max(a, b, c)*9 + (a + b + c)))

a, b, c = sorted(map(int, input().split()))
print((c * 10 + b + a))

a, b, c = list(map(int, input().split()))
print((max(a, b, c) * 9 + (a + b + c)))

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

+a, b, c = 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 = float('inf')

for i in range(200005):

    tmp = i * 2 * c

    tmp += max(0, x-i) * a

    tmp += max(0, y-i) * b

    ans = min(ans, tmp)

print(ans)

# optimized version of the same code:

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

ans = float('inf')

for i in range(100005):

    tmp = i * 2 * c

    tmp += max(0, x-i) * a

    tmp += max(0, y-i) * b

    ans = min(ans, tmp)

print(ans)

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

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

-for i in range(200005):
+for i in range(100005):


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

readline = sys.stdin.buffer.readline

read = sys.stdin.readline  # 文字列読み込む時はこっち

ra = range

enu = enumerate

def exit(*argv, **kwarg):

    print(*argv, **kwarg)

    sys.exit()

def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))

# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと

def a_int(): return int(readline())

def ints(): return list(map(int, readline().split()))

def _make_minimum_prime(N: int):

    # xの最小の素因数表を作成

    min_prime = [x for x in range(N + 1)]

    # min_prime[0] = 0  # 0と1は素数ではない

    # min_prime[1] = 1

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

        if min_prime[i] == i:  # 素数だったら更新

            for j in range(2 * i, N + 1, i):  # iの倍数は素数でない

                if min_prime[j] == j:

                    min_prime[j] = i

    return min_prime

min_prime = _make_minimum_prime(10**6)

from collections import Counter

def fast_factorization(N: int):

    # -> List[Tuple[int,int]] (素数,冪数)を格納

    # 最小素数配列min_primeを使ってO(log N)で因数分解

    if N == 1:

        return Counter()  # 1は素数ではない

    # 素因数分解

    arr = []

    tmp = N

    while tmp != 1:

        p = min_prime[tmp]

        tmp //= p

        arr.append(p)

    return Counter(arr)

MOD = 10**9 + 7

INF = 2**31  # 2147483648 > 10**9

# default import

from collections import defaultdict, Counter, deque

import random

from math import gcd

N = a_int()

A = ints()

random.shuffle(A)

# setかはすぐわかる

# setでなければ not coprime

# pairは互いに素かをみればいいのか

# つまり因数分解して足してったときにすべての素数のべき数が1以下であれば良い

g_set = 0

cnt = defaultdict(lambda: 0)

flg = 1  # pairwiseであるフラグ

for a in A:

    g_set = gcd(g_set, a)

    if flg:

        for p, n in fast_factorization(a).items():

            if cnt[p] != 0:

                flg = 0

            cnt[p] += n

# print(cnt)

# for v in cnt.values():

#     if v > 1:

#         flg = 0

#         break

if g_set > 1:

    print('not coprime')

elif flg:

    print('pairwise coprime')

else:

    print('setwise coprime')

# optimized version of the same code:

import sys

sys.setrecursionlimit(1 << 25)

readline = sys.stdin.buffer.readline

read = sys.stdin.readline  # 文字列読み込む時はこっち

ra = range

enu = enumerate

def exit(*argv, **kwarg):

    print(*argv, **kwarg)

    sys.exit()

def mina(*argv, sub=1): return list(map(lambda x: x - sub, argv))

# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと

def a_int(): return int(readline())

def ints(): return list(map(int, readline().split()))

from collections import Counter

class FastFactorization:

    def __init__(self, N: int):

        '''構築O(NloglogN)、クエリO(logN)'''

        self.N = N

        self.min_prime = self._make_minimum_prime()

    def _make_minimum_prime(self):

        # xの最小の素因数表を作成

        min_prime = [x for x in range(self.N + 1)]

        # min_prime[0] = 0  # 0と1は素数ではない

        # min_prime[1] = 1

        for i in range(2, int(self.N ** 0.5) + 1):

            if min_prime[i] == i:  # 素数だったら更新

                for j in range(2 * i, self.N + 1, i):  # iの倍数は素数でない

                    if min_prime[j] == j:

                        min_prime[j] = i

        return min_prime

    def query(self, x: int):

        # -> Counter[p,n] (素数,冪数) を格納

        # 最小素数配列min_primeを使ってO(log N)で因数分解

        if x == 1:

            return Counter()  # 1は素数ではない

        # 素因数分解

        arr = []

        tmp = x

        while tmp != 1:

            p = self.min_prime[tmp]

            tmp //= p

            arr.append(p)

        return Counter(arr)

MOD = 10**9 + 7

INF = 2**31  # 2147483648 > 10**9

# default import

from collections import defaultdict, Counter, deque

from math import gcd

N = a_int()

A = ints()

fact = FastFactorization(max(A))

# setかはすぐわかる

# setでなければ not coprime

# pairは互いに素かをみればいいのか

# つまり因数分解して足してったときにすべての素数のべき数が1以下であれば良い

g_set = 0

cnt = defaultdict(lambda: 0)

flg = 1  # pairwiseであるフラグ

for a in A:

    g_set = gcd(g_set, a)

    if flg:

        for p, n in fact.query(a).items():

            if cnt[p] != 0:

                flg = 0

            cnt[p] += n

# print(cnt)

# for v in cnt.values():

#     if v > 1:

#         flg = 0

#         break

if g_set > 1:

    print('not coprime')

elif flg:

    print('pairwise coprime')

else:

    print('setwise coprime')

import sys

sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline  # 文字列読み込む時はこっち
ra = range
enu = enumerate

def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()

def mina(*argv, sub=1):
    return list(map(lambda x: x - sub, argv))

# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def a_int():
    return int(readline())

def ints():
    return list(map(int, readline().split()))

def _make_minimum_prime(N: int):
    # xの最小の素因数表を作成
    min_prime = [x for x in range(N + 1)]
    # min_prime[0] = 0  # 0と1は素数ではない
    # min_prime[1] = 1
    for i in range(2, int(N**0.5) + 1):
        if min_prime[i] == i:  # 素数だったら更新
            for j in range(2 * i, N + 1, i):  # iの倍数は素数でない
                if min_prime[j] == j:
                    min_prime[j] = i
    return min_prime

min_prime = _make_minimum_prime(10**6)
from collections import Counter

def fast_factorization(N: int):
    # -> List[Tuple[int,int]] (素数,冪数)を格納
    # 最小素数配列min_primeを使ってO(log N)で因数分解
    if N == 1:
        return Counter()  # 1は素数ではない
    # 素因数分解
    arr = []
    tmp = N
    while tmp != 1:
        p = min_prime[tmp]
        tmp //= p
        arr.append(p)
    return Counter(arr)

MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
import random
from math import gcd

N = a_int()
A = ints()
random.shuffle(A)
# setかはすぐわかる
# setでなければ not coprime
# pairは互いに素かをみればいいのか
# つまり因数分解して足してったときにすべての素数のべき数が1以下であれば良い
g_set = 0
cnt = defaultdict(lambda: 0)
flg = 1  # pairwiseであるフラグ
for a in A:
    g_set = gcd(g_set, a)
    if flg:
        for p, n in fast_factorization(a).items():
            if cnt[p] != 0:
                flg = 0
            cnt[p] += n
# print(cnt)
# for v in cnt.values():
#     if v > 1:
#         flg = 0
#         break
if g_set > 1:
    print("not coprime")
elif flg:
    print("pairwise coprime")
else:
    print("setwise coprime")

import sys

sys.setrecursionlimit(1 << 25)
readline = sys.stdin.buffer.readline
read = sys.stdin.readline  # 文字列読み込む時はこっち
ra = range
enu = enumerate

def exit(*argv, **kwarg):
    print(*argv, **kwarg)
    sys.exit()

def mina(*argv, sub=1):
    return list(map(lambda x: x - sub, argv))

# 受け渡されたすべての要素からsubだけ引く.リストを*をつけて展開しておくこと
def a_int():
    return int(readline())

def ints():
    return list(map(int, readline().split()))

from collections import Counter

class FastFactorization:
    def __init__(self, N: int):
        """構築O(NloglogN)、クエリO(logN)"""
        self.N = N
        self.min_prime = self._make_minimum_prime()

    def _make_minimum_prime(self):
        # xの最小の素因数表を作成
        min_prime = [x for x in range(self.N + 1)]
        # min_prime[0] = 0  # 0と1は素数ではない
        # min_prime[1] = 1
        for i in range(2, int(self.N**0.5) + 1):
            if min_prime[i] == i:  # 素数だったら更新
                for j in range(2 * i, self.N + 1, i):  # iの倍数は素数でない
                    if min_prime[j] == j:
                        min_prime[j] = i
        return min_prime

    def query(self, x: int):
        # -> Counter[p,n] (素数,冪数) を格納
        # 最小素数配列min_primeを使ってO(log N)で因数分解
        if x == 1:
            return Counter()  # 1は素数ではない
        # 素因数分解
        arr = []
        tmp = x
        while tmp != 1:
            p = self.min_prime[tmp]
            tmp //= p
            arr.append(p)
        return Counter(arr)

MOD = 10**9 + 7
INF = 2**31  # 2147483648 > 10**9
# default import
from collections import defaultdict, Counter, deque
from math import gcd

N = a_int()
A = ints()
fact = FastFactorization(max(A))
# setかはすぐわかる
# setでなければ not coprime
# pairは互いに素かをみればいいのか
# つまり因数分解して足してったときにすべての素数のべき数が1以下であれば良い
g_set = 0
cnt = defaultdict(lambda: 0)
flg = 1  # pairwiseであるフラグ
for a in A:
    g_set = gcd(g_set, a)
    if flg:
        for p, n in fact.query(a).items():
            if cnt[p] != 0:
                flg = 0
            cnt[p] += n
# print(cnt)
# for v in cnt.values():
#     if v > 1:
#         flg = 0
#         break
if g_set > 1:
    print("not coprime")
elif flg:
    print("pairwise coprime")
else:
    print("setwise coprime")

-    # xの最小の素因数表を作成

-    min_prime = [x for x in range(N + 1)]

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

-        if min_prime[i] == i:  # 素数だったら更新

-            for j in range(2 * i, N + 1, i):  # iの倍数は素数でない

-    # -> List[Tuple[int,int]] (素数,冪数)を格納

-    # 素因数分解

+        self.min_prime = self._make_minimum_prime()

+        # xの最小の素因数表を作成

+        min_prime = [x for x in range(self.N + 1)]

+        # min_prime[0] = 0  # 0と1は素数ではない

+        for i in range(2, int(self.N**0.5) + 1):

+            if min_prime[i] == i:  # 素数だったら更新

+                for j in range(2 * i, self.N + 1, i):  # iの倍数は素数でない

+                    if min_prime[j] == j:

+                        min_prime[j] = i

+        # 最小素数配列min_primeを使ってO(log N)で因数分解

+            return Counter()  # 1は素数ではない

+        # 素因数分解

-        for p, n in fast_factorization(a).items():

+        for p, n in fact.query(a).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:

print((eval(input())))

# optimized version of the same code:


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

N = int(eval(input()))

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

def dfs(A_s, index,Bss):

    if index == N:

        tmp = 1

        for b in Bss:

            tmp *= b

        return 1 if tmp % 2 == 0 else 0

    b_mi = Bss.copy()

    b_mi.append(A_s[index] - 1)

    b = Bss.copy()

    b.append(A_s[index])

    b_pl = Bss.copy()

    b_pl.append(A_s[index] + 1)

    return dfs(A_s,index + 1, b_mi) + dfs(A_s,index + 1,b) + dfs(A_s,index + 1,b_pl)

print((dfs(As,0,[])))

# optimized version of the same code:

N = int(eval(input()))

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

tmp = 1

for i in range(N):

    if As[i] % 2 == 0:

       tmp *= 2

print((3 ** N - tmp))

N = int(eval(input()))
As = list(map(int, input().split()))

def dfs(A_s, index, Bss):
    if index == N:
        tmp = 1
        for b in Bss:
            tmp *= b
        return 1 if tmp % 2 == 0 else 0
    b_mi = Bss.copy()
    b_mi.append(A_s[index] - 1)
    b = Bss.copy()
    b.append(A_s[index])
    b_pl = Bss.copy()
    b_pl.append(A_s[index] + 1)
    return (
        dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)
    )

print((dfs(As, 0, [])))

N = int(eval(input()))
As = list(map(int, input().split()))
tmp = 1
for i in range(N):
    if As[i] % 2 == 0:
        tmp *= 2
print((3**N - tmp))

-        return 1 if tmp % 2 == 0 else 0

-        dfs(A_s, index + 1, b_mi) + dfs(A_s, index + 1, b) + dfs(A_s, index + 1, b_pl)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import numpy as np

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

def main():

    N = int(readline())

    X = [int(i) for i in readline().split()]

    X = np.array(X)

    ans = np.min(np.sum((X - np.arange(1,101).reshape(100, 1))**2, axis=1))

    print(ans)

if __name__ == "__main__":

    main()

# optimized version of the same code:

import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines

def main():

    N = int(readline())

    X = [int(i) for i in readline().split()]

    ans = float('inf')

    for i in range(1,101):

        tmp = 0

        for x in X:

            tmp += (x - i)**2

        if tmp < ans:

            ans = tmp

    print(ans)

if __name__ == "__main__":

    main()

import numpy as np
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())
    X = [int(i) for i in readline().split()]
    X = np.array(X)
    ans = np.min(np.sum((X - np.arange(1, 101).reshape(100, 1)) ** 2, axis=1))
    print(ans)

if __name__ == "__main__":
    main()

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N = int(readline())
    X = [int(i) for i in readline().split()]
    ans = float("inf")
    for i in range(1, 101):
        tmp = 0
        for x in X:
            tmp += (x - i) ** 2
        if tmp < ans:
            ans = tmp
    print(ans)

if __name__ == "__main__":
    main()

-    ans = np.min(np.sum((X - np.arange(1, 101).reshape(100, 1)) ** 2, axis=1))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import math

n=int(eval(input()))

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

# optimized version of the same code:

N=int(eval(input()))

def fact(n):

    val=1

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

        val*=i

        val%=1000000007

    return val

print((fact(N)))

import math

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

N = int(eval(input()))

def fact(n):
    val = 1
    for i in range(2, n + 1):
        val *= i
        val %= 1000000007
    return val

print((fact(N)))

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

from sys import stdin

from math import factorial

def combinations_count(n, r):

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

def combinations_with_replacement_count(n, r):

    return combinations_count(n + r - 1, r)

def main():

    _in = [_.rstrip() for _ in stdin.readlines()]

    S = int(_in[0])  # type:int

    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

    min_ = 1

    max_ = S // 3

    ans = 0

    for i in range(min_, max_ + 1):

        mod = S - i * 3

        ans += combinations_with_replacement_count(mod + 1, i - 1) % (10**9 + 7)

    ans %= (10**9 + 7)

    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    print(ans)

if __name__ == "__main__":

    main()

# optimized version of the same code:

from sys import stdin

class ModComb():

    def __init__(self, n_max, mod):

        self.fac = None

        self.mod = mod

        self.make_fac_table(n_max)

    def make_fac_table(self, n_max):

        self.fac = [1] + [0] * n_max

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

            self.fac[i] = self.fac[i - 1] * i % self.mod

    def mod_comb(self, n, k):

        if n == 0 and k == 0:

            return 1

        elif n < k or k < 0:

            return 0

        else:

            return self.fac[n] * pow(self.fac[n - k], self.mod - 2, self.mod) * \

                pow(self.fac[k], self.mod - 2, self.mod) % self.mod

    def mod_comb_with_rep(self, n, k):

        return self.mod_comb(n + k - 1, k)

def main():

    _in = [_.rstrip() for _ in stdin.readlines()]

    S = int(_in[0])  # type:int

    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

    ans = 0

    MOD = 10**9 + 7

    modcomb = ModComb(S + 1, MOD)

    min_ = 1

    max_ = S // 3

    for i in range(min_, max_ + 1):

        res = S - i * 3

        ans += modcomb.mod_comb_with_rep(res + 1, i - 1)

        ans %= MOD

    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

    print(ans)

if __name__ == "__main__":

    main()

from sys import stdin
from math import factorial

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

def combinations_with_replacement_count(n, r):
    return combinations_count(n + r - 1, r)

def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    S = int(_in[0])  # type:int
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    min_ = 1
    max_ = S // 3
    ans = 0
    for i in range(min_, max_ + 1):
        mod = S - i * 3
        ans += combinations_with_replacement_count(mod + 1, i - 1) % (10**9 + 7)
    ans %= 10**9 + 7
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)

if __name__ == "__main__":
    main()

from sys import stdin

class ModComb:
    def __init__(self, n_max, mod):
        self.fac = None
        self.mod = mod
        self.make_fac_table(n_max)

    def make_fac_table(self, n_max):
        self.fac = [1] + [0] * n_max
        for i in range(1, n_max + 1):
            self.fac[i] = self.fac[i - 1] * i % self.mod

    def mod_comb(self, n, k):
        if n == 0 and k == 0:
            return 1
        elif n < k or k < 0:
            return 0
        else:
            return (
                self.fac[n]
                * pow(self.fac[n - k], self.mod - 2, self.mod)
                * pow(self.fac[k], self.mod - 2, self.mod)
                % self.mod
            )

    def mod_comb_with_rep(self, n, k):
        return self.mod_comb(n + k - 1, k)

def main():
    _in = [_.rstrip() for _ in stdin.readlines()]
    S = int(_in[0])  # type:int
    # vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
    ans = 0
    MOD = 10**9 + 7
    modcomb = ModComb(S + 1, MOD)
    min_ = 1
    max_ = S // 3
    for i in range(min_, max_ + 1):
        res = S - i * 3
        ans += modcomb.mod_comb_with_rep(res + 1, i - 1)
        ans %= MOD
    # ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    print(ans)

if __name__ == "__main__":
    main()

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

+            self.fac[i] = self.fac[i - 1] * i % self.mod

-    return combinations_count(n + r - 1, r)

+                * pow(self.fac[n - k], self.mod - 2, self.mod)

+                * pow(self.fac[k], self.mod - 2, self.mod)

+        return self.mod_comb(n + k - 1, k)

-        ans += combinations_with_replacement_count(mod + 1, i - 1) % (10**9 + 7)

+        ans += modcomb.mod_comb_with_rep(res + 1, i - 1)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

N = int(eval(input()))

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

# 中央値

B = []

for i in range(N):

    B.append(A[i] - (i+1))

b = sorted(B)[N//2]

ans = 0

for i in range(N):

    ans += abs(A[i] - (i + 1) - b)

print(ans)

# optimized version of the same code:

from statistics import median_low

N = int(eval(input()))

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

D = []

for i in range(N):

    D.append(A[i] - (i+1))

m = median_low(D)

ans = 0

for d in D:

    ans += abs(d - m)

print(ans)

N = int(eval(input()))
A = list(map(int, input().split()))
# 中央値
B = []
for i in range(N):
    B.append(A[i] - (i + 1))
b = sorted(B)[N // 2]
ans = 0
for i in range(N):
    ans += abs(A[i] - (i + 1) - b)
print(ans)

from statistics import median_low

N = int(eval(input()))
A = list(map(int, input().split()))
D = []
for i in range(N):
    D.append(A[i] - (i + 1))
m = median_low(D)
ans = 0
for d in D:
    ans += abs(d - m)
print(ans)

+from statistics import median_low
+
-# 中央値
-B = []
+D = []
-    B.append(A[i] - (i + 1))
-b = sorted(B)[N // 2]
+    D.append(A[i] - (i + 1))
+m = median_low(D)
-for i in range(N):
-    ans += abs(A[i] - (i + 1) - b)
+for d in D:
+    ans += abs(d - 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(input())

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

tmp = [[e, n - i] for i, e in enumerate(a)]

tmp.sort(reverse=True)

aa = [[e, n - i] for e, i in tmp] + [[0, -1]]

v_prev, i_prev = aa[0]

i = 0

ans = [0] * n

sm = 0

while i < n:

    while aa[i][1] >= i_prev:

        sm += aa[i][0]

        i += 1

    ans[i_prev] += sm - aa[i][0] * i

    sm = aa[i][0] * i

    v_prev, i_prev = aa[i]

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

# optimized version of the same code:

from bisect import bisect_right

n = int(input())

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

li = [[0, -1]]

for i, e in enumerate(a):

    if e > li[-1][0]:

        li.append([e, i])

li = li[::-1]

a.sort()

acc = [0] * (n + 1)

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

    acc[i] = acc[i+1] + a[i]

ans = [0] * n

sub = 0

ans_prev = 0

for (ep, ip), (e, i) in zip(li, li[1:]):

    j = bisect_right(a, e)

    ans[ip] = acc[j] - e * (n - j)

i_prev = 0

for i in range(1, n):

    if ans[i]:

        ans[i_prev] -= ans[i]

        i_prev = i

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

from bisect import bisect_right

n = int(input())
a = list(map(int, input().split()))
li = [[0, -1]]
for i, e in enumerate(a):
    if e > li[-1][0]:
        li.append([e, i])
li = li[::-1]
a.sort()
acc = [0] * (n + 1)
for i in range(n - 1, -1, -1):
    acc[i] = acc[i + 1] + a[i]
ans = [0] * n
sub = 0
ans_prev = 0
for (ep, ip), (e, i) in zip(li, li[1:]):
    j = bisect_right(a, e)
    ans[ip] = acc[j] - e * (n - j)
i_prev = 0
for i in range(1, n):
    if ans[i]:
        ans[i_prev] -= ans[i]
        i_prev = i
print(*ans, sep="\n")

-tmp = [[e, n - i] for i, e in enumerate(a)]

+for (ep, ip), (e, i) in zip(li, li[1:]):


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

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

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

A = [0] * (N+3)

for a in A_:

    A[a] = 1

dp = [0] * (N+3)

dp[0] = 1

mod = 10**9+7

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

    if A[i-1] == 0:

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

    if A[i-2] == 0:

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

    dp[i] %= mod

print((dp[N]))

# optimized version of the same code:

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

dp=[0]*(n+3)

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

mod=10**9+7

for i in range(m):

    dp[a[i]]=-1

dp[0]=1

if dp[1]!=-1:

    dp[1]+=dp[0]

for i in range(n+1):

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

        continue

    if dp[i]!=-1:

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

    if dp[i+1]!=-1:

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

    dp[i+2]%=mod

print((dp[n]%mod))

N, M = list(map(int, input().split()))
A_ = [int(eval(input())) for _ in range(M)]
A = [0] * (N + 3)
for a in A_:
    A[a] = 1
dp = [0] * (N + 3)
dp[0] = 1
mod = 10**9 + 7
for i in range(1, N + 1):
    if A[i - 1] == 0:
        dp[i] += dp[i - 1]
    if A[i - 2] == 0:
        dp[i] += dp[i - 2]
    dp[i] %= mod
print((dp[N]))

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

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

+a = [int(eval(input())) 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:

# coding: utf-8

# Your code here!

import sys

read = sys.stdin.read

readline = sys.stdin.readline

#a,b,c,d = map(int,readline().split())

s,k = readline().split()

a = [len(i) for i in s.split("0")]

while a and a[-1] == 0: a.pop()

if not a:

    print((1))

    exit()

MOD = 998244353

M = sum(a)+1

k = min(int(k),M)

dp = [[0]*M for _ in range(k+1)] # j 使って（上限 k）、l 余ってる

dp[0][0] = 1

#print(a)

for ai in a[::-1]:

    ndp = [[0]*M for _ in range(k+1)] # j 使って（上限 k）、l 余ってる

    for j in range(k+1):

        for l in range(M):

            for ll in range(l):

                ndp[j][ll] += dp[j][l]

                ndp[j][ll] %= MOD

            V = min(M-l,k-j+1,ai+1)

            for i in range(V):

                #if j+i > k: break

                ndp[j+i][l+i] += dp[j][l]

                ndp[j+i][l+i] %= MOD

    dp = ndp

    #print(dp)

ans = 0

for jj in range(k+1):

    ans += dp[jj][0]

print((ans%MOD))

# optimized version of the same code:

# coding: utf-8

# Your code here!

import sys

read = sys.stdin.read

readline = sys.stdin.readline

#a,b,c,d = map(int,readline().split())

s,k = readline().split()

a = [len(i) for i in s.split("0")]

while a and a[-1] == 0: a.pop()

if not a:

    print((1))

    exit()

MOD = 998244353

M = sum(a)+1

k = min(int(k),M)

dp = [[0]*M for _ in range(k+1)] # j 使って（上限 k）、l 余ってる

dp[0][0] = 1

#print(a)

for ai in a[::-1]:

    ndp = [[0]*M for _ in range(k+1)] # j 使って（上限 k）、l 余ってる

    for j in range(k+1):

        for l in range(M):

            if dp[j][l]:

                for ll in range(l):

                    ndp[j][ll] += dp[j][l]

                    ndp[j][ll] %= MOD

                V = min(M-l,k-j+1,ai+1)

                for i in range(V):

                    #if j+i > k: break

                    ndp[j+i][l+i] += dp[j][l]

                    ndp[j+i][l+i] %= MOD

    dp = ndp

    #print(dp)

ans = 0

for jj in range(k+1):

    ans += dp[jj][0]

print((ans%MOD))

# coding: utf-8
# Your code here!
import sys

read = sys.stdin.read
readline = sys.stdin.readline
# a,b,c,d = map(int,readline().split())
s, k = readline().split()
a = [len(i) for i in s.split("0")]
while a and a[-1] == 0:
    a.pop()
if not a:
    print((1))
    exit()
MOD = 998244353
M = sum(a) + 1
k = min(int(k), M)
dp = [[0] * M for _ in range(k + 1)]  # j 使って（上限 k）、l 余ってる
dp[0][0] = 1
# print(a)
for ai in a[::-1]:
    ndp = [[0] * M for _ in range(k + 1)]  # j 使って（上限 k）、l 余ってる
    for j in range(k + 1):
        for l in range(M):
            for ll in range(l):
                ndp[j][ll] += dp[j][l]
                ndp[j][ll] %= MOD
            V = min(M - l, k - j + 1, ai + 1)
            for i in range(V):
                # if j+i > k: break
                ndp[j + i][l + i] += dp[j][l]
                ndp[j + i][l + i] %= MOD
    dp = ndp
    # print(dp)
ans = 0
for jj in range(k + 1):
    ans += dp[jj][0]
print((ans % MOD))

# coding: utf-8
# Your code here!
import sys

read = sys.stdin.read
readline = sys.stdin.readline
# a,b,c,d = map(int,readline().split())
s, k = readline().split()
a = [len(i) for i in s.split("0")]
while a and a[-1] == 0:
    a.pop()
if not a:
    print((1))
    exit()
MOD = 998244353
M = sum(a) + 1
k = min(int(k), M)
dp = [[0] * M for _ in range(k + 1)]  # j 使って（上限 k）、l 余ってる
dp[0][0] = 1
# print(a)
for ai in a[::-1]:
    ndp = [[0] * M for _ in range(k + 1)]  # j 使って（上限 k）、l 余ってる
    for j in range(k + 1):
        for l in range(M):
            if dp[j][l]:
                for ll in range(l):
                    ndp[j][ll] += dp[j][l]
                    ndp[j][ll] %= MOD
                V = min(M - l, k - j + 1, ai + 1)
                for i in range(V):
                    # if j+i > k: break
                    ndp[j + i][l + i] += dp[j][l]
                    ndp[j + i][l + i] %= MOD
    dp = ndp
    # print(dp)
ans = 0
for jj in range(k + 1):
    ans += dp[jj][0]
print((ans % MOD))

-                ndp[j + i][l + i] %= MOD

+                    # if j+i > k: break

+                    ndp[j + i][l + i] %= MOD


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

n=int(eval(input()))

D={}

DD={}

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

   s=(str(i)[0],str(i)[-1])

   t=(str(i)[-1],str(i)[0])

   if s not in D:

      D[s]=1

   else:

      D[s]+=1

   if t not in DD:

      DD[t]=1

   else:

      DD[t]+=1

ans=0

for i in D:

   if i in DD:

      ans+=D[i]*DD[i]

print(ans)

# optimized version of the same code:

n=int(eval(input()))

D={}

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

   s=(str(i)[0],str(i)[-1])

   if s in D:

      D[s]+=1

   else:

      D[s]=1

ans=0

for aj,bj in D:

   if (bj,aj) in D:

      ans+=D[(aj,bj)]*D[(bj,aj)]

print(ans)

n = int(eval(input()))
D = {}
DD = {}
for i in range(1, n + 1):
    s = (str(i)[0], str(i)[-1])
    t = (str(i)[-1], str(i)[0])
    if s not in D:
        D[s] = 1
    else:
        D[s] += 1
    if t not in DD:
        DD[t] = 1
    else:
        DD[t] += 1
ans = 0
for i in D:
    if i in DD:
        ans += D[i] * DD[i]
print(ans)

n = int(eval(input()))
D = {}
for i in range(1, n + 1):
    s = (str(i)[0], str(i)[-1])
    if s in D:
        D[s] += 1
    else:
        D[s] = 1
ans = 0
for aj, bj in D:
    if (bj, aj) in D:
        ans += D[(aj, bj)] * D[(bj, aj)]
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=[int(i) for i in input().split()]

dp=[1,1] ;a=set() ; mod=(10**9+7)

for i in range(m):

    a.add(int(eval(input())))

if 1 in a: dp[1]=0

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

    if i not in a:

        dp.append((dp[-1]+dp[-2])%mod)

    else:

        dp.append(0)

print((dp[-1]))

# optimized version of the same code:

import sys

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

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

dp=[1,1] ;a=set() ; mod=(10**9+7)

for i in range(m):

    a.add(int(eval(input())))

if 1 in a: dp[1]=0

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

    if i not in a:

        dp.append((dp[-1]+dp[-2])%mod)

    else:

        dp.append(0)

print((dp[-1]))

import sys

input = lambda: sys.stdin.readline().rstrip()
n, m = [int(i) for i in input().split()]
dp = [1, 1]
a = set()
mod = 10**9 + 7
for i in range(m):
    a.add(int(eval(input())))
if 1 in a:
    dp[1] = 0
for i in range(2, n + 1):
    if i not in a:
        dp.append((dp[-1] + dp[-2]) % mod)
    else:
        dp.append(0)
print((dp[-1]))

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


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

from functools import lru_cache

def main():

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

    import numpy as np

    ans = np.ones(n+1,dtype=int)*-1

    ans[0] = 1

    mod = 10**9+7

    for _ in range(m):

        a = int(eval(input()))

        ans[a]=0

    if ans[1]!=0:

        ans[1]=1

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

        if ans[i]!=0:

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

    print((ans[-1]))

if __name__ == "__main__":

    main()

# optimized version of the same code:

def main():

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

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

    mod = 10**9+7

    for i in range(m):

        a = int(eval(input()))

        dp[a] = -1

    dp[0] = 1

    if dp[1]!=-1:

        dp[1] = 1

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

        if dp[i]==-1:

            continue

        if dp[i-1]!=-1 and dp[i-2]!=-1:

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

            dp[i] = dp[i]%mod

        elif dp[i-1]!=-1 and dp[i-2]==-1:

            dp[i] = dp[i-1]

        elif dp[i-1]==-1 and dp[i-2]!=-1:

            dp[i] = dp[i-2]

        else:

            dp[i] = 0

    print((dp[-1]))

if __name__ == "__main__":

    main()

from functools import lru_cache

def main():
    n, m = list(map(int, input().split()))
    import numpy as np

    ans = np.ones(n + 1, dtype=int) * -1
    ans[0] = 1
    mod = 10**9 + 7
    for _ in range(m):
        a = int(eval(input()))
        ans[a] = 0
    if ans[1] != 0:
        ans[1] = 1
    for i in range(2, n + 1):
        if ans[i] != 0:
            ans[i] = (ans[i - 1] + ans[i - 2]) % mod
    print((ans[-1]))

if __name__ == "__main__":
    main()

def main():
    n, m = list(map(int, input().split()))
    dp = [0 for i in range(n + 1)]
    mod = 10**9 + 7
    for i in range(m):
        a = int(eval(input()))
        dp[a] = -1
    dp[0] = 1
    if dp[1] != -1:
        dp[1] = 1
    for i in range(2, n + 1):
        if dp[i] == -1:
            continue
        if dp[i - 1] != -1 and dp[i - 2] != -1:
            dp[i] = dp[i - 1] + dp[i - 2]
            dp[i] = dp[i] % mod
        elif dp[i - 1] != -1 and dp[i - 2] == -1:
            dp[i] = dp[i - 1]
        elif dp[i - 1] == -1 and dp[i - 2] != -1:
            dp[i] = dp[i - 2]
        else:
            dp[i] = 0
    print((dp[-1]))

if __name__ == "__main__":
    main()

-    ans = np.ones(n + 1, dtype=int) * -1


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import math

N = int(eval(input()))

ans = 0

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

print(ans)

# optimized version of the same code:

N = int(eval(input()))

power = 1

for i in range(N):

    power = ((i+1) * power) % 1000000007

print(power)

import math

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

N = int(eval(input()))
power = 1
for i in range(N):
    power = ((i + 1) * power) % 1000000007
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:

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

asort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)

print((asort[0] + bsort[0] + csort[0]))

already = [[0,0,0]]

x,y,z = 0,0,0

place_sum = []

check = []

for k in range(K - 1):

    if [x + 1,y,z] not in already and x + 1 < X:

        already.append([x + 1,y,z])

        place_sum.append([x + 1,y,z])

        check.append(asort[x + 1] + bsort[y] + csort[z])

    if [x,y + 1,z] not in already and y + 1 < Y:

        already.append([x,y + 1,z])

        place_sum.append([x,y + 1,z])

        check.append(asort[x] + bsort[y + 1] + csort[z])

    if [x,y,z + 1] not in already and z + 1 < Z:

        already.append([x,y,z + 1])

        place_sum.append([x,y,z + 1])

        check.append(asort[x] + bsort[y] + csort[z + 1])

    print((max(check)))

    x,y,z = place_sum[check.index(max(check))][0],place_sum[check.index(max(check))][1],place_sum[check.index(max(check))][2]

    place_sum.pop(check.index(max(check)))

    check.remove(max(check))

# optimized version of the same code:

import heapq

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

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

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

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

asort,bsort,csort = sorted(A,reverse=True),sorted(B,reverse=True),sorted(C,reverse=True)

already = [[0,0,0]]

print((asort[0] + bsort[0] + csort[0]))

x,y,z = 0,0,0

check = []

for k in range(K - 1):

    if [x + 1,y,z] not in already and x + 1 < X:

        already.append([x + 1,y,z])

        heapq.heappush(check,(-(asort[x + 1] + bsort[y] + csort[z]),x + 1,y,z))

    if [x,y + 1,z] not in already and y + 1 < Y:

        already.append([x,y + 1,z])

        heapq.heappush(check,(-(asort[x] + bsort[y + 1] + csort[z]),x,y + 1,z))

    if [x,y,z + 1] not in already and z + 1 < Z:

        already.append([x,y,z + 1])

        heapq.heappush(check,(-(asort[x] + bsort[y] + csort[z + 1]),x,y,z + 1))

    maxsum = heapq.heappop(check)

    print((-maxsum[0]))

    x,y,z = maxsum[1],maxsum[2],maxsum[3]

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()))
asort, bsort, csort = (
    sorted(A, reverse=True),
    sorted(B, reverse=True),
    sorted(C, reverse=True),
)
print((asort[0] + bsort[0] + csort[0]))
already = [[0, 0, 0]]
x, y, z = 0, 0, 0
place_sum = []
check = []
for k in range(K - 1):
    if [x + 1, y, z] not in already and x + 1 < X:
        already.append([x + 1, y, z])
        place_sum.append([x + 1, y, z])
        check.append(asort[x + 1] + bsort[y] + csort[z])
    if [x, y + 1, z] not in already and y + 1 < Y:
        already.append([x, y + 1, z])
        place_sum.append([x, y + 1, z])
        check.append(asort[x] + bsort[y + 1] + csort[z])
    if [x, y, z + 1] not in already and z + 1 < Z:
        already.append([x, y, z + 1])
        place_sum.append([x, y, z + 1])
        check.append(asort[x] + bsort[y] + csort[z + 1])
    print((max(check)))
    x, y, z = (
        place_sum[check.index(max(check))][0],
        place_sum[check.index(max(check))][1],
        place_sum[check.index(max(check))][2],
    )
    place_sum.pop(check.index(max(check)))
    check.remove(max(check))

import heapq

X, Y, Z, K = list(map(int, input().split()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
asort, bsort, csort = (
    sorted(A, reverse=True),
    sorted(B, reverse=True),
    sorted(C, reverse=True),
)
already = [[0, 0, 0]]
print((asort[0] + bsort[0] + csort[0]))
x, y, z = 0, 0, 0
check = []
for k in range(K - 1):
    if [x + 1, y, z] not in already and x + 1 < X:
        already.append([x + 1, y, z])
        heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z))
    if [x, y + 1, z] not in already and y + 1 < Y:
        already.append([x, y + 1, z])
        heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z))
    if [x, y, z + 1] not in already and z + 1 < Z:
        already.append([x, y, z + 1])
        heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1))
    maxsum = heapq.heappop(check)
    print((-maxsum[0]))
    x, y, z = maxsum[1], maxsum[2], maxsum[3]

-        place_sum.append([x + 1, y, z])

-        check.append(asort[x + 1] + bsort[y] + csort[z])

+        heapq.heappush(check, (-(asort[x + 1] + bsort[y] + csort[z]), x + 1, y, z))

-        place_sum.append([x, y + 1, z])

-        check.append(asort[x] + bsort[y + 1] + csort[z])

+        heapq.heappush(check, (-(asort[x] + bsort[y + 1] + csort[z]), x, y + 1, z))

-        place_sum.append([x, y, z + 1])

-        check.append(asort[x] + bsort[y] + csort[z + 1])

-        place_sum[check.index(max(check))][0],

-        place_sum[check.index(max(check))][1],

-        place_sum[check.index(max(check))][2],

-    place_sum.pop(check.index(max(check)))

+        heapq.heappush(check, (-(asort[x] + bsort[y] + csort[z + 1]), x, y, z + 1))

+    x, y, z = maxsum[1], maxsum[2], maxsum[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

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

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

b = np.zeros(n)

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

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

b[n-1] = k - a[n-1] + a[0]

ans = k - max(b)

print((int(ans)))

# optimized version of the same code:

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

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

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

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

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

b[n-1] = k - a[n-1] + a[0]

ans = k - max(b)

print((int(ans)))

import numpy as np

k, n = list(map(int, input().split()))
a = list(map(int, input().split()))
b = np.zeros(n)
for i in range(0, n - 1):
    b[i] = a[i + 1] - a[i]
b[n - 1] = k - a[n - 1] + a[0]
ans = k - max(b)
print((int(ans)))

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

-import numpy as np
-b = np.zeros(n)
+b = [0 for i in range(n)]


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import numpy as np

# 締切が早いものから処理

N = int(eval(input()))

AB = np.array([[int(x) for x in input().split()] for _ in range(N)])

A = AB[:,0]

B = AB[:,1]

idx = B.argsort()

A = A[idx]

B = B[idx]

np.cumsum(A, out = A)

bl = (A <= B).all()

answer = 'Yes' if bl else 'No'

print(answer)

# optimized version of the same code:

def main():

    N = int(eval(input()))

    A = []

    for _ in range(N):

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

        A.append((a, b))

    A = sorted(A, key=lambda x: x[1])

    time = 0

    for a, b in A:

        time += a

        if time > b:

            return 'No'

    return 'Yes'

if __name__ == '__main__':

    print((main()))

import numpy as np

# 締切が早いものから処理
N = int(eval(input()))
AB = np.array([[int(x) for x in input().split()] for _ in range(N)])
A = AB[:, 0]
B = AB[:, 1]
idx = B.argsort()
A = A[idx]
B = B[idx]
np.cumsum(A, out=A)
bl = (A <= B).all()
answer = "Yes" if bl else "No"
print(answer)

def main():
    N = int(eval(input()))
    A = []
    for _ in range(N):
        a, b = list(map(int, input().split()))
        A.append((a, b))
    A = sorted(A, key=lambda x: x[1])
    time = 0
    for a, b in A:
        time += a
        if time > b:
            return "No"
    return "Yes"

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

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

-# 締切が早いものから処理

-AB = np.array([[int(x) for x in input().split()] 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:

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

ans=a*x+b*y

n=max(x,y)

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

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

print(ans)

# optimized version of the same code:

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

ans1=a*x+b*y

ans2=2*c*max(x,y)

ans3=2*c*min(x,y)+a*(x-min(x,y))+b*(y-min(x,y))

print((min(ans1,ans2,ans3)))

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

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

-    ans = min(ans, 2 * i * c + a * max(0, x - i) + b * max(0, y - 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:

answer = 0

N = int(eval(input()))

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

for i in range(N) :

    while A[i] % 2 == 0 :

        A[i] = A[i] / 2

        answer += 1

print(answer)

# optimized version of the same code:

N = int(eval(input()))

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

ans = 0

for i in range(N) :

    flag = 0

    while flag == 0 :

        if (L[i] % 2) == 0 :

            ans += 1

            L[i] = L[i]//2

        else :

            flag = 1

print(ans)

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

N = int(eval(input()))
L = list(map(int, input().split()))
ans = 0
for i in range(N):
    flag = 0
    while flag == 0:
        if (L[i] % 2) == 0:
            ans += 1
            L[i] = L[i] // 2
        else:
            flag = 1
print(ans)

-answer = 0
-A = list(map(int, input().split()))
+L = list(map(int, input().split()))
+ans = 0
-    while A[i] % 2 == 0:
-        A[i] = A[i] / 2
-        answer += 1
-print(answer)
+    flag = 0
+    while flag == 0:
+        if (L[i] % 2) == 0:
+            ans += 1
+            L[i] = L[i] // 2
+        else:
+            flag = 1
+print(ans)