Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

n = int(input())
a = list(input().split())

if n == 1:
    print(1)
    print(1)
    exit()

MOD = 10 ** 9 + 7

b = sorted(a)

for i in range(n):
    if b[i] == b[i + 1]:
        d = b[i]
        break

first = a.index(d)
for i in range(first + 1, n + 1):
    if a[i] == d:
        second = i

w = n + first - second

c = [0 for _ in range(n + 2)]
d = [0 for _ in range(n + 2)]

L = 1
H = 1
for i in range(1, n + 2):
    L *= i
    H *= n + 2 - i
    c[i] = L
    d[i] = H

e = [0 for _ in range(w + 1)]
temp = 1
for i in range(1, w + 1):
    temp *= w + 1 - i
    e[i] = temp


def ncmb(k):
    return d[k] // c[k]

def wcmb(k):
    if k > w or k <= 0:
        return 0
    elif k == w:
        return 1
    else:
        return e[k] // c[k]

print(n)
for k in range(2, n + 2):
    ans = ncmb(k) - wcmb(k-1)
    print(ans % MOD)



### FIXED CODE ###

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

class ModInv:
    def __init__(self, size, MOD):
        self.inv = [0] * (size + 1)
        self.inv[1] = 1
        for i in range(2, size + 1):
            self.inv[i] = (-(MOD // i) * self.inv[MOD%i]) % MOD

if n == 1:
    print(1)
    print(1)
    exit()

MOD = 10 ** 9 + 7

b = sorted(a)

for i in range(n):
    if b[i] == b[i + 1]:
        break

first = a.index(b[i])
for i in range(first + 1, n + 1):
    if a[i] == a[first]:
        second = i

w = n + first - second

inv = ModInv(n + 1, MOD)
c = [1] * (n + 2)
d = [1] * (n + 2)

for i in range(n + 1):
    d[i + 1] = (d[i] * inv.inv[i + 1]) % MOD
for i in range(n + 1):
    c[i + 1] = (c[i] * (i + 1)) % MOD

print(n)
for k in range(2, n + 2):
    ans = (((c[n+1] * d[n+1-k]) % MOD) * d[k]) % MOD
    if w >= k - 1:
        ans -= (((c[w] * d[w-k+1]) % MOD) * d[k-1]) % MOD
    print( ans % MOD )
### BUGGY CODE ###

s=input()

"""
例)
1817181712114の
前から5文字目から始まる18171が2019で割り切れるかどうかを判断する。

18171は(181712114-2114)/10000となるので、
181712114mod2019＝2114mod2019の時、2019で割り切れる。

1817181712114mod2019
 817181712114mod2019
  17181712114mod2019
   7181712114mod2019
    181712114mod2019
     81712114mod2019
      1712114mod2019
       712114mod2019
    　　・・・・
とmodを調べていき、modの値が同じペアは割り切れる。
"""

result=0

#初期値が0の辞書
from collections import defaultdict
mod_num = defaultdict(lambda: 0) 

for i in range(1,len(s)+1):
    temp = int(s[len(s)-i:])
    if temp%2019==0:
        result+=1
    else:
        result+=mod_num[temp%2019]
        mod_num[temp%2019]+=1


print(result)





### FIXED CODE ###

s=input()



"""
◆エッセンス1：割り切れるとは、二つに分けた数字のmodが一緒
例)
1817181712114の
18171が2019で割り切れるかどうかを判断する。

18171は(181712114-2114)/10000となるので、
181712114mod2019＝2114mod2019の時、2019で割り切れる。

1817181712114mod2019
 817181712114mod2019
  17181712114mod2019
   7181712114mod2019
    181712114mod2019
     81712114mod2019
      1712114mod2019
       712114mod2019
    　　・・・・
とmodを調べていき、値が同じペアは割り切れる。
"""

"""
◆エッセンス2：大きい数字は都度modを取る

これだけでもループは1回になるんだけど、
|S|が長すぎてTLEとなってしまう（|S|は10**5）
1234567 mod 2019
=(1*10**7)mod2019 + (234567mod2019)
=(1*10mod2019 * 10**6mod2019)+ (234567mod2019)

10**nを毎回modを取ることで、計算する数字の長さを短くする。

"""



#modの値を保持する配列
cnt=[0]*2019
#mod2019 =0 は、それ一つで割り切れるので。引き算をする必要が無い。
cnt[0]=1

#10の倍数を保持する
fac=1
ss=0
for i in range(len(s)):
    #後ろの数字から順番にとってくる
    ss += int(s[len(s)-i-1])*fac
    ss%=2019
    fac=fac*10
    fac%=2019
    cnt[ss]+=1
    

result=0
for c in cnt:
    result+=c*(c-1)//2

print(result)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
A,B,K = map(int, input().split())

while(K > 0):
  if A > 0:
    A -= 1
  else:
    if B > 0:
      B -= 1
    else:
      break
  K -= 1
print(' '.join(map(str, [A,B])))

### FIXED CODE ###

import sys
input = sys.stdin.readline
A,B,K = map(int, input().split())
 
while(K > 0):
  if A >= K:
    A -= K
    K = 0
    break
  else:
    K -= A
    A = 0
    if B >= K:
      B -= K
      K = 0
      break
    else:
      K -= B
      B = 0
      break
print(' '.join(map(str, [A,B])))
### BUGGY CODE ###

#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int

def solve(N: int, A: "List[int]"):
    mLEN = len(format(max(A),'b'))
    bA = [[0]*N for _ in range(mLEN)]

    for i in range(N):
        a = format(A[i],'b').zfill(mLEN)
        for k in range(mLEN):
            bA[k][i] = a[k]

    answer = 0
    for keta in range(mLEN):
        zero = bA[keta].count('0')
        one = N-zero
        a = 0
        for i in range(N):
            if bA[keta][i] == '1':
                one -= 1
                a += zero
            else:
                zero -= 1
                a += one

        answer += a*pow(2,mLEN-1-keta,MOD)
    print(answer%MOD)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import numpy as np

MOD = 1000000007  # type: int

def solve(N: int, A: "List[int]"):
    mLEN = len(format(max(A),'b'))

    A = np.array(A)
    ans = 0
    d = 1
    while d < (1 << mLEN):
        cnt = np.count_nonzero(A & d)
        ans += (N - cnt) * cnt * d
        ans %= MOD
        d <<= 1
    print(ans)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

N = int(input())
XYH = [list(map(int, input().split())) for _ in range(N)]
H_max = max([XYH[i][2] for i in range(N)])

ans = []

# 高さH,中心座標を(Cx, Cy)として総当たりで試す
for H in range(H_max - 200, H_max + 201):
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            count = 0
            for X, Y, h in XYH:
                if h == max(H - abs(X - Cx) - abs(Y - Cy), 0):
                    count += 1
                else:
                    pass

            if count == N:
                ans = [str(Cx), str(Cy), str(H)]

print(' '.join(ans))


### FIXED CODE ###

N = int(input())
XYH = [list(map(int, input().split())) for _ in range(N)]
H_list= [XYH[i][2] for i in range(N)]
H_max = max(H_list)
H_min = min(H_list)
H_diff = H_max - H_min
ans = []

# 高さH,中心座標を(Cx, Cy)として総当たりで試す
for H in range(H_max - (200 - H_diff), H_max + (201 - H_diff)):
    for Cx in range(0, 101):
        for Cy in range(0, 101):
            count = 0
            for X, Y, h in XYH:
                if h == max(H - abs(X - Cx) - abs(Y - Cy), 0):
                    count += 1
                else:
                    break

            if count == N:
                ans = [str(Cx), str(Cy), str(H)]

print(' '.join(ans))
### BUGGY CODE ###

H, W = map(int,input().split())
A = [["#"] + [s for s in input()] + ["#"] for k in range(H)]
A = [["#"]*(W+2)] + A + [["#"]*(W+2)]


que = []
for k in range(1,H+1):
    for l in range(1,W+1):
        if A[k][l] == "#":
            que.append([k,l])
if len(que) == H*W:
    print(0)
    exit(0)
ans = 0
while True:
    t = []
    while len(que) > 0:
        s = que.pop()
        k, l = s[0], s[1]
        if A[k][l-1] == ".":
            A[k][l-1] = "#"
            t.append([k,l-1])
        if A[k][l+1] == ".":
            A[k][l+1] = "#"
            t.append([k,l+1])
        if A[k-1][l] == ".":
            A[k-1][l] = "#"
            t.append([k-1,l])
        if  A[k+1][l] == ".":
            A[k+1][l] = "#"
            t.append([k+1,l])
    if len(t) > 0:
        ans += 1
        que = t
    else:
        break
print(ans)


### FIXED CODE ###

H, W = map(int,input().split())
A = [["#"] + [s for s in input()] + ["#"] for k in range(H)]
A = [["#"]*(W+2)] + A + [["#"]*(W+2)]


que = []
for k in range(1,H+1):
    for l in range(1,W+1):
        if A[k][l] == "#":
            que.append([k,l])
if len(que) == H*W:
    print(0)
    exit(0)
ans = 0
while True:
    t = []
    while len(que) > 0:
        s = que.pop()
        k, l = s[0], s[1]
        if A[k][l-1] == ".":
            A[k][l-1] = "#"
            t.append([k,l-1])
        if A[k][l+1] == ".":
            A[k][l+1] = "#"
            t.append([k,l+1])
        if A[k-1][l] == ".":
            A[k-1][l] = "#"
            t.append([k-1,l])
        if  A[k+1][l] == ".":
            A[k+1][l] = "#"
            t.append([k+1,l])
    if len(t) > 0:
        ans += 1
        que = t
    else:
        break
print(ans)
### BUGGY CODE ###

from math import floor

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

max_x = 0
x     = 0
a_b   = a / b

while n > 0:
    x = floor(a_b * (n % b))

    max_x = x if x > max_x else max_x

    n -= 1

print(max_x)

### FIXED CODE ###

from math import floor

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

x = min(b - 1, n)

print(floor(a * x / b) - a * floor(x / b))
### BUGGY CODE ###

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

num=0
a_sum=[0]
for i in range(N):
  num+=a[i]
  a_sum.append(num)
  

#print(a_sum)

a_mat=[[0 for i in range(N)] for j in range(N)]
for i in range(N):
  for j in range(i,N):
    a_mat[i][j] = a_sum[j+1]-a_sum[i]
    

a_mat2=copy.deepcopy(a_mat)

maxbit=1
while True:
  if a_sum[N]<2**maxbit and a_sum[N]>=2**(maxbit-1): 
    break
  else:
    maxbit+=1
maxnum=0
num_rest=int(N*(N+1)/2)
num_rest_now=int(N*(N+1)/2)
for bit in range(maxbit):
  for i in range(N):
    for j in range (i,N):
      if a_mat[i][j]&(2**(maxbit-bit-1)) == 0 and a_mat[i][j]!=0:
        num_rest_now-=1
        a_mat2[i][j]=0
  #print(a_mat)
  #print(num_rest_now)
  if num_rest_now >= K:
    maxnum+=2**(maxbit-bit-1)
    a_mat=copy.deepcopy(a_mat2)
    num_rest=num_rest_now
  else:
    a_mat2=copy.deepcopy(a_mat)
    num_rest_now=num_rest
  
print(maxnum)
    

### FIXED CODE ###

import sys
from collections import deque, defaultdict
import copy
input=sys.stdin.readline
sys.setrecursionlimit(10 ** 9)

N, K = list(map(int, input().split()))
a = list(map(int, input().split()))
sum_a = [0, a[0]]
for i in range(1, N):
    sum_a.append(sum_a[-1]+a[i])

bubunwa = []
for i in range(N):
    for j in range(i + 1, N + 1):
        bubunwa.append(sum_a[j] - sum_a[i])

max_bit = 2
while True:
    if sum_a[-1] < 2**max_bit:
        break
    max_bit += 1

sum = 0
for i in range(max_bit ,-1, -1):
    kouho = []
    for n in bubunwa:
        if n & 2**i == 2**i:
            kouho.append(n)
    if len(kouho) >= K:
        bubunwa = copy.deepcopy(kouho)
        sum += 2**i

print(sum)
### BUGGY CODE ###

import itertools
n,m,r=map(int,input().split())
rx=[int(i) for i in input().split()]
inf=100000000000
wf=[[inf]*n for i in range(n)]
for i in range(n):
    wf[i][i]=0

for i in range(m):
    a,b,c=map(int,input().split())
    wf[a-1][b-1]=c
    wf[b-1][a-1]=c

for k in range(n):
    for i in range(n):
        for j in range(n):
            if wf[i][j]>wf[i][k]+wf[k][j]:
                wf[i][j]=wf[i][k]+wf[k][j]
cnt=0
l=list(itertools.permutations([i for i in range(r)]))
cnt=inf
for i in l:
    cnt_sub=0
    for j in range(r-1):
        cnt_sub+=wf[rx[i[j]]-1][rx[i[j+1]]-1]
    cnt=min(cnt,cnt_sub)
print(cnt)


### FIXED CODE ###

import itertools
n,m,r=map(int,input().split())
rx=[int(i) for i in input().split()]
inf=100000000
wf=[[inf]*n for i in range(n)]
for i in range(n):
    wf[i][i]=0

for i in range(m):
    a,b,c=map(int,input().split())
    wf[a-1][b-1]=c
    wf[b-1][a-1]=c

for k in range(n):
    for i in range(n):
        for j in range(n):
            if wf[i][j]>wf[i][k]+wf[k][j]:
                wf[i][j]=wf[i][k]+wf[k][j]
cnt=0
l=list(itertools.permutations([i for i in range(r)]))
cnt=inf
for i in l:
    cnt_sub=0
    for j in range(r-1):
        cnt_sub+=wf[rx[i[j]]-1][rx[i[j+1]]-1]
    cnt=min(cnt,cnt_sub)
print(cnt)
### BUGGY CODE ###

num = int(input())

def divisor(num):
  divisor_set = {1, num}
  for i in range(2, num):
    if num % i == 0:
      divisor_set.add(i)
  return divisor_set

def gcd(a, b, c):
  a_div = divisor(a)
  b_div = divisor(b)
  c_div = divisor(c)
  common_div = a_div.intersection(b_div).intersection(c_div)
  gcd = max(common_div)
  return gcd

sum_gcd = 0

for i in range(1, num + 1):
  for j in range(1, num + 1):
    for k in range(1, num + 1):
      sum_gcd += gcd(i, j, k)
      
print(sum_gcd)

### FIXED CODE ###

import math

K = int(input())
print(sum([math.gcd(math.gcd(i, j), k) for i in range(1, K+1) for j in range(1, K+1) for k in range(1, K+1)]))
### BUGGY CODE ###

X = input()

for i in range(len(X)):
    X = X.replace('ST', '')

print(len(X))


### FIXED CODE ###

X = input()
xlst = []
xlst.append(X[0])
for i in range(1, len(X)):
    if X[i] == 'S':
        xlst.append(X[i])
    else:
        if xlst != [] and xlst[-1] == 'T':
            xlst.append(X[i])
        elif xlst != [] and xlst[-1] == 'S':
            xlst.pop()
        else:
            xlst.append(X[i])

print(len(xlst))
### BUGGY CODE ###

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

count = 0
for x in range(0,K + 1):
    for y in range(0,K + 1):
        for z in range(0,K + 1):
            if x + y + z == S:
                count += 1

print(count)

### FIXED CODE ###

import itertools
    
K, S = map(int,input().split())

count = 0
for x,y in itertools.product(range(0,K + 1),range(0,K + 1)):
    z = S - x - y
    if 0 <= z <= K:
        count += 1

print(count)
### BUGGY CODE ###

import sys
lines = sys.stdin.readlines()
sizes = lines[0].split(" ")
N = int(sizes[0])
T = int(sizes[1])
line = lines[1].split(" ")
inp = []
for i in line:
    inp.append(int(i))

check = []
checkMax = []

for i in range(len(inp)):
    c = [0]
    for j in range(i+1,len(inp)):
        if inp[i]<inp[j]:
            c.append(inp[j]-inp[i])
    check.append(c)
    checkMax.append(max(c))

#print (check)
#print (checkMax)
print (checkMax.count(max(checkMax)))




### FIXED CODE ###

import sys
lines = sys.stdin.readlines()
sizes = lines[0].split(" ")
N = int(sizes[0])
T = int(sizes[1])
line = lines[1].split(" ")
inp = []
for i in line:
    inp.append(int(i))

check = []
checkMax = []

#for i in range(len(inp)):
#i=0
#c = []
#for j in range(i+1,len(inp)):
    #if inp[i]<inp[j]:
#    c.append(inp[j]-inp[i])
#check.append(c)
#check=c
#checkMax.append(max(check))

#while (len(check)>1):
#    check.pop(0)
#    checkMax.append(max(check))


#for j in range(1,len(inp)):
#    checkMax[j-1] += inp[0]-inp[j]

count=0
for i in range(1,len(inp)):
    if i==1:
        mi = min(inp[0],inp[1])
        ma = inp[1]-inp[0]
        if ma>0:
            count+=1
    elif i>1:
        if ma<inp[i]-mi:
            count=1
            ma=inp[i]-mi
        elif ma==inp[i]-mi:
            count+=1
        mi = min(inp[i],mi)

print (count)


#print (check)
#print (checkMax)
#print (checkMax.count(max(checkMax)))
### BUGGY CODE ###

# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
L = read_ints()
L.sort()
# import numpy as np
# L = np.array(L)
from bisect import bisect_left

cnt = 0
for i in range(N):
    a = L[i]
    for j in range(i+1, N):
        b = L[j]
        for k in range(j+1, N):
            c = L[k]
            if c >= a + b:
                break
            cnt += 1
        # cnt += bisect_left(L, a+b) - (j+1)

print(cnt)


### FIXED CODE ###

# 入力が10**5とかになったときに100ms程度早い
import sys
read = sys.stdin.readline


def read_ints():
    return list(map(int, read().split()))


def read_a_int():
    return int(read())


def read_matrix(H):
    '''
    H is number of rows
    '''
    return [list(map(int, read().split())) for _ in range(H)]


def read_map(H):
    '''
    H is number of rows
    文字列で与えられた盤面を読み取る用
    '''
    return [read()[:-1] for _ in range(H)]


def read_col(H, n_cols):
    '''
    H is number of rows
    n_cols is number of cols

    A列、B列が与えられるようなとき
    '''
    ret = [[] for _ in range(n_cols)]
    for _ in range(H):
        tmp = list(map(int, read().split()))
        for col in range(n_cols):
            ret[col].append(tmp[col])

    return ret


N = read_a_int()
L = read_ints()
L.sort()
# import numpy as np
# L = np.array(L)
from bisect import bisect_left

cnt = 0
for i in range(N):
    a = L[i]
    for j in range(i+1, N):
        b = L[j]
        # ここで二分探索するか
        cnt += bisect_left(L, a+b) - (j+1)
        # L_tmp = L[j+1:]
        # cnt += np.sum(L_tmp < b+a)

print(cnt)
### BUGGY CODE ###

from math import factorial

def combinations_count(n, r):
    ''' 組み合わせ '''
    return factorial(n) // (factorial(n - r) * factorial(r))

#print(combinations_count(5, 2))
def modpow(a, n, MOD):
  res = 1
  while (n > 0):
    if (n & 1):
      res = res * a % MOD
    a = a * a % MOD
    n >>= 1
  return res

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
mod = 10 ** 9 + 7
N = 2 * 10 ** 6 + 1  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

K = int(input())
S = str(input())
N = len(S)

ans = 0
p = N + K - 1
#now = combinations_count(p, N - 1) % mod

for i in range(K + 1):
  p = N + K - i - 1
  now = cmb(p, N - 1, mod)
  a = pow(25, K - i, mod)
  b = pow(26, i, mod)
  c = a * b % mod
  ans += now * c % mod
  ans = ans % mod
print(ans)
  

### FIXED CODE ###

from math import factorial

def combinations_count(n, r):
    ''' 組み合わせ '''
    return factorial(n) // (factorial(n - r) * factorial(r))

#print(combinations_count(5, 2))
def modpow(a, n, MOD):
  res = 1
  while (n > 0):
    if (n & 1):
      res = res * a % MOD
    a = a * a % MOD
    n >>= 1
  return res

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
mod = 10 ** 9 + 7
N = 2 * 10 ** 6 + 1  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

K = int(input())
S = str(input())
N = len(S)

ans = 0
p = N + K - 1
#now = combinations_count(p, N - 1) % mod

for i in range(K + 1):
  p = N + K - i - 1
  now = cmb(p, N - 1, mod)
  a = pow(25, K - i, mod)
  b = pow(26, i, mod)
  c = a * b % mod
  ans += now * c % mod
  ans = ans % mod
print(ans)
### BUGGY CODE ###

s=input()
q=int(input())

cnt=0

for i in range(q):
  qq=[x for x in input().rstrip().split()]
  # print(len(qq))
  if len(qq)==3:
    t=int(qq[0])
    f=int(qq[1])
    c=qq[2]
    
    if cnt%2==1 and f==1:
      s=s+c
    elif cnt%2==1 and f==2:
      s=c+s
    elif cnt%2==0 and f==2:
      s=s+c
    elif cnt%2==0 and f==1:
      s=c+s

  else:
    cnt+=1


if cnt%2==1:
  print(s[::-1])
else:
  print(s)

### FIXED CODE ###

s=input()
q=int(input())

cnt=0
left=""
right=""

for i in range(q):
  qq=[x for x in input().rstrip().split()]

  if qq[0]=="2":
    t=int(qq[0])
    f=int(qq[1])
    c=qq[2]
    
    if cnt%2==1 and f==1:
      right=right+c
    
    elif cnt%2==1 and f==2:

      left=c+left
    elif cnt%2==0 and f==2:
  
      right=right+c
    elif cnt%2==0 and f==1:

      left=c+left

  else:
    cnt+=1

s=left+s+right
if cnt%2==1:
  print(s[::-1])
else:
  print(s)
### BUGGY CODE ###

a,b,c = map(int,input().split())
res = 10**100
#a
for i in range(1,a):
    j = a - i
    r = abs(i - j) * b * c
    res = min(res, r)
#b
for i in range(1,b):
    j = b - i
    r = abs(i - j) * a * c
    res = min(res, r)
#c
for i in range(1,c):
    j = c - i
    r = abs(i - j) * b * a
    res = min(res, r)
print(res)


### FIXED CODE ###

l=list(map(int,input().split()))
if not l[0]%2&l[1]%2&l[2]%2:
    print(0)
else:
    l=sorted(l)
    print(l[0]*l[1])
### BUGGY CODE ###

s = list(input())
s = [''] + s
t = list(input())
t = [''] + t
dp = [[0] * (len(t)) for _ in range(len(s))]

# dpテーブル作成

for i in range(1, len(s)):
    for j in range(1, len(t)):

        if s[i] == t[j]:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1]) 

answer_len = dp[len(s)-1][len(t)-1]

# dpテーブル逆走
answer = [0] * answer_len
i = len(s) -1
j = len(t) -1

while True:
    if dp[i][j] - dp[i-1][j-1] == 1 and dp[i][j] - dp[i][j-1] == 1 and dp[i][j] - dp[i-1][j] == 1:
        answer[answer_len-1] = s[i]
        answer_len -= 1
        i -= 1
        j -= 1
        if answer[0] != 0:
            break
    elif dp[i][j] - dp[i][j-1] == 1 and dp[i][j] - dp[i-1][j] != 1:
        i -= 1
    elif dp[i][j] - dp[i][j-1] != 1 and dp[i][j] - dp[i-1][j] == 1:
        j -= 1
    else:
        j -= 1

    if j == 0:
        j += 1
        i -= 1
    
    if i == 0:
        break
 
print(''.join(answer))

### FIXED CODE ###

s = list(input())
s = [''] + s
t = list(input())
t = [''] + t
dp = [[0] * (len(t)) for _ in range(len(s))]

# dpテーブル作成

for i in range(1, len(s)):
    for j in range(1, len(t)):

        if s[i] == t[j]:
            dp[i][j] = dp[i-1][j-1] + 1
        else:
            dp[i][j] = max(dp[i-1][j], dp[i][j-1]) 

answer_len = dp[len(s)-1][len(t)-1]

# dpテーブル逆走
answer = [0] * answer_len
i = len(s) -1
j = len(t) -1

while True:
    if dp[i][j] - dp[i-1][j-1] == 1 and dp[i][j] - dp[i][j-1] == 1 and dp[i][j] - dp[i-1][j] == 1:
        answer[answer_len-1] = s[i]
        answer_len -= 1
        i -= 1
        j -= 1
        if answer[0] != 0:
            break
    elif dp[i][j] - dp[i][j-1] == 1 and dp[i][j] - dp[i-1][j] != 1:
        i -= 1
    elif dp[i][j] - dp[i][j-1] != 1 and dp[i][j] - dp[i-1][j] == 1:
        j -= 1
    else:
        j -= 1

    if j == 0:
        j += 1
        i -= 1
    
    if i == 0:
        break
 
print(''.join(answer))