Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

#!/usr/bin/env python3

# coding=utf-8

import sys

s = sys.stdin.readline().strip()

l = [_s is "1" for _s in list(s)]

l_r = l[::-1]

index = 0

for i, (c, n, c_r, n_r) in enumerate(

        zip(l[:len(s) // 2], l[1:len(s) // 2 + 1], l_r[:len(s) // 2], l_r[1:len(s) // 2 + 1])):

    if c ^ n or c_r ^ n_r:

        index = i + 1

print((len(s) - index))

# optimized version of the same code:

def solve(string):

    l = [s == "1" for s in string]

    l_r = l[::-1]

    index = 0

    h = len(string) // 2

    for i, (c, n, c_r, n_r) in enumerate(zip(l[:h], l[1:h + 1], l_r[:h], l_r[1:h + 1])):

        if c ^ n or c_r ^ n_r:

            index = i + 1

    return str(len(string) - index)

if __name__ == '__main__':

    print((solve(eval(input()))))

#!/usr/bin/env python3
# coding=utf-8
import sys

s = sys.stdin.readline().strip()
l = [_s is "1" for _s in list(s)]
l_r = l[::-1]
index = 0
for i, (c, n, c_r, n_r) in enumerate(
    zip(
        l[: len(s) // 2],
        l[1 : len(s) // 2 + 1],
        l_r[: len(s) // 2],
        l_r[1 : len(s) // 2 + 1],
    )
):
    if c ^ n or c_r ^ n_r:
        index = i + 1
print((len(s) - index))

def solve(string):
    l = [s == "1" for s in string]
    l_r = l[::-1]
    index = 0
    h = len(string) // 2
    for i, (c, n, c_r, n_r) in enumerate(
        zip(l[:h], l[1 : h + 1], l_r[:h], l_r[1 : h + 1])
    ):
        if c ^ n or c_r ^ n_r:
            index = i + 1
    return str(len(string) - index)

if __name__ == "__main__":
    print((solve(eval(input()))))

+    for i, (c, n, c_r, n_r) in enumerate(


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

# https://atcoder.jp/contests/abc095/tasks/arc096_a

"""

別解(定数時間)

https://atcoder.jp/contests/abc095/submissions/10226556

"""

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

ans = float("inf")

# ABピザを2枚1組で考える -> ABセット

# i: ABセットの個数

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

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

print(ans)

# optimized version of the same code:

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

AB_set = C * 2

ans = min(A*X + B*Y, AB_set*max(X,Y), AB_set*min(X,Y) + A*abs(X-min(X,Y)) + B*abs(Y-min(X,Y)))

print(ans)

# https://atcoder.jp/contests/abc095/tasks/arc096_a
"""
別解(定数時間)
https://atcoder.jp/contests/abc095/submissions/10226556
"""
A, B, C, X, Y = list(map(int, input().split()))
ans = float("inf")
# ABピザを2枚1組で考える -> ABセット
# i: ABセットの個数
for i in range(10**5 + 1):
    ans = min(ans, i * (2 * C) + max(0, X - i) * A + max(0, Y - i) * B)
print(ans)

A, B, C, X, Y = list(map(int, input().split()))
AB_set = C * 2
ans = min(
    A * X + B * Y,
    AB_set * max(X, Y),
    AB_set * min(X, Y) + A * abs(X - min(X, Y)) + B * abs(Y - min(X, Y)),
)
print(ans)

-# ABピザを2枚1組で考える -> ABセット

-# i: ABセットの個数

+    AB_set * min(X, Y) + A * abs(X - min(X, Y)) + B * abs(Y - min(X, Y)),


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

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

import numpy as np

A,B,M=mi()

a=np.array(list(mi()))

b=np.array(list(mi()))

minab=min(a)+min(b)

ans=float("inf")

for i in range(M):

    x,y,c=mi()

    tmp=a[x-1]+b[y-1]-c

    ans=min(ans,tmp)

print((min(ans,minab)))

# optimized version of the same code:

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

A,B,M=mi()

a=list(mi())

b=list(mi())

ans=min(a)+min(b)

for _ in range(M):

    x,y,c=mi()

    ans=min(ans,a[x-1]+b[y-1]-c)

print(ans)

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

import numpy as np

A, B, M = mi()
a = np.array(list(mi()))
b = np.array(list(mi()))
minab = min(a) + min(b)
ans = float("inf")
for i in range(M):
    x, y, c = mi()
    tmp = a[x - 1] + b[y - 1] - c
    ans = min(ans, tmp)
print((min(ans, minab)))

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

A, B, M = mi()
a = list(mi())
b = list(mi())
ans = min(a) + min(b)
for _ in range(M):
    x, y, c = mi()
    ans = min(ans, a[x - 1] + b[y - 1] - c)
print(ans)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import numpy as np

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

taste = np.array([l+i-1 for i in range(1,n+1)])

taste[np.fabs(taste).argmin()]=0

print((taste.sum()))

# optimized version of the same code:

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

taste = [l+i for i in range(0,n)]

taste.sort(key=lambda x:abs(x))

print((sum(taste[1:])))

import numpy as np

n, l = list(map(int, input().split()))
taste = np.array([l + i - 1 for i in range(1, n + 1)])
taste[np.fabs(taste).argmin()] = 0
print((taste.sum()))

n, l = list(map(int, input().split()))
taste = [l + i for i in range(0, n)]
taste.sort(key=lambda x: abs(x))
print((sum(taste[1:])))

-taste = np.array([l + i - 1 for i in range(1, n + 1)])


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

N = int(eval(input()))

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

SUM = 0

for i in A:

    count = 0

    while i%2 == 0:

        i//=2

        count += 1

    SUM+=count

print(SUM)

# optimized version of the same code:

N = int(eval(input()))

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

SUM = 0

for i in A:

    while i%2 == 0:

        i//=2

        SUM += 1

print(SUM)

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

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

-    count = 0
-        count += 1
-    SUM += count
+        SUM += 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()))

INF = 10**9 + 7

ans = [0] * (10**5 + 1)

ans[0] = 1

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

    ans[i] = ans[i-1] * i % INF

print((ans[n]))

# optimized version of the same code:

n = int(eval(input()))

mod = 10**9 + 7

ans = 1

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

    ans = ans * i % mod

print(ans)

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


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import numpy as np

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

A = np.array([int(x) for x in input().split()],dtype=np.int64)

A.sort()

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

B = BC[:,0]

C = BC[:,1]

idx = C.argsort()

B = B[idx][::-1]

C = C[idx][::-1]

p = 0

for b,c in zip(B,C):

  A[p:p+b] = np.maximum(A[p:p+b],c)

  p += b

answer = A.sum()

print(answer)

# optimized version of the same code:

import sys

read = sys.stdin.buffer.read

readline = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

from operator import itemgetter

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

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

m = list(map(int,read().split()))

BC = list(zip(m,m))

BC.sort(key = itemgetter(1),reverse=True)

BC.append((N,-1))

change = []

for b,c in BC:

    change += [c] * b

    if len(change) > N:

        break

A += change

A.sort()

answer = sum(A[-N:])

print(answer)

import numpy as np

N, M = list(map(int, input().split()))
A = np.array([int(x) for x in input().split()], dtype=np.int64)
A.sort()
BC = np.array([[int(x) for x in input().split()] for _ in range(M)])
B = BC[:, 0]
C = BC[:, 1]
idx = C.argsort()
B = B[idx][::-1]
C = C[idx][::-1]
p = 0
for b, c in zip(B, C):
    A[p : p + b] = np.maximum(A[p : p + b], c)
    p += b
answer = A.sum()
print(answer)

import sys

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from operator import itemgetter

N, M = list(map(int, readline().split()))
A = list(map(int, readline().split()))
m = list(map(int, read().split()))
BC = list(zip(m, m))
BC.sort(key=itemgetter(1), reverse=True)
BC.append((N, -1))
change = []
for b, c in BC:
    change += [c] * b
    if len(change) > N:
        break
A += change
A.sort()
answer = sum(A[-N:])
print(answer)

-A = np.array([int(x) for x in input().split()], dtype=np.int64)

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

-BC = np.array([[int(x) for x in input().split()] for _ in range(M)])

-    A[p : p + b] = np.maximum(A[p : p + b], 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, c, x, y = list(map(int, input().split()))

ans = a * x + b * y

m = max(x, y)

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

  x -= 1

  y -= 1

  if x < 0:

    x = 0

  if y < 0:

    y = 0

  temp = c*(i*2) + x*a + y*b

  if temp < ans:

    ans = temp

print(ans)

# optimized version of the same code:

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

ans = a * x + b * y

ans = min(c * max(x, y) * 2, ans)

if x < y:

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

else:

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

print(ans)

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

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

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


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

n=int(eval(input()))

s=eval(input())

x=["SS","SW","WS","WW"]

def check0(i):

    if x[i][0]=="S":

        if s[0]=="o":

            if x[i][-1]=="S":

                return x[i][1]=="S"

            else:

                return x[i][1]=="W"

        else:

            if x[i][-1]=="S":

                return x[i][1]=="W"

            else:

                return x[i][1]=="S"

    else:

        if s[0]=="o":

            if x[i][-1]=="S":

                return x[i][1]=="W"

            else:

                return x[i][1]=="S"

        else:

            if x[i][-1]=="S":

                return x[i][1]=="S"

            else:

                return x[i][1]=="W"

def check1(i):

    if x[i][n-1]=="S":

        if s[n-1]=="o":

            if x[i][n-2]=="S":

                return x[i][0]=="S"

            else:

                return x[i][0]=="W"

        else:

            if x[i][n-2]=="S":

                return x[i][0]=="W"

            else:

                return x[i][0]=="S"

    else:

        if s[n-1]=="o":

            if x[i][n-2]=="S":

                return x[i][0]=="W"

            else:

                return x[i][0]=="S"

        else:

            if x[i][n-2]=="S":

                return x[i][0]=="S"

            else:

                return x[i][0]=="W"

for i in range(4):

    for j in range(n-2):

        if x[i][j+1]=="S":

            if s[j+1]=="o":

                if x[i][j]=="S":

                    x[i]+="S"

                else:

                    x[i]+="W"

            else:

                if x[i][j]=="S":

                    x[i]+="W"

                else:

                    x[i]+="S"

        else:

            if s[j+1]=="o":

                if x[i][j]=="S":

                    x[i]+="W"

                else:

                    x[i]+="S"

            else:

                if x[i][j]=="S":

                    x[i]+="S"

                else:

                    x[i]+="W"

    #print(x[i])

    if check0(i) and check1(i):

        print((x[i]))

        break

else:

    print((-1))

# optimized version of the same code:


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import numpy as np

N=int(eval(input()))

root=int(np.sqrt(N)//1)

a=N

b=N

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

    if N%i==0:

        a=i

        b=N//i

        break

print((a-1+b-1))

# optimized version of the same code:

N=int(eval(input()))

root=int((N**0.5)//1)

a=N

b=N

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

    if N%i==0:

        a=i

        b=N//i

        break

print((a-1+b-1))

import numpy as np

N = int(eval(input()))
root = int(np.sqrt(N) // 1)
a = N
b = N
for i in range(root, 0, -1):
    if N % i == 0:
        a = i
        b = N // i
        break
print((a - 1 + b - 1))

N = int(eval(input()))
root = int((N**0.5) // 1)
a = N
b = N
for i in range(root, 0, -1):
    if N % i == 0:
        a = i
        b = N // i
        break
print((a - 1 + b - 1))

-import numpy as np
-root = int(np.sqrt(N) // 1)
+root = int((N**0.5) // 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_str = eval(input())

n_int = int(n_str)

# 1 ~ 50000

# 桁数が奇数= 1桁, 3桁, 5桁

# 1 ~ 9, 100 ~ 999,10000 ~ 99999の90909個しかないので全探索いけるか?

exs_list = []

for i in range(1, 100000):

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

        exs_list.append(i)

exs = {i: i for i in exs_list}

n_s = []

ans = 0

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

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

        continue

    if i in exs:

        ans += 1

print(ans)

# optimized version of the same code:

def digit_sum(n):

    # 各桁の和を求める

    # 計算量: O(logN)

    ans = 0

    while n > 0:

        ans += 1

        n //= 10

    return ans

n = int(eval(input()))

cnt = 0

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

    cnt += digit_sum(i) % 2

print(cnt)

def digit_sum(n):
    # 各桁の和を求める
    # 計算量: O(logN)
    ans = 0
    while n > 0:
        ans += 1
        n //= 10
    return ans

n = int(eval(input()))
cnt = 0
for i in range(1, n + 1):
    cnt += digit_sum(i) % 2
print(cnt)

-# 桁数が奇数= 1桁, 3桁, 5桁

+    # 各桁の和を求める


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

# coding: utf-8

import sys

input = sys.stdin.readline

def f(n, abc):

    dp = [[0] * 3 for _ in range(n + 1)]

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

        for j in range(3):

            dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] \

                for k in range(3) if k != j)

    return(max(dp[n]))

n = int(eval(input()))    # 1 <= n <= 10^5

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

print((f(n, abc)))

# optimized version of the same code:

# coding: utf-8

import sys

input = sys.stdin.readline

def f(n, abc):

    dp = [0] * 3

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

        a, b, c = abc[i - 1]

        dp = [ max(dp[1] + a, dp[2] + a), \

               max(dp[0] + b, dp[2] + b), \

               max(dp[0] + c, dp[1] + c) ]

    return(max(dp))

n = int(eval(input()))    # 1 <= n <= 10^5

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

print((f(n, abc)))

# coding: utf-8
import sys

input = sys.stdin.readline

def f(n, abc):
    dp = [[0] * 3 for _ in range(n + 1)]
    for i in range(1, n + 1):
        for j in range(3):
            dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j)
    return max(dp[n])

n = int(eval(input()))  # 1 <= n <= 10^5
abc = [list(map(int, input().rstrip().split())) for _ in range(n)]
print((f(n, abc)))

# coding: utf-8
import sys

input = sys.stdin.readline

def f(n, abc):
    dp = [0] * 3
    for i in range(1, n + 1):
        a, b, c = abc[i - 1]
        dp = [
            max(dp[1] + a, dp[2] + a),
            max(dp[0] + b, dp[2] + b),
            max(dp[0] + c, dp[1] + c),
        ]
    return max(dp)

n = int(eval(input()))  # 1 <= n <= 10^5
abc = [list(map(int, input().rstrip().split())) for _ in range(n)]
print((f(n, abc)))

-            dp[i][j] = max(dp[i - 1][k] + abc[i - 1][j] for k in range(3) if k != j)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

N = int(eval(input()))

ABC = []

for n in range(N):

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

import numpy as np

ABC = np.array(ABC)

## 「日付」、「選択した行動」ごとの幸福度の最大値を格納するarray

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

hp[0] = ABC[0]

for n in range(1,N):# 日単位でのループ

  for c in range(3): # 選択肢ごとのループ

    ## n日にcを選択した場合の幸福度。つまり前日はc以外を選択している

    if c == 0:

      hp[n][0] = max(hp[n-1][1],hp[n-1][2]) + ABC[n][0]

    elif c == 1:

      hp[n][1] = max(hp[n-1][0],hp[n-1][2]) + ABC[n][1]

    elif c == 2:

      hp[n][2] = max(hp[n-1][0],hp[n-1][1]) + ABC[n][2]

ans = max(hp[-1])

print(ans)

# optimized version of the same code:

N = int(eval(input()))

dpa,dpb,dpc = 0,0,0

for n in range(N):

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

  dpa,dpb,dpc = max(dpb+a,dpc+a),max(dpa+b,dpc+b),max(dpa+c,dpb+c)

ans = max(dpa,dpb,dpc)

print(ans)

N = int(eval(input()))
ABC = []
for n in range(N):
    ABC.append(list(map(int, input().split())))
import numpy as np

ABC = np.array(ABC)
## 「日付」、「選択した行動」ごとの幸福度の最大値を格納するarray
hp = np.zeros((N, 3), dtype=int)
hp[0] = ABC[0]
for n in range(1, N):  # 日単位でのループ
    for c in range(3):  # 選択肢ごとのループ
        ## n日にcを選択した場合の幸福度。つまり前日はc以外を選択している
        if c == 0:
            hp[n][0] = max(hp[n - 1][1], hp[n - 1][2]) + ABC[n][0]
        elif c == 1:
            hp[n][1] = max(hp[n - 1][0], hp[n - 1][2]) + ABC[n][1]
        elif c == 2:
            hp[n][2] = max(hp[n - 1][0], hp[n - 1][1]) + ABC[n][2]
ans = max(hp[-1])
print(ans)

N = int(eval(input()))
dpa, dpb, dpc = 0, 0, 0
for n in range(N):
    a, b, c = list(map(int, input().split()))
    dpa, dpb, dpc = max(dpb + a, dpc + a), max(dpa + b, dpc + b), max(dpa + c, dpb + c)
ans = max(dpa, dpb, dpc)
print(ans)

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

-## 「日付」、「選択した行動」ごとの幸福度の最大値を格納するarray

-        ## n日にcを選択した場合の幸福度。つまり前日はc以外を選択している

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

+    dpa, dpb, dpc = max(dpb + a, dpc + a), max(dpa + b, dpc + b), max(dpa + c, dpb + 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:

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

point = []

for i in range(N):

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

ct = 0

D2 = D * D

for i in point:

    if (i[0]**2 + i[1]**2) <= D2:

        ct += 1

print(ct)

# optimized version of the same code:

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

ct = 0

D2 = D * D

for i in range(N):

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

    if (X**2 + Y**2) <= D2:

        ct += 1

print(ct)

N, D = list(map(int, input().split()))
point = []
for i in range(N):
    point.append(list(map(int, input().split())))
ct = 0
D2 = D * D
for i in point:
    if (i[0] ** 2 + i[1] ** 2) <= D2:
        ct += 1
print(ct)

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

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


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

import numpy as np

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

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

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

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

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

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

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

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

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

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

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

def main():

	N = II()

	X = LI()

	X = np.array(X, dtype="int32")

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

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

if __name__ == '__main__':

	main()

# optimized version of the same code:

import sys

import numpy as np

sys.setrecursionlimit(10 ** 6)

int1 = lambda x: int(x) - 1

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

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

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

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

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

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

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

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

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

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

def main():

	N = II()

	X = LI()

	X = np.array(X)

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

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

if __name__ == '__main__':

	main()

import sys
import numpy as np

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

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

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

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

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

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

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

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

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

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

if __name__ == "__main__":
    main()

import sys
import numpy as np

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

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

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

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

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

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

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

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

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

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

if __name__ == "__main__":
    main()

-    X = np.array(X, dtype="int32")
+    X = np.array(X)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

N = int(eval(input()))

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

dp = [[0]*3 for _ in range(100010)]

# dp[i][j] : i日目にj番目の活動をしたときの幸福度の総和

idx = [[1,2],[2,0],[0,1]]

for i in range(3):

    dp[0][i] = a[0][i]

for i in range(1,N):

    for j in range(3):

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

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

# optimized version of the same code:

import sys

def input():

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

N = int(eval(input()))

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

inf = 10**9+7

dp = [[0] * 3 for _ in range(N+10)]

dp[0] = [ABC[0][0],ABC[0][1],ABC[0][2]]

for i in range(N-1):

    for j in range(3):

        for k in range(3):

            if j==k:continue

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

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

N = int(eval(input()))
a = [list(map(int, input().split())) for _ in range(N)]
dp = [[0] * 3 for _ in range(100010)]
# dp[i][j] : i日目にj番目の活動をしたときの幸福度の総和
idx = [[1, 2], [2, 0], [0, 1]]
for i in range(3):
    dp[0][i] = a[0][i]
for i in range(1, N):
    for j in range(3):
        dp[i][j] = max(dp[i - 1][idx[j][0]], dp[i - 1][idx[j][1]]) + a[i][j]
print((max(dp[N - 1])))

import sys

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

N = int(eval(input()))
ABC = [list(map(int, input().split())) for _ in range(N)]
inf = 10**9 + 7
dp = [[0] * 3 for _ in range(N + 10)]
dp[0] = [ABC[0][0], ABC[0][1], ABC[0][2]]
for i in range(N - 1):
    for j in range(3):
        for k in range(3):
            if j == k:
                continue
            dp[i + 1][j] = max(dp[i + 1][j], dp[i][k] + ABC[i + 1][j])
print((max(dp[N - 1][:])))

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

-# dp[i][j] : i日目にj番目の活動をしたときの幸福度の総和

+ABC = [list(map(int, 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:

n=int(eval(input()))

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

visited=[False for i in range(n+1)]

q=[]

for _ in range(n-1):

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

    node[a].append(b)

    node[b].append(a)

    q.append((a,b))

mother=q[0][0]

visited[mother]=True

d=[]

e=[]

paint={i:{} for i in range(1,n+1)}

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

#使う要素 node visited paint mother_paint の四つのリスト

c=1

for child in node[mother]:

    visited[child]=True

    paint[mother][child]=c

    paint[child][mother]=c

    mother_paint[child]=c

    c+=1

    d.append(child)

while d:

    for parent in d:

        p=1

        for child in node[parent]:

            if visited[child]==False:

                visited[child]=True

                if p!=mother_paint[parent]:

                    paint[parent][child]=p

                    paint[child][parent]=p

                    mother_paint[child]=p

                    p+=1

                    e.append(child)

                else:

                    p+=1

                    paint[parent][child]=p

                    paint[child][parent]=p

                    mother_paint[child]=p

                    p+=1

                    e.append(child)

    if e:

        d=e

        e=[]

    else:

        d=[]

        e=[]

K=0

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

    K=max(K,len(node[i]))

print(K)

for i in range(n-1):

    s,t=q[i][0],q[i][1]

    print((paint[s][t]))

# optimized version of the same code:

#problem1

from collections import deque

d=deque()

e=deque()

N=int(eval(input()))

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

D=[]

for _ in range(N-1):

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

    graph[a].append(b)

    graph[b].append(a)

    D.append((a,b))

#頂点1からスタート

K=0

d.append(1)

visited=[False for i in range(N+1)]

color=[-1 for i in range(N+1)]

visited[1]=True

color[1]=-1

dic={}

while d:

    while d:

        x=d.popleft()

        par_color=color[x]

        c=1

        for node in graph[x]:

            if visited[node]==False:

                visited[node]=True

                e.append(node)

                if c!=par_color:

                    color[node]=c

                    dic[(x,node)]=c

                elif c==par_color:

                    c+=1

                    color[node]=c

                    dic[(x,node)]=c

                c+=1

    if e:

        d=e

        e=deque()

A=max(color)

print(A)

for que in D:

    a,b=que

    if (a,b) in list(dic.keys()):

        print((dic[que]))

    else:

        print((dic[(b,a)]))

n = int(eval(input()))
node = {i: [] for i in range(1, n + 1)}
visited = [False for i in range(n + 1)]
q = []
for _ in range(n - 1):
    a, b = list(map(int, input().split()))
    node[a].append(b)
    node[b].append(a)
    q.append((a, b))
mother = q[0][0]
visited[mother] = True
d = []
e = []
paint = {i: {} for i in range(1, n + 1)}
mother_paint = [0 for i in range(n + 1)]
# 使う要素 node visited paint mother_paint の四つのリスト
c = 1
for child in node[mother]:
    visited[child] = True
    paint[mother][child] = c
    paint[child][mother] = c
    mother_paint[child] = c
    c += 1
    d.append(child)
while d:
    for parent in d:
        p = 1
        for child in node[parent]:
            if visited[child] == False:
                visited[child] = True
                if p != mother_paint[parent]:
                    paint[parent][child] = p
                    paint[child][parent] = p
                    mother_paint[child] = p
                    p += 1
                    e.append(child)
                else:
                    p += 1
                    paint[parent][child] = p
                    paint[child][parent] = p
                    mother_paint[child] = p
                    p += 1
                    e.append(child)
    if e:
        d = e
        e = []
    else:
        d = []
        e = []
K = 0
for i in range(1, n + 1):
    K = max(K, len(node[i]))
print(K)
for i in range(n - 1):
    s, t = q[i][0], q[i][1]
    print((paint[s][t]))

# problem1
from collections import deque

d = deque()
e = deque()
N = int(eval(input()))
graph = [[] for i in range(N + 1)]
D = []
for _ in range(N - 1):
    a, b = list(map(int, input().split()))
    graph[a].append(b)
    graph[b].append(a)
    D.append((a, b))
# 頂点1からスタート
K = 0
d.append(1)
visited = [False for i in range(N + 1)]
color = [-1 for i in range(N + 1)]
visited[1] = True
color[1] = -1
dic = {}
while d:
    while d:
        x = d.popleft()
        par_color = color[x]
        c = 1
        for node in graph[x]:
            if visited[node] == False:
                visited[node] = True
                e.append(node)
                if c != par_color:
                    color[node] = c
                    dic[(x, node)] = c
                elif c == par_color:
                    c += 1
                    color[node] = c
                    dic[(x, node)] = c
                c += 1
    if e:
        d = e
        e = deque()
A = max(color)
print(A)
for que in D:
    a, b = que
    if (a, b) in list(dic.keys()):
        print((dic[que]))
    else:
        print((dic[(b, a)]))

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

-visited = [False for i in range(n + 1)]

-paint = {i: {} for i in range(1, n + 1)}

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

-# 使う要素 node visited paint mother_paint の四つのリスト

+# 頂点1からスタート

+visited = [False for i in range(N + 1)]

-            if visited[child] == False:

-                if p != mother_paint[parent]:

-                    paint[parent][child] = p

-                    paint[child][parent] = p

-                    mother_paint[child] = p

-                    paint[parent][child] = p

-                    paint[child][parent] = p

-                    mother_paint[child] = 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:

from math import factorial

mod = 10**9 + 7

n = int(eval(input()))

ans = factorial(n) % mod

print(ans)

# optimized version of the same code:

N = int(eval(input()))

MOD = 10**9 + 7

ans = 1

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

    ans *= i

    ans %= MOD

print(ans)

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

-from math import factorial
-mod = 10**9 + 7
-n = int(eval(input()))
-ans = factorial(n) % mod
+N = int(eval(input()))
+MOD = 10**9 + 7
+ans = 1
+for i in range(2, N + 1):
+    ans *= i
+    ans %= MOD


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

# import sys

# sys.setrecursionlimit(10 ** 6)

# import bisect

# from collections import deque

def cmb(n, r):

    """組み合わせ"""

    import math

    if n < r:

        return 0

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

# from decorator import stop_watch

#

#

# @stop_watch

def solve(S):

    mod = 10 ** 9 + 7

    ans = 0

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

        tama = i + (S - (i * 3))

        tama -= 2

        bo = i - 1

        ans += cmb(tama + 1, bo)

        ans %= mod

    print(ans)

if __name__ == '__main__':

    # S = input()

    S = int(eval(input()))

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

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

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

    # ABi = [[int(i) for i in input().split()] for _ in range(N)]

    solve(S)

    # # test

    # from random import randint

    # from func import random_str

    # solve()

# optimized version of the same code:

# 解説を参考に作成

# import sys

# sys.setrecursionlimit(10 ** 6)

# import bisect

# from collections import deque

# from decorator import stop_watch

#

#

# @stop_watch

def solve(S):

    mod = 10 ** 9 + 7

    dp = [0] * (S + 1)

    dp[0] = 1

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

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

        dp[i] %= mod

    print((dp[S]))

if __name__ == '__main__':

    S = int(eval(input()))

    solve(S)

    # # test

    # from random import randint

    # from func import random_str

    # solve()

# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
def cmb(n, r):
    """組み合わせ"""
    import math

    if n < r:
        return 0
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

# from decorator import stop_watch
#
#
# @stop_watch
def solve(S):
    mod = 10**9 + 7
    ans = 0
    for i in range(1, S // 3 + 1):
        tama = i + (S - (i * 3))
        tama -= 2
        bo = i - 1
        ans += cmb(tama + 1, bo)
        ans %= mod
    print(ans)

if __name__ == "__main__":
    # S = input()
    S = int(eval(input()))
    # N, M = map(int, input().split())
    # Ai = [int(i) for i in input().split()]
    # Bi = [int(i) for i in input().split()]
    # ABi = [[int(i) for i in input().split()] for _ in range(N)]
    solve(S)
    # # test
    # from random import randint
    # from func import random_str
    # solve()

# 解説を参考に作成
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(S):
    mod = 10**9 + 7
    dp = [0] * (S + 1)
    dp[0] = 1
    for i in range(3, S + 1):
        dp[i] = dp[i - 1] + dp[i - 3]
        dp[i] %= mod
    print((dp[S]))

if __name__ == "__main__":
    S = int(eval(input()))
    solve(S)
    # # test
    # from random import randint
    # from func import random_str
    # solve()

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

-    # Ai = [int(i) for i in input().split()]

-    # Bi = [int(i) for i in input().split()]

-    # ABi = [[int(i) for i 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:

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

def diff(l):

    m = max(l)

    return sorted(m - v for v in l)[1:]

s = sum(map(max, [a, b, c]))

sa, sb, sc = list(map(diff, [a, b, c]))

da, db, dc = [0], [0], [0]

q = [0]

while k > 0:

    while True:

        if len(sa) > 0 and (len(q) == 0 or q[0] > sa[0]):

            for v in [sa[0] + bb + cc for bb in db for cc in dc]:

                heapq.heappush(q, v)

            da.append(sa[0])

            sa = sa[1:]

        elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):

            for v in [sb[0] + aa + cc for aa in da for cc in dc]:

                heapq.heappush(q, v)

            db.append(sb[0])

            sb = sb[1:]

        elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):

            for v in [sc[0] + aa + bb for aa in da for bb in db]:

                heapq.heappush(q, v)

            dc.append(sc[0])

            sc = sc[1:]

        else:

            break

    v = heapq.heappop(q)

    print(s - v)

    k -= 1

# optimized version of the same code:

import heapq

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

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

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

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

q = []

memo = set()

def qpush(q, ai, bi, ci):

    t = (-(a[ai] + b[bi] + c[ci]), ai, bi, ci)

    if not t in memo:

        memo.add(t)

        heapq.heappush(q, t)

qpush(q, len(a) - 1, len(b) - 1, len(c) - 1)

for _ in range(k):

    s, ai, bi, ci = heapq.heappop(q)

    if ai > 0:

        qpush(q, ai - 1, bi, ci)

    if bi > 0:

        qpush(q, ai, bi - 1, ci)

    if ci > 0:

        qpush(q, ai, bi, ci - 1)

    print(-s)

-    return sorted(m - v for v in l)[1:]

-sa, sb, sc = list(map(diff, [a, b, c]))

-            for v in [sa[0] + bb + cc for bb in db for cc in dc]:

-        elif len(sb) > 0 and (len(q) == 0 or q[0] > sb[0]):

-            for v in [sb[0] + aa + cc for aa in da for cc in dc]:

-        elif len(sc) > 0 and (len(q) == 0 or q[0] > sc[0]):

-            for v in [sc[0] + aa + bb for aa in da for bb in db]:

+qpush(q, len(a) - 1, len(b) - 1, len(c) - 1)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

N = int(eval(input()))

A = [0]*N

X = []

Y = []

for i in range(N):

    A[i] = int(eval(input()))

    X.append([])

    Y.append([])

    for j in range(A[i]):

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

        X[i].append(x-1)

        Y[i].append(y)

ans = 0

for bit in range(1<<N):

    honest = 0

    ok = True

    for i in range(N):

        if bit&(1<<i):

            honest += 1

            for j in range(A[i]):

                if Y[i][j] == 0:

                    if bit&(1<<X[i][j]):

                        ok = False

                        break

                else:

                    if not bit&(1<<X[i][j]):

                        ok = False

                        break

            if not ok:

                break

    if ok:

        ans = max(ans, honest)

print(ans)

# optimized version of the same code:

N = int(eval(input()))

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

for i in range(N):

    A = int(eval(input()))

    for _ in range(A):

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

        XY[i].append((x-1,y))

ans = 0

for bit in range(1<<N):

    cnt = bin(bit).count('1')

    ok = True

    for i in range(N):

        if bit&(1<<i):

            for x,y in XY[i]:

                if y == 1:

                    if not bit&(1<<x):

                        ok = False

                        break

                else:

                    if bit&(1<<x):

                        ok = False

                        break

            if not ok:

                break

    if ok:

        ans = max(ans, cnt)

print(ans)

N = int(eval(input()))
A = [0] * N
X = []
Y = []
for i in range(N):
    A[i] = int(eval(input()))
    X.append([])
    Y.append([])
    for j in range(A[i]):
        x, y = list(map(int, input().split()))
        X[i].append(x - 1)
        Y[i].append(y)
ans = 0
for bit in range(1 << N):
    honest = 0
    ok = True
    for i in range(N):
        if bit & (1 << i):
            honest += 1
            for j in range(A[i]):
                if Y[i][j] == 0:
                    if bit & (1 << X[i][j]):
                        ok = False
                        break
                else:
                    if not bit & (1 << X[i][j]):
                        ok = False
                        break
            if not ok:
                break
    if ok:
        ans = max(ans, honest)
print(ans)

N = int(eval(input()))
XY = [[] for _ in range(N)]
for i in range(N):
    A = int(eval(input()))
    for _ in range(A):
        x, y = list(map(int, input().split()))
        XY[i].append((x - 1, y))
ans = 0
for bit in range(1 << N):
    cnt = bin(bit).count("1")
    ok = True
    for i in range(N):
        if bit & (1 << i):
            for x, y in XY[i]:
                if y == 1:
                    if not bit & (1 << x):
                        ok = False
                        break
                else:
                    if bit & (1 << x):
                        ok = False
                        break
            if not ok:
                break
    if ok:
        ans = max(ans, cnt)
print(ans)

+                    if not bit & (1 << x):


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

from collections import Counter

import sys

input = sys.stdin.readline

def solve():

    N = int(eval(input()))

    Sss = [input().rstrip() for _ in range(N)]

    cnt = Counter(Sss)

    #print('cnt:', cnt)

    maxNum = max(cnt.values())

    #print('maxNum:', maxNum)

    anss = []

    for key, value in list(cnt.items()):

        if value == maxNum:

            anss.append(key)

    #print('anss:', anss)

    anss.sort()

    print(('\n'.join(anss)))

solve()

# optimized version of the same code:

from collections import Counter

import sys

input = sys.stdin.readline

N = int(eval(input()))

Sss = [input().rstrip() for _ in range(N)]

cnt = Counter(Sss)

num = max(cnt.values())

anss = []

for key in sorted(cnt.keys()):

    if cnt[key] == num:

        anss.append(key)

print(('\n'.join(anss)))

from collections import Counter
import sys

input = sys.stdin.readline

def solve():
    N = int(eval(input()))
    Sss = [input().rstrip() for _ in range(N)]
    cnt = Counter(Sss)
    # print('cnt:', cnt)
    maxNum = max(cnt.values())
    # print('maxNum:', maxNum)
    anss = []
    for key, value in list(cnt.items()):
        if value == maxNum:
            anss.append(key)
    # print('anss:', anss)
    anss.sort()
    print(("\n".join(anss)))

solve()

from collections import Counter
import sys

input = sys.stdin.readline
N = int(eval(input()))
Sss = [input().rstrip() for _ in range(N)]
cnt = Counter(Sss)
num = max(cnt.values())
anss = []
for key in sorted(cnt.keys()):
    if cnt[key] == num:
        anss.append(key)
print(("\n".join(anss)))

-    Sss = [input().rstrip() for _ in range(N)]

-    for key, value in list(cnt.items()):

+Sss = [input().rstrip() for _ in range(N)]


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import math

n = int(eval(input()))

ans = math.factorial(n)  # nの階乗を計算

if ans >= (10 ** 9)+7:

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

print(ans)

# optimized version of the same code:

n = int(eval(input()))

ans = 1

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

    ans = ans * i

    ans = ans % ((10 ** 9)+7)  # 途中で割り算の余りを求めても、最終結果は同じになる

print(ans)

import math

n = int(eval(input()))
ans = math.factorial(n)  # nの階乗を計算
if ans >= (10**9) + 7:
    ans = ans % ((10**9) + 7)
print(ans)

n = int(eval(input()))
ans = 1
for i in range(1, n + 1):
    ans = ans * i
    ans = ans % ((10**9) + 7)  # 途中で割り算の余りを求めても、最終結果は同じになる
print(ans)

+    ans = ans % ((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:

"""Minimum cost Sort."""

def min_cost_sort(A):

    """Sort list A in ascending order.

    And return the switching cost in sorting.

    """

    B = list(A)

    B.sort()

    cost = 0

    min_w = B[0]

    for i, b in enumerate(B):

        tmp_cost = 0

        bi = A.index(b)

        n = 1

        while bi != i:

            n += 1

            st = B[bi]

            si = A.index(st)

            tmp_cost += b + st

            A[bi], A[si] = st, b

            bi = si

        dec = (n - 1) * (b - min_w)

        inc = 2 * (min_w + b)

        if dec < inc:

            cost += tmp_cost

        else:

            cost += tmp_cost - dec + inc

    return cost

n = eval(input())

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

ans = min_cost_sort(A)

print(ans)

# optimized version of the same code:

"""Minimum cost Sort."""

def min_cost_sort(A):

    """Sort list A in ascending order.

    And return the switching cost in sorting.

    """

    B = list(A)

    B.sort()

    cost = 0

    min_w = B[0]

    for i, b in enumerate(B):

        tmp_cost = 0

        bi = A.index(b)

        cnt = 0

        while bi != i:

            cnt += 1

            st = B[bi]

            si = A.index(st)

            tmp_cost += b + st

            A[bi], A[si] = st, b

            bi = si

        if cnt:

            dec = cnt * (b - min_w)

            inc = 2 * (min_w + b)

            if dec < inc:

                cost += tmp_cost

            else:

                cost += tmp_cost - dec + inc

    return cost

n = eval(input())

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

ans = min_cost_sort(A)

print(ans)

-            cost += tmp_cost - dec + inc

+                cost += tmp_cost - dec + inc


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import math

import numpy as np

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

x = np.zeros([n, d])

for i in range(n):

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

    for j in range(d):

        x[i, j] = line[j]

cnt = 0

for i in range(n):

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

        xx = (x[i] - x[j]) ** 2

        dist = math.sqrt(xx.sum())

        if dist % 1 == 0:

            cnt += 1

print(cnt)

# optimized version of the same code:

import math

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

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

cnt = 0

for i in range(n):

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

        dist = 0

        for k in range(d):

            dist += (x[i][k] - x[j][k]) ** 2

        if math.sqrt(dist).is_integer():

            cnt += 1

print(cnt)

import math
import numpy as np

n, d = list(map(int, input().split()))
x = np.zeros([n, d])
for i in range(n):
    line = list(map(int, input().split()))
    for j in range(d):
        x[i, j] = line[j]
cnt = 0
for i in range(n):
    for j in range(i + 1, n):
        xx = (x[i] - x[j]) ** 2
        dist = math.sqrt(xx.sum())
        if dist % 1 == 0:
            cnt += 1
print(cnt)

import math

n, d = list(map(int, input().split()))
x = [list(map(int, input().split())) for i in range(n)]
cnt = 0
for i in range(n):
    for j in range(i + 1, n):
        dist = 0
        for k in range(d):
            dist += (x[i][k] - x[j][k]) ** 2
        if math.sqrt(dist).is_integer():
            cnt += 1
print(cnt)

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

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

+        if math.sqrt(dist).is_integer():


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

s = int(eval(input()))

mod = 10 ** 9 + 7

@lru_cache(maxsize=None)

def dfs(n):

    if n <= 2:

        return 0

    elif 3<=n<=5:

        return 1

    else:

        count = 1

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

            count += dfs(n - i)

            count %= mod

        return count % mod

ans = dfs(s)

print(ans)

# optimized version of the same code:

s = int(eval(input()))

mod = 10 ** 9 + 7

dp = [0] * (s + 1)

dp[0] = 1

x = 0

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

    x += dp[i - 3]

    dp[i] = x % mod

ans = dp[s] % mod

print(ans)

from functools import lru_cache
import sys

sys.setrecursionlimit(2000)
s = int(eval(input()))
mod = 10**9 + 7

@lru_cache(maxsize=None)
def dfs(n):
    if n <= 2:
        return 0
    elif 3 <= n <= 5:
        return 1
    else:
        count = 1
        for i in range(3, n + 1):
            count += dfs(n - i)
            count %= mod
        return count % mod

ans = dfs(s)
print(ans)

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

-from functools import lru_cache
-import sys
-sys.setrecursionlimit(2000)
-@lru_cache(maxsize=None)
-def dfs(n):
-    if n <= 2:
-        return 0
-    elif 3 <= n <= 5:
-        return 1
-    else:
-        count = 1
-        for i in range(3, n + 1):
-            count += dfs(n - i)
-            count %= mod
-        return count % mod
-ans = dfs(s)
+dp = [0] * (s + 1)
+dp[0] = 1
+x = 0
+for i in range(3, s + 1):
+    x += dp[i - 3]
+    dp[i] = x % mod
+ans = dp[s] % mod


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import numpy as np

N = int(eval(input()))

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

diff = np.diff(plan, axis = 0)

def is_possible(t, x, y):

    if (t + x + y) % 2 == 0 and abs(x) + abs(y) <= t:

        return True

    else:

        return False

for i in range(N):

    ti, xi, yi = diff[i]

    if not is_possible(ti, xi, yi):

        print('No')

        exit()

print('Yes')

# optimized version of the same code:

N = int(eval(input()))

plan = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]

diff = [[plan[i + 1][j] - plan[i][j] for j in range(3)] for i in range(N)]

def is_possible(t, x, y):

    if (t + x + y) % 2 == 0 and abs(x) + abs(y) <= t:

        return True

    else:

        return False

for i in range(N):

    ti, xi, yi = diff[i]

    if not is_possible(ti, xi, yi):

        print('No')

        exit()

print('Yes')

import numpy as np

N = int(eval(input()))
plan = np.array([[0, 0, 0]] + [list(map(int, input().split())) for i in range(N)])
diff = np.diff(plan, axis=0)

def is_possible(t, x, y):
    if (t + x + y) % 2 == 0 and abs(x) + abs(y) <= t:
        return True
    else:
        return False

for i in range(N):
    ti, xi, yi = diff[i]
    if not is_possible(ti, xi, yi):
        print("No")
        exit()
print("Yes")

N = int(eval(input()))
plan = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]
diff = [[plan[i + 1][j] - plan[i][j] for j in range(3)] for i in range(N)]

def is_possible(t, x, y):
    if (t + x + y) % 2 == 0 and abs(x) + abs(y) <= t:
        return True
    else:
        return False

for i in range(N):
    ti, xi, yi = diff[i]
    if not is_possible(ti, xi, yi):
        print("No")
        exit()
print("Yes")

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

+plan = [[0, 0, 0]] + [list(map(int, input().split())) for _ in range(N)]

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

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

num = 0

q = []

for i in range(n):

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

    q.append((a,b))

q.sort()

for i in range(n):

    a, b = q[i][0], q[i][1]

    num += b

    if num >= k:

        print(a)

        exit()

# optimized version of the same code:

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

cnt = 0

num = []

for i in range(n):

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

    num.append((a,b))

num.sort()

for i in range(n):

    cnt += num[i][1]

    if cnt >= k:

        print((num[i][0]))

        exit()

n, k = list(map(int, input().split()))
num = 0
q = []
for i in range(n):
    a, b = list(map(int, input().split()))
    q.append((a, b))
q.sort()
for i in range(n):
    a, b = q[i][0], q[i][1]
    num += b
    if num >= k:
        print(a)
        exit()

n, k = list(map(int, input().split()))
cnt = 0
num = []
for i in range(n):
    a, b = list(map(int, input().split()))
    num.append((a, b))
num.sort()
for i in range(n):
    cnt += num[i][1]
    if cnt >= k:
        print((num[i][0]))
        exit()

-num = 0
-q = []
+cnt = 0
+num = []
-    q.append((a, b))
-q.sort()
+    num.append((a, b))
+num.sort()
-    a, b = q[i][0], q[i][1]
-    num += b
-    if num >= k:
-        print(a)
+    cnt += num[i][1]
+    if cnt >= k:
+        print((num[i][0]))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

input = sys.stdin.readline

from collections import *

def dfs(x, y):

    if x==0 and y==0:

        t[x][y] = False

        return False

    if x>=1:

        t[x][y] |= not dfs(x-1, y)

    if y>=1:

        t[x][y] |= not dfs(x, y-1)

    if min(x, y)>=1:

        t[x][y] |= not dfs(x-1, y-1)

    return t[x][y]

t = [[False]*7 for _ in range(7)]

for i in range(7):

    for j in range(7):

        dfs(i, j)

"""

for ti in t:

    print(*ti)

"""

N = int(eval(input()))

flag = True

for _ in range(N):

    a = int(eval(input()))

    if a%2==1:

        flag = False

if flag:

    print('second')

else:

    print('first')

# optimized version of the same code:

import sys

input = sys.stdin.readline

"""

def dfs(x, y):

    if x==0 and y==0:

        return False

    res = False

    if x>0:

        res |= not dfs(x-1, y)

    if y>0:

        res |= not dfs(x, y-1)

    if min(x, y)>0:

        res |= not dfs(x-1, y-1)

    return res

t = [[False]*5 for _ in range(5)]

for i in range(5):

    for j in range(5):

        t[i][j] = dfs(i, j)

for ti in t:

    print(*ti)

"""

N = int(eval(input()))

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

for ai in a:

    if ai%2==1:

        print('first')

        exit()

print('second')

import sys

input = sys.stdin.readline
from collections import *

def dfs(x, y):
    if x == 0 and y == 0:
        t[x][y] = False
        return False
    if x >= 1:
        t[x][y] |= not dfs(x - 1, y)
    if y >= 1:
        t[x][y] |= not dfs(x, y - 1)
    if min(x, y) >= 1:
        t[x][y] |= not dfs(x - 1, y - 1)
    return t[x][y]

t = [[False] * 7 for _ in range(7)]
for i in range(7):
    for j in range(7):
        dfs(i, j)
"""
for ti in t:
    print(*ti)
"""
N = int(eval(input()))
flag = True
for _ in range(N):
    a = int(eval(input()))
    if a % 2 == 1:
        flag = False
if flag:
    print("second")
else:
    print("first")

import sys

input = sys.stdin.readline
"""
def dfs(x, y):
    if x==0 and y==0:
        return False
    res = False
    if x>0:
        res |= not dfs(x-1, y)
    if y>0:
        res |= not dfs(x, y-1)
    if min(x, y)>0:
        res |= not dfs(x-1, y-1)
    return res
t = [[False]*5 for _ in range(5)]
for i in range(5):
    for j in range(5):
        t[i][j] = dfs(i, j)
for ti in t:
    print(*ti)
"""
N = int(eval(input()))
a = [int(eval(input())) for _ in range(N)]
for ai in a:
    if ai % 2 == 1:
        print("first")
        exit()
print("second")

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

cnt=0

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

    n=list(str(i))

    if n==list(reversed(n)):

        cnt+=1

print(cnt)

# optimized version of the same code:

from sys import stdin

nii=lambda:list(map(int,stdin.readline().split()))

lnii=lambda:list(map(int,stdin.readline().split()))

a,b=nii()

ans=0

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

  s=str(i)

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

    ans+=1

print(ans)

a, b = list(map(int, input().split()))
cnt = 0
for i in range(a, b + 1):
    n = list(str(i))
    if n == list(reversed(n)):
        cnt += 1
print(cnt)

from sys import stdin

nii = lambda: list(map(int, stdin.readline().split()))
lnii = lambda: list(map(int, stdin.readline().split()))
a, b = nii()
ans = 0
for i in range(a, b + 1):
    s = str(i)
    if s == s[::-1]:
        ans += 1
print(ans)

+nii = lambda: list(map(int, stdin.readline().split()))

+lnii = lambda: list(map(int, stdin.readline().split()))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

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

count = 0

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

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

        count += 1

print(count)

# optimized version of the same code:

def solve(string):

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

    count = 0

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

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

            count += 1

    return str(count)

if __name__ == '__main__':

    print((solve(eval(input()))))

def solve(string):
    a, b = list(map(int, string.split()))
    count = 0
    for i in range(a, b + 1):
        if str(i) == str(i)[::-1]:
            count += 1
    return str(count)

if __name__ == "__main__":
    print((solve(eval(input()))))

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

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


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

input = sys.stdin.readline

from collections import Counter

import numpy as np

from numba import njit

def read():

    N = int(input().strip())

    return N,

@njit

def f(n):

    """

    約数の個数を求める

    """

    ndivs = np.ones((n+1), dtype=np.int32)

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

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

            ndivs[j] += 1

    return ndivs

@njit

def solve(N):

    fn = f(N)

    ans = 0

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

        ans += k * fn[k]

    return ans

if __name__ == '__main__':

    inputs = read()

    outputs = solve(*inputs)

    if outputs is not None:

        print(("%s" % str(outputs)))

# optimized version of the same code:

import sys

input = sys.stdin.readline

import numpy as np

from numba import njit

def read():

    N = int(input().strip())

    return N,

@njit

def solve(N):

    ndivs = 0

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

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

            ndivs += j

    return ndivs

if __name__ == '__main__':

    inputs = read()

    outputs = solve(*inputs)

    if outputs is not None:

        print(("%s" % str(outputs)))

import sys

input = sys.stdin.readline
from collections import Counter
import numpy as np
from numba import njit

def read():
    N = int(input().strip())
    return (N,)

@njit
def f(n):
    """
    約数の個数を求める
    """
    ndivs = np.ones((n + 1), dtype=np.int32)
    for i in range(2, n + 1):
        for j in range(i, n + 1, i):
            ndivs[j] += 1
    return ndivs

@njit
def solve(N):
    fn = f(N)
    ans = 0
    for k in range(1, N + 1):
        ans += k * fn[k]
    return ans

if __name__ == "__main__":
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print(("%s" % str(outputs)))

import sys

input = sys.stdin.readline
import numpy as np
from numba import njit

def read():
    N = int(input().strip())
    return (N,)

@njit
def solve(N):
    ndivs = 0
    for i in range(1, N + 1):
        for j in range(i, N + 1, i):
            ndivs += j
    return ndivs

if __name__ == "__main__":
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print(("%s" % str(outputs)))

-    約数の個数を求める

-    ndivs = np.ones((n + 1), dtype=np.int32)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

# a+b-2

# N = a*b  よってNの約数を求める

import numpy as np

N = int(eval(input()))

U = 10**6+100

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

div = x[N%x==0]

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

print(ans)

# optimized version of the same code:

import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read

input = sys.stdin.buffer.readline

readlines = sys.stdin.buffer.readlines

def make_divisors(n):

    divisors = []

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

        if n % i == 0:

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

    # divisors.sort()

    return divisors

N = int(eval(input()))

div = make_divisors(N)

ans = 10**15

for a, b in div:

  ans = min(ans, a+b-2)

print(ans)

# a+b-2
# N = a*b  よってNの約数を求める
import numpy as np

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

import sys

sys.setrecursionlimit(10**7)
read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append((i, n // i))
    # divisors.sort()
    return divisors

N = int(eval(input()))
div = make_divisors(N)
ans = 10**15
for a, b in div:
    ans = min(ans, a + b - 2)
print(ans)

-# N = a*b  よってNの約数を求める

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

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


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

import numpy as np

n, l = list(map(int, sys.stdin.readline().split()))

def main():

    f = l + np.arange(1, n+1) - 1

    s = f.sum()

    a = np.absolute(f)

    mi = np.amin(a)

    i = np.argwhere(a == mi)[0, 0]

    return s - f[i]

if __name__ == '__main__':

    ans = main()

    print(ans)

# optimized version of the same code:

import sys

n, l = list(map(int, sys.stdin.readline().split()))

def main():

    s = (l - 1) * n + (1 + n) * n // 2

    res = []

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

        f = l + i - 1

        res.append((abs(f), s - f))

    res.sort()

    return res[0][1]

if __name__=='__main__':

    ans = main()

    print(ans)

import sys
import numpy as np

n, l = list(map(int, sys.stdin.readline().split()))

def main():
    f = l + np.arange(1, n + 1) - 1
    s = f.sum()
    a = np.absolute(f)
    mi = np.amin(a)
    i = np.argwhere(a == mi)[0, 0]
    return s - f[i]

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

import sys

n, l = list(map(int, sys.stdin.readline().split()))

def main():
    s = (l - 1) * n + (1 + n) * n // 2
    res = []
    for i in range(1, n + 1):
        f = l + i - 1
        res.append((abs(f), s - f))
    res.sort()
    return res[0][1]

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

-import numpy as np
-    f = l + np.arange(1, n + 1) - 1
-    s = f.sum()
-    a = np.absolute(f)
-    mi = np.amin(a)
-    i = np.argwhere(a == mi)[0, 0]
-    return s - f[i]
+    s = (l - 1) * n + (1 + n) * n // 2
+    res = []
+    for i in range(1, n + 1):
+        f = l + i - 1
+        res.append((abs(f), s - f))
+    res.sort()
+    return res[0][1]


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

# coding: utf-8

import numpy as np

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

cnt = 0

X = []

for i in range(n):

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

    X.append(x[:])

X = np.array(X)

for i in range(n):

    X_tmp = X[:]

    X_tmp -= X[i]

    for i in range(n):

        x = X_tmp[i]

        x_sq = x**2

        x_sq = np.sqrt(sum(x_sq))

        if x_sq % 1 == 0:

            cnt += 1

print(((cnt-n)//2))

# optimized version of the same code:

# coding: utf-8

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

X = []

ans = 0

for i in range(N):

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

for i in range(N):

    for j in range(N):

        dist = 0

        if i == j:

            continue

        for d in range(D):

            dist += ((X[i][d] - X[j][d])**2)

        if dist**0.5 == int(dist**0.5):

            ans += 1

print((ans//2))

# coding: utf-8
import numpy as np

n, d = list(map(int, input().split()))
cnt = 0
X = []
for i in range(n):
    x = list(map(int, input().split()))
    X.append(x[:])
X = np.array(X)
for i in range(n):
    X_tmp = X[:]
    X_tmp -= X[i]
    for i in range(n):
        x = X_tmp[i]
        x_sq = x**2
        x_sq = np.sqrt(sum(x_sq))
        if x_sq % 1 == 0:
            cnt += 1
print(((cnt - n) // 2))

# coding: utf-8
N, D = list(map(int, input().split()))
X = []
ans = 0
for i in range(N):
    X.append(list(map(int, input().split())))
for i in range(N):
    for j in range(N):
        dist = 0
        if i == j:
            continue
        for d in range(D):
            dist += (X[i][d] - X[j][d]) ** 2
        if dist**0.5 == int(dist**0.5):
            ans += 1
print((ans // 2))

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

+    X.append(list(map(int, input().split())))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import copy

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

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

old_ai = ai

cnt = 0

while 1 == 1:

    old_ai = copy.deepcopy(ai)

    li = [0]*(n+1)

    for i in range(n):

        li[max(0,i-ai[i])] += 1

        li[min(n,i+1+ai[i])] -= 1

        #print(li)

    #print(li)

    tmp = 0

    for i in range(n):

        if i == 0:

            ai[i] = li[i]

            tmp += ai[i]

        else:

            ai[i] = li[i] + ai[i-1]

            tmp += ai[i]

    #print(rui)

    if ai == old_ai:

        print((*ai))

        exit()

        break

    cnt += 1

    if cnt == k:

        print((*ai))

        exit()

    old_ai = ai

# optimized version of the same code:

import copy

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

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

#old_ai = ai

cnt = 0

old_tmp = sum(ai)

while 1 == 1:

    #old_ai = copy.deepcopy(ai)

    li = [0]*(n+1)

    for i in range(n):

        li[max(0,i-ai[i])] += 1

        li[min(n,i+1+ai[i])] -= 1

        #print(li)

    #print(li)

    tmp = 0

    for i in range(n):

        if i == 0:

            ai[i] = li[i]

            tmp += ai[i]

        else:

            ai[i] = li[i] + ai[i-1]

            tmp += ai[i]

    #print(rui)

    if old_tmp == tmp:

        print((*ai))

        exit()

        break

    cnt += 1

    if cnt == k:

        print((*ai))

        exit()

    old_tmp = tmp

import copy

n, k = list(map(int, input().split()))
ai = [int(i) for i in input().split()]
old_ai = ai
cnt = 0
while 1 == 1:
    old_ai = copy.deepcopy(ai)
    li = [0] * (n + 1)
    for i in range(n):
        li[max(0, i - ai[i])] += 1
        li[min(n, i + 1 + ai[i])] -= 1
        # print(li)
    # print(li)
    tmp = 0
    for i in range(n):
        if i == 0:
            ai[i] = li[i]
            tmp += ai[i]
        else:
            ai[i] = li[i] + ai[i - 1]
            tmp += ai[i]
    # print(rui)
    if ai == old_ai:
        print((*ai))
        exit()
        break
    cnt += 1
    if cnt == k:
        print((*ai))
        exit()
    old_ai = ai

import copy

n, k = list(map(int, input().split()))
ai = [int(i) for i in input().split()]
# old_ai = ai
cnt = 0
old_tmp = sum(ai)
while 1 == 1:
    # old_ai = copy.deepcopy(ai)
    li = [0] * (n + 1)
    for i in range(n):
        li[max(0, i - ai[i])] += 1
        li[min(n, i + 1 + ai[i])] -= 1
        # print(li)
    # print(li)
    tmp = 0
    for i in range(n):
        if i == 0:
            ai[i] = li[i]
            tmp += ai[i]
        else:
            ai[i] = li[i] + ai[i - 1]
            tmp += ai[i]
    # print(rui)
    if old_tmp == tmp:
        print((*ai))
        exit()
        break
    cnt += 1
    if cnt == k:
        print((*ai))
        exit()
    old_tmp = tmp

-old_ai = ai
+# old_ai = ai
+old_tmp = sum(ai)
-    old_ai = copy.deepcopy(ai)
+    # old_ai = copy.deepcopy(ai)
-    if ai == old_ai:
+    if old_tmp == tmp:
-    old_ai = ai
+    old_tmp = tmp


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 d_cake_123_binary_search(X, Y, Z, K, A, B, C):

    # editionalの解法4 O(K^2log(max(P))

    # 参考: https://atcoder.jp/contests/abc123/submissions/4871511

    import bisect

    ab = sorted([e1 + e2 for e2 in B for e1 in A])  # A, Bの要素は全部調べる

    # rejected 以上の値は、美味しさの合計がそれ以上である個数がK個未満である

    accepted, rejected = -1, 10**11

    while abs(accepted - rejected) > 1:

        mid = (accepted + rejected) // 2

        count = sum([len(ab) - bisect.bisect_left(ab, mid - e) for e in C])

        if count >= K:

            accepted = mid

        else:

            rejected = mid

    ans = []

    for e in C:

        idx = bisect.bisect_left(ab, accepted - e)

        for i in range(idx, len(ab)):

            ans.append(e + ab[i])

    ans.sort(reverse=True)

    return '\n'.join(map(str, ans[:K]))

X, Y, Z, K = [int(i) for i in input().split()]

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

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

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

print((d_cake_123_binary_search(X, Y, Z, K, A, B, C)))

# optimized version of the same code:

def d_cake_123_sort_modified():

    """editorial の解法 1."""

    import sys

    import numpy as np

    input = sys.stdin.readline

    X, Y, Z, K = [int(i) for i in input().split()]

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

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

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

    _a, _b = np.meshgrid(A, B)

    ab = np.sort((_a + _b).flatten())[::-1][:K]

    _ab, _c = np.meshgrid(ab, C)

    ans = np.sort((_ab + _c).flatten())[::-1][:K]

    return '\n'.join(map(str, ans))

print((d_cake_123_sort_modified()))

def d_cake_123_binary_search(X, Y, Z, K, A, B, C):
    # editionalの解法4 O(K^2log(max(P))
    # 参考: https://atcoder.jp/contests/abc123/submissions/4871511
    import bisect

    ab = sorted([e1 + e2 for e2 in B for e1 in A])  # A, Bの要素は全部調べる
    # rejected 以上の値は、美味しさの合計がそれ以上である個数がK個未満である
    accepted, rejected = -1, 10**11
    while abs(accepted - rejected) > 1:
        mid = (accepted + rejected) // 2
        count = sum([len(ab) - bisect.bisect_left(ab, mid - e) for e in C])
        if count >= K:
            accepted = mid
        else:
            rejected = mid
    ans = []
    for e in C:
        idx = bisect.bisect_left(ab, accepted - e)
        for i in range(idx, len(ab)):
            ans.append(e + ab[i])
    ans.sort(reverse=True)
    return "\n".join(map(str, ans[:K]))

X, Y, Z, K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
print((d_cake_123_binary_search(X, Y, Z, K, A, B, C)))

def d_cake_123_sort_modified():
    """editorial の解法 1."""
    import sys
    import numpy as np

    input = sys.stdin.readline
    X, Y, Z, K = [int(i) for i in input().split()]
    A = np.array([int(i) for i in input().split()])
    B = np.array([int(i) for i in input().split()])
    C = np.array([int(i) for i in input().split()])
    _a, _b = np.meshgrid(A, B)
    ab = np.sort((_a + _b).flatten())[::-1][:K]
    _ab, _c = np.meshgrid(ab, C)
    ans = np.sort((_ab + _c).flatten())[::-1][:K]
    return "\n".join(map(str, ans))

print((d_cake_123_sort_modified()))

-def d_cake_123_binary_search(X, Y, Z, K, A, B, C):

-    # 参考: https://atcoder.jp/contests/abc123/submissions/4871511

-    ab = sorted([e1 + e2 for e2 in B for e1 in A])  # A, Bの要素は全部調べる

-    # rejected 以上の値は、美味しさの合計がそれ以上である個数がK個未満である

-    while abs(accepted - rejected) > 1:

-        mid = (accepted + rejected) // 2

-        count = sum([len(ab) - bisect.bisect_left(ab, mid - e) for e in C])

-        idx = bisect.bisect_left(ab, accepted - e)

-    return "\n".join(map(str, ans[:K]))

+    X, Y, Z, K = [int(i) for i in input().split()]

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

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

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

-X, Y, Z, K = [int(i) for i in input().split()]

-print((d_cake_123_binary_search(X, Y, Z, K, A, B, 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:

import math

N = int(eval(input()))

p = math.factorial(N)

print((p % 1000000007))

# optimized version of the same code:

N = int(eval(input()))

p = 1

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

    p *= i

    p %= 1000000007

print(p)

N = int(eval(input()))
p = 1
for i in range(1, N + 1):
    p *= i
    p %= 1000000007
print(p)

-import math
-p = math.factorial(N)
-print((p % 1000000007))
+p = 1
+for i in range(1, N + 1):
+    p *= i
+    p %= 1000000007
+print(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 itertools

from scipy.sparse.csgraph import floyd_warshall

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

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

INF = 10**10

d = [[INF] * N for _ in range(N)]

for i in range(N):

    d[i][i] = 0

for _ in range(M):

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

    a -= 1

    b -= 1

    if d[a][b] > c:

        d[a][b] = c

        d[b][a] = c

def warshall(d):

    for k in range(N):

        for i in range(N):

            for j in range(N):

                if d[i][j] > d[i][k] + d[k][j]:

                    d[i][j] = d[i][k] + d[k][j]

# d = floyd_warshall(d)

warshall(d)

ans = INF

for p in itertools.permutations(r):

    dist = 0

    for i in range(R-1):

        dist += d[p[i]-1][p[i+1]-1]

    if ans > dist:

        ans = dist

print((int(ans)))

# optimized version of the same code:

import itertools

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

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

INF = 10**10

d = [[INF] * N for _ in range(N)]

for i in range(N):

    d[i][i] = 0

for _ in range(M):

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

    a -= 1

    b -= 1

    if d[a][b] > c:

        d[a][b] = c

        d[b][a] = c

def warshall(d):

    for k in range(N):

        for i in range(N):

            for j in range(N):

                if d[i][j] > d[i][k] + d[k][j]:

                    d[i][j] = d[i][k] + d[k][j]

# d = floyd_warshall(d)

warshall(d)

ans = INF

for p in itertools.permutations(r):

    dist = 0

    for i in range(R-1):

        dist += d[p[i]-1][p[i+1]-1]

    if ans > dist:

        ans = dist

print((int(ans)))

import itertools
from scipy.sparse.csgraph import floyd_warshall

N, M, R = list(map(int, input().split()))
r = tuple(map(int, input().split()))
INF = 10**10
d = [[INF] * N for _ in range(N)]
for i in range(N):
    d[i][i] = 0
for _ in range(M):
    a, b, c = list(map(int, input().split()))
    a -= 1
    b -= 1
    if d[a][b] > c:
        d[a][b] = c
        d[b][a] = c

def warshall(d):
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]

# d = floyd_warshall(d)
warshall(d)
ans = INF
for p in itertools.permutations(r):
    dist = 0
    for i in range(R - 1):
        dist += d[p[i] - 1][p[i + 1] - 1]
    if ans > dist:
        ans = dist
print((int(ans)))

import itertools

N, M, R = list(map(int, input().split()))
r = tuple(map(int, input().split()))
INF = 10**10
d = [[INF] * N for _ in range(N)]
for i in range(N):
    d[i][i] = 0
for _ in range(M):
    a, b, c = list(map(int, input().split()))
    a -= 1
    b -= 1
    if d[a][b] > c:
        d[a][b] = c
        d[b][a] = c

def warshall(d):
    for k in range(N):
        for i in range(N):
            for j in range(N):
                if d[i][j] > d[i][k] + d[k][j]:
                    d[i][j] = d[i][k] + d[k][j]

# d = floyd_warshall(d)
warshall(d)
ans = INF
for p in itertools.permutations(r):
    dist = 0
    for i in range(R - 1):
        dist += d[p[i] - 1][p[i + 1] - 1]
    if ans > dist:
        ans = dist
print((int(ans)))

-from scipy.sparse.csgraph import floyd_warshall


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

s = input().rstrip()

k = int(eval(input()))

def check_count(s):

    cnt_list = [1]

    cnt = 1

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

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

            cnt_list[-1] += 1

        else:

            cnt_list.append(1)

    return cnt_list

def calc_ans(cnt_list, k):

    _ans = 0

    for c in cnt_list:

        _ans += c//2

    return(_ans * k)

if len(s)==1:

    ans = k//2

else:

    cnt_list = check_count(s)

    if len(cnt_list)==1:

        ans = (len(s)*k)//2

    else:

        ans = calc_ans(cnt_list, k)

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

            if cnt_list[0]%2==1 and cnt_list[-1]%2==1:

                ans += k - 1

print(ans)

# optimized version of the same code:

import sys

input = sys.stdin.readline

s = input().rstrip()

k = int(eval(input()))

def check_count(s):

    cnt_list = []

    cnt = 1

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

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

            cnt += 1

        else:

            cnt_list.append(cnt)

            cnt = 1

    if cnt>1:

        cnt_list.append(cnt)

    return cnt_list

def calc_ans(cnt_list, k):

    _ans = 0

    for c in cnt_list:

        _ans += c//2

    return(_ans * k)

if len(s)==1:

    ans = k//2

else:

    cnt_list = check_count(s)

    if len(cnt_list)==1:

        ans = (len(s)*k)//2

    else:

        ans = calc_ans(cnt_list, k)

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

            if cnt_list[0]%2==1 and cnt_list[-1]%2==1:

                ans += k - 1

print(ans)

import sys

input = sys.stdin.readline
s = input().rstrip()
k = int(eval(input()))

def check_count(s):
    cnt_list = [1]
    cnt = 1
    for i in range(1, len(s)):
        if s[i - 1] == s[i]:
            cnt_list[-1] += 1
        else:
            cnt_list.append(1)
    return cnt_list

def calc_ans(cnt_list, k):
    _ans = 0
    for c in cnt_list:
        _ans += c // 2
    return _ans * k

if len(s) == 1:
    ans = k // 2
else:
    cnt_list = check_count(s)
    if len(cnt_list) == 1:
        ans = (len(s) * k) // 2
    else:
        ans = calc_ans(cnt_list, k)
        if s[0] == s[-1]:
            if cnt_list[0] % 2 == 1 and cnt_list[-1] % 2 == 1:
                ans += k - 1
print(ans)

import sys

input = sys.stdin.readline
s = input().rstrip()
k = int(eval(input()))

def check_count(s):
    cnt_list = []
    cnt = 1
    for i in range(1, len(s)):
        if s[i - 1] == s[i]:
            cnt += 1
        else:
            cnt_list.append(cnt)
            cnt = 1
    if cnt > 1:
        cnt_list.append(cnt)
    return cnt_list

def calc_ans(cnt_list, k):
    _ans = 0
    for c in cnt_list:
        _ans += c // 2
    return _ans * k

if len(s) == 1:
    ans = k // 2
else:
    cnt_list = check_count(s)
    if len(cnt_list) == 1:
        ans = (len(s) * k) // 2
    else:
        ans = calc_ans(cnt_list, k)
        if s[0] == s[-1]:
            if cnt_list[0] % 2 == 1 and cnt_list[-1] % 2 == 1:
                ans += k - 1
print(ans)

-    cnt_list = [1]
+    cnt_list = []
-            cnt_list[-1] += 1
+            cnt += 1
-            cnt_list.append(1)
+            cnt_list.append(cnt)
+            cnt = 1
+    if cnt > 1:
+        cnt_list.append(cnt)


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

N = int(eval(input()))

def dist(i, j):

    return i + j - 2

min = 10 ** 24

i = 1

while (i ** 2) <= N:

    if 0 == N % i:

        j = N // i

        d = dist(i, j)

        if min > d:

            min = d

    i += 1

print(d)

# optimized version of the same code:

import math

n = int(eval(input()))

ans = 0

for i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:

    if 0 == n % i:

        ans = i

        break

ans_partner = n // ans

print((ans + ans_partner - 2))

N = int(eval(input()))

def dist(i, j):
    return i + j - 2

min = 10**24
i = 1
while (i**2) <= N:
    if 0 == N % i:
        j = N // i
        d = dist(i, j)
        if min > d:
            min = d
    i += 1
print(d)

+for i in range(math.ceil(math.sqrt(n) + 1))[:0:-1]:


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

def main():

    x = int(eval(input()))

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

        for j in range(i, -150, -1):

            cal = i ** 5 - j ** 5

            if cal == x:

                print((i, j))

                exit()

if __name__ == '__main__':

    main()

# optimized version of the same code:

def main():

    x = int(eval(input()))

    for i in range(120):

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

            cal = i ** 5 - j ** 5

            if cal == x:

                print((i, j))

                exit()

if __name__ == '__main__':

    main()

def main():
    x = int(eval(input()))
    for i in range(150, 0, -1):
        for j in range(i, -150, -1):
            cal = i**5 - j**5
            if cal == x:
                print((i, j))
                exit()

if __name__ == "__main__":
    main()

def main():
    x = int(eval(input()))
    for i in range(120):
        for j in range(i, -i, -1):
            cal = i**5 - j**5
            if cal == x:
                print((i, j))
                exit()

if __name__ == "__main__":
    main()

-    for i in range(150, 0, -1):
-        for j in range(i, -150, -1):
+    for i in range(120):
+        for j in range(i, -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()))

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

# optimized version of the same code:

n = int(eval(input()))

print((0 if n else 1))

-print((1 if n == 0 else 0))
+print((0 if n else 1))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

sys.setrecursionlimit(10 ** 6)

# input = sys.stdin.readline    ####

int1 = lambda x: int(x) - 1

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

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

def MI1(): return list(map(int1, input().split()))

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

def LI1(): return list(map(int1, input().split()))

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

def printlist(lst, k='\n'): print((k.join(list(map(str, lst)))))

INF = float('inf')

import numpy as np

def solve():

    n = II()

    D = np.zeros((10, 10))

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

        s = list(str(i))

        l = int(s[0])

        r = int(s[-1])

        # print(s, l, r)

        D[l][r] += 1

    # print(D)

    ans = 0

    for i in range(10):

        for j in range(10):

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

    print((int(ans)))

if __name__ == '__main__':

    solve()

# optimized version of the same code:

import sys

sys.setrecursionlimit(10 ** 6)

# input = sys.stdin.readline    ####

int1 = lambda x: int(x) - 1

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

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

def MI1(): return list(map(int1, input().split()))

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

def LI1(): return list(map(int1, input().split()))

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

def printlist(lst, k='\n'): print((k.join(list(map(str, lst)))))

INF = float('inf')

def solve():

    n = II()

    D = [[0]*10 for _ in range(10)]

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

        s = list(str(i))

        l = int(s[0])

        r = int(s[-1])

        # print(s, l, r)

        D[l][r] += 1

    # print(D)

    ans = 0

    for i in range(10):

        for j in range(10):

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

    print((int(ans)))

if __name__ == '__main__':

    solve()

import sys

sys.setrecursionlimit(10**6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1

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

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

def MI1():
    return list(map(int1, input().split()))

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

def LI1():
    return list(map(int1, input().split()))

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

def printlist(lst, k="\n"):
    print((k.join(list(map(str, lst)))))

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

def solve():
    n = II()
    D = np.zeros((10, 10))
    for i in range(1, n + 1):
        s = list(str(i))
        l = int(s[0])
        r = int(s[-1])
        # print(s, l, r)
        D[l][r] += 1
    # print(D)
    ans = 0
    for i in range(10):
        for j in range(10):
            ans += D[i][j] * D[j][i]
    print((int(ans)))

if __name__ == "__main__":
    solve()

import sys

sys.setrecursionlimit(10**6)
# input = sys.stdin.readline    ####
int1 = lambda x: int(x) - 1

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

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

def MI1():
    return list(map(int1, input().split()))

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

def LI1():
    return list(map(int1, input().split()))

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

def printlist(lst, k="\n"):
    print((k.join(list(map(str, lst)))))

INF = float("inf")

def solve():
    n = II()
    D = [[0] * 10 for _ in range(10)]
    for i in range(1, n + 1):
        s = list(str(i))
        l = int(s[0])
        r = int(s[-1])
        # print(s, l, r)
        D[l][r] += 1
    # print(D)
    ans = 0
    for i in range(10):
        for j in range(10):
            ans += D[i][j] * D[j][i]
    print((int(ans)))

if __name__ == "__main__":
    solve()

-import numpy as np
-    D = np.zeros((10, 10))
+    D = [[0] * 10 for _ in range(10)]


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

readline = sys.stdin.readline

sys.setrecursionlimit(10**8)

mod = 10**9+7

#mod = 998244353

INF = 10**18

eps = 10**-7

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

def comb(n, r, mod):

    r = min(r, n-r)

    mol = 1

    deno = 1

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

        mol = mol * (n-r+i) % mod

        deno = deno * i % mod

    ret = mol * pow(deno, mod-2, mod) % mod

    return ret

def f1(x,y,a,b):

    return (a+b-x-y)*(a-x+1)*(b-y+1)//2

def f2(x,a):

    return (a-x)*(a-x+1)//2

ans = 0

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

    for y in range(1,m+1):

        ans += f1(x,y,n,m)+f1(1,1,x,y)+f1(1,y,x,m)+f1(x,1,n,y)

        ans -= f2(x,n) + f2(1,x) + f2(1,y) + f2(y,m)

        ans %= mod

ans = (ans * comb(m*n-2,k-2,mod))%mod

ans = ans*pow(2,mod-2,mod)%mod

print(ans)

# optimized version of the same code:

import sys

readline = sys.stdin.readline

sys.setrecursionlimit(10**8)

mod = 10**9+7

#mod = 998244353

INF = 10**18

eps = 10**-7

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

def comb(n, r, mod):

    r = min(r, n-r)

    mol = 1

    deno = 1

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

        mol = mol * (n-r+i) % mod

        deno = deno * i % mod

    ret = mol * pow(deno, mod-2, mod) % mod

    return ret

def f1(x,y,a,b):

    return (a+b-x-y)*(a-x+1)*(b-y+1)//2

def f2(x,a):

    return (a-x)*(a-x+1)//2

ans = 0

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

    for y in range(1,m+1):

        a = n-x+1

        b = m-y+1

        c = m*(a*(a-1)+x*(x-1))

        d = n*(b*(b-1)+y*(y-1))

        ans += (c+d)//2

        ans %= mod

ans = (ans * comb(m*n-2,k-2,mod))%mod

ans = ans*pow(2,mod-2,mod)%mod

print(ans)

import sys

readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
# mod = 998244353
INF = 10**18
eps = 10**-7
m, n, k = list(map(int, readline().split()))

def comb(n, r, mod):
    r = min(r, n - r)
    mol = 1
    deno = 1
    for i in range(1, r + 1):
        mol = mol * (n - r + i) % mod
        deno = deno * i % mod
    ret = mol * pow(deno, mod - 2, mod) % mod
    return ret

def f1(x, y, a, b):
    return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2

def f2(x, a):
    return (a - x) * (a - x + 1) // 2

ans = 0
for x in range(1, n + 1):
    for y in range(1, m + 1):
        ans += f1(x, y, n, m) + f1(1, 1, x, y) + f1(1, y, x, m) + f1(x, 1, n, y)
        ans -= f2(x, n) + f2(1, x) + f2(1, y) + f2(y, m)
        ans %= mod
ans = (ans * comb(m * n - 2, k - 2, mod)) % mod
ans = ans * pow(2, mod - 2, mod) % mod
print(ans)

import sys

readline = sys.stdin.readline
sys.setrecursionlimit(10**8)
mod = 10**9 + 7
# mod = 998244353
INF = 10**18
eps = 10**-7
m, n, k = list(map(int, readline().split()))

def comb(n, r, mod):
    r = min(r, n - r)
    mol = 1
    deno = 1
    for i in range(1, r + 1):
        mol = mol * (n - r + i) % mod
        deno = deno * i % mod
    ret = mol * pow(deno, mod - 2, mod) % mod
    return ret

def f1(x, y, a, b):
    return (a + b - x - y) * (a - x + 1) * (b - y + 1) // 2

def f2(x, a):
    return (a - x) * (a - x + 1) // 2

ans = 0
for x in range(1, n + 1):
    for y in range(1, m + 1):
        a = n - x + 1
        b = m - y + 1
        c = m * (a * (a - 1) + x * (x - 1))
        d = n * (b * (b - 1) + y * (y - 1))
        ans += (c + d) // 2
        ans %= mod
ans = (ans * comb(m * n - 2, k - 2, mod)) % mod
ans = ans * pow(2, mod - 2, mod) % mod
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:

def c_repsept():

    K = int(eval(input()))

    if (K % 2 == 0 or K % 5 == 0):

        return -1  # repsept の因数に 2, 5 はない

    repsept = 7 % K

    count = 1

    while repsept % K !=0:

        repsept = ((repsept * 10) + 7) % K

        count += 1

    return count

print((c_repsept()))

# optimized version of the same code:

def c_repsept():

    K = int(eval(input()))

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

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

        return -1

    remainder = 1

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

        remainder = (10 * remainder) % L

        if remainder == 1:

            return n

    return -1

print((c_repsept()))

def c_repsept():
    K = int(eval(input()))
    if K % 2 == 0 or K % 5 == 0:
        return -1  # repsept の因数に 2, 5 はない
    repsept = 7 % K
    count = 1
    while repsept % K != 0:
        repsept = ((repsept * 10) + 7) % K
        count += 1
    return count

print((c_repsept()))

-        return -1  # repsept の因数に 2, 5 はない

-        repsept = ((repsept * 10) + 7) % K

+        remainder = (10 * remainder) % L


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

from itertools import combinations

import numpy as np

N = int(eval(input()))

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

List = np.array(list(combinations(D,2)))

print((sum(np.product(List, axis = 1))))

# optimized version of the same code:

N = int(eval(input()))

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

from itertools import accumulate

print((sum(list(d*c for d, c in zip(D[1:], accumulate(D))))))

from itertools import combinations
import numpy as np

N = int(eval(input()))
D = list(map(int, input().split()))
List = np.array(list(combinations(D, 2)))
print((sum(np.product(List, axis=1))))

N = int(eval(input()))
D = list(map(int, input().split()))
from itertools import accumulate

print((sum(list(d * c for d, c in zip(D[1:], accumulate(D))))))

-List = np.array(list(combinations(D, 2)))

+print((sum(list(d * c for d, c in zip(D[1:], accumulate(D))))))


Input:
# slower version:

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

# optimized version of the same code:

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

# slower version:

import sys

sys.setrecursionlimit(10**7)

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

n, m = lmi()

l = [0] * (n+1)

l[0] = 1

a = 0

if m != 0:

    a = int(eval(input()))

k = 1

for i in range(n+1):

    if i != a:

        if i == 1:

            l[i] = 1

        elif i >= 2:

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

            l[i] %= 1000000007

    else:

        k += 1

        if k <= m:

            a = int(eval(input()))

#print(l)

print((l[n] % 1000000007))

# optimized version of the same code:

import sys

sys.setrecursionlimit(10**7)

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

n, m = lmi()

a = [1] * (n+1)

for i in range(m):

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

k = [0] * (n+1)

k[0] = 1

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

    if i == 1 and a[1]:

        k[1] = 1

    elif i >= 2 and a[i]:

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

        k[i] %= 10 ** 9 + 7

print((k[n]))

import sys

sys.setrecursionlimit(10**7)

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

n, m = lmi()
l = [0] * (n + 1)
l[0] = 1
a = 0
if m != 0:
    a = int(eval(input()))
k = 1
for i in range(n + 1):
    if i != a:
        if i == 1:
            l[i] = 1
        elif i >= 2:
            l[i] = l[i - 1] + l[i - 2]
            l[i] %= 1000000007
    else:
        k += 1
        if k <= m:
            a = int(eval(input()))
# print(l)
print((l[n] % 1000000007))

import sys

sys.setrecursionlimit(10**7)

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

n, m = lmi()
a = [1] * (n + 1)
for i in range(m):
    a[int(eval(input()))] = 0
k = [0] * (n + 1)
k[0] = 1
for i in range(1, n + 1):
    if i == 1 and a[1]:
        k[1] = 1
    elif i >= 2 and a[i]:
        k[i] = k[i - 1] + k[i - 2]
        k[i] %= 10**9 + 7
print((k[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:

def c_rally():

    import numpy as np

    import math

    N = int(eval(input()))

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

    m = np.average(X)

    ans = float('inf')

    for j in (math.floor(m), math.ceil(m)):

        ans = min(ans, sum([(x - j)**2 for x in X]))

    return ans

print((c_rally()))

# optimized version of the same code:

def c_rally():

    N = int(eval(input()))

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

    x_sum = sum(X)

    option = (x_sum // N, (x_sum + N - 1) // N)

    return min(sum([(x - p)**2 for x in X]) for p in option)

print((c_rally()))

def c_rally():
    import numpy as np
    import math

    N = int(eval(input()))
    X = [int(i) for i in input().split()]
    m = np.average(X)
    ans = float("inf")
    for j in (math.floor(m), math.ceil(m)):
        ans = min(ans, sum([(x - j) ** 2 for x in X]))
    return ans

print((c_rally()))

def c_rally():
    N = int(eval(input()))
    X = [int(i) for i in input().split()]
    x_sum = sum(X)
    option = (x_sum // N, (x_sum + N - 1) // N)
    return min(sum([(x - p) ** 2 for x in X]) for p in option)

print((c_rally()))

-    for j in (math.floor(m), math.ceil(m)):

-        ans = min(ans, sum([(x - j) ** 2 for x in X]))

+    option = (x_sum // N, (x_sum + N - 1) // N)

+    return min(sum([(x - p) ** 2 for x in X]) for p in option)