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

import sys
input = sys.stdin.readline
from collections import defaultdict, Counter
import itertools

mask = (1 << 10) - 1

symmetry = dict()
decode = dict()
counter = defaultdict(int)

def encode(a,b,c,d):
    t = 1 << 40
    for x,y,z,w in [(a,b,c,d), (b,c,d,a), (c,d,a,b), (d,a,b,c)]:
        u = x + (y << 10) + (z << 20) + (w << 30)
        if t > u:
            t = u
    return t

N = int(input())
tiles = []
for _ in range(N):
    a,b,c,d = map(int,input().split())
    t = encode(a,b,c,d)
    tiles.append(t)
    counter[t] += 1
    if a == b == c == d:
        symmetry[t] = 4
    elif a == c and b == d:
        symmetry[t] = 2
    else:
        symmetry[t] = 1
    decode[t] = (a,b,c,d)

P = [(1,n,n*(n-1),n*(n-1)*(n-2),n*(n-1)*(n-2)*(n-3)) for n in range(N+1)]
P += [(0,0,0,0,0)] * (N+1) # 負数代入対策

power = [[n ** e for e in range(5)] for n in range(5)]

answer = 0
for bottom, top in itertools.combinations(tiles,2):
    counter[bottom] -= 1
    counter[top] -= 1
    a,b,c,d = decode[bottom]
    e,f,g,h = decode[top]
    for x,y,z,w in [(e,f,g,h), (f,g,h,e), (g,h,e,f), (h,e,f,g)]:
        # a,b,c,d
        # x,w,z,y 
        tiles = [encode(p,q,r,s) for p,q,r,s in [(b,a,x,w), (c,b,w,z), (d,c,z,y), (a,d,y,x)]]
        need = Counter(tiles)
        x = 1
        for tile, cnt in need.items():
            have = counter[tile]
            if have < cnt:
                x = 0
                break
            x *= P[counter[tile]][cnt] # 残っている個数、必要枚数
            x *= power[symmetry[tile]][cnt]
        answer += x
    counter[bottom] += 1
    counter[top] += 1

# 上下を固定した分
answer //= 3
print(answer)

### FIXED CODE ###

import sys
input = sys.stdin.readline
from collections import Counter
import itertools

mask = (1 << 10) - 1

def encode(a,b,c,d):
    t = 1 << 40
    for x,y,z,w in [(a,b,c,d), (b,c,d,a), (c,d,a,b), (d,a,b,c)]:
        u = x + (y << 10) + (z << 20) + (w << 30)
        if t > u:
            t = u
    return t

def decode(x):
    for _ in range(4):
        yield x & mask
        x >>= 10

def P(n,k):
    x = 1
    for i in range(k):
        x *= (n-i)
    return x

def symmetry(tile):
    a,b,c,d = decode(tile)
    if a == b == c == d:
        return 4
    if a == c and b == d:
        return 2
    return 1

N = int(input())
tiles = []
for _ in range(N):
    a,b,c,d = map(int,input().split())
    tiles.append(encode(a,b,c,d))
counter = Counter(tiles)

counter

answer = 0
for bottom, top in itertools.combinations(tiles,2):
    counter[bottom] -= 1
    counter[top] -= 1
    a,b,c,d = decode(bottom)
    e,f,g,h = decode(top)
    for x,y,z,w in [(e,f,g,h), (f,g,h,e), (g,h,e,f), (h,e,f,g)]:
        # a,b,c,d
        # x,w,z,y 
        tiles = [encode(p,q,r,s) for p,q,r,s in [(b,a,x,w), (c,b,w,z), (d,c,z,y), (a,d,y,x)]]
        need = Counter(tiles)
        x = 1
        for tile, cnt in need.items():
            x *= P(counter[tile],cnt) # 残っている個数、必要枚数
            x *= pow(symmetry(tile), cnt)
        answer += x
    counter[bottom] += 1
    counter[top] += 1

# 上下を固定した分
answer //= 3
print(answer)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

H,W = (int(x) for x in input().split())
S = [list(input()) for _ in range(H)]
mem = [[[0,0] for _ in range(W)] for _ in range(H)]
ans = [[0] * W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            if mem[i][j][0]:
                h = mem[i][j][0]
            else:
                stopped = False
                for k in range(W-j-1):
                    if S[i][j+k+1] == '#':
                        for l in range(k+1):
                            mem[i][j+l][0] = k+1
                        stopped = True
                        break
                if stopped == False:
                    for l in range(W-j):
                        mem[i][j+l][0] = W-j
                h = mem[i][j][0]
            if mem[i][j][1]:
                v = mem[i][j][1]
            else:
                stopped = False
                for k in range(H-i-1):
                    if S[i+k+1][j] == '#':
                        for l in range(k+1):
                            mem[i+l][j][1] = k+1
                        stopped = True
                        break
                if stopped == False:
                    for l in range(H-i):
                        mem[i+l][j][1] = H-i
                v = mem[i][j][1]
            ans[i][j] = h + v - 1
print(max(sum(ans,[])))

### FIXED CODE ###

import sys
input = sys.stdin.readline

H,W = (int(x) for x in input().split())
S = [list(input()) for _ in range(H)]
memh = [[0] * W for _ in range(H)]
memv = [[0] * W for _ in range(H)]
ans = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == '.':
            h = memh[i][j]
            if h == 0:
                stopped = False
                for k in range(W-j-1):
                    if S[i][j+k+1] == '#':
                        for l in range(k+1):
                            memh[i][j+l] = k+1
                        stopped = True
                        break
                if stopped == False:
                    for l in range(W-j):
                        memh[i][j+l] = W-j
                h = memh[i][j]
            v = memv[i][j]
            if v == 0:
                stopped = False
                for k in range(H-i-1):
                    if S[i+k+1][j] == '#':
                        for l in range(k+1):
                            memv[i+l][j] = k+1
                        stopped = True
                        break
                if stopped == False:
                    for l in range(H-i):
                        memv[i+l][j] = H-i
                v = memv[i][j]
            ans = max(ans,h+v-1)
print(ans)
### BUGGY CODE ###

k=int(input())
n=7
i=1
x=7%k
if k==1 or k==7:
  print(1)
else:
  while i>=0:
    n=n*10+7
    n=n%k
    i+=1
    if n==0:
      print(i)
      break
    if n==x:
      print(-1)
      break 

### FIXED CODE ###

k=int(input())
n=0
for i in range(1,k+1):
  n=n*10+7
  n=n%k
  if n==0:
    print(i)
    exit()
print(-1)
### BUGGY CODE ###

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

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

for i in range(m):
    l, r, d = list(map(int, input().split()))
    graph[l-1].append([r-1, d])
    graph[r-1].append([l-1, -d])



def func():
    visited = [False for i in range(n)]
    x = [None for i in range(n)]
    for i in range(n):
        if visited[i] == False:
            q = [i]
        while q:
            j = q.pop()
            visited[j] = True
            if x[j] == None:
                x[j] = 0
            for k, d in graph[j]:
                if visited[k] == False:
                    q.append(k)
                if x[k] == None:
                    x[k] = x[j] + d
                elif x[k] != x[j] + d:
                    return False
    return True

if func():
    print('Yes')
else:
    print('No')

### FIXED CODE ###

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

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

for i in range(m):
    l, r, d = list(map(int, input().split()))
    graph[l-1].append([r-1, d])
    graph[r-1].append([l-1, -d])



def func():
    x = [None for i in range(n)]
    for i in range(n):
        if x[i] == None:
            x[i] = 0
            q = [i]
        while q:
            j = q.pop()
            for k, d in graph[j]:
                if x[k] == None:
                    q.append(k)
                    x[k] = x[j] + d
                elif x[k] != x[j] + d:
                    return False
    return True

if func():
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

from collections import deque, Counter, defaultdict
import itertools

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

d_h = deque()
d_w = deque()

dic = defaultdict(list)

for h, w in HW:
    d_h.append(h)
    d_w.append(w)
    dic[h].append(w)

# 出現頻度順にソート
c_h = Counter(d_h).most_common()
c_w = Counter(d_w).most_common()

# 登場頻度の一番高い回数
n_h = c_h[0][1]
n_w = c_w[0][1]

# 同率のものを数える
t_h = deque()
t_w = deque()

for k, v in c_h:
    if v == n_h:
        t_h.append(k)
    else:
        break

for k, v in c_w:
    if v == n_w:
        t_w.append(k)
    else:
        break


nn = len(t_h) * len(t_w)

ans = n_h + n_w
if nn <= M:
    q = set(list(itertools.product(t_h, t_w)))
    for h, w in q:
        if w not in dic[h]:
            break
    else:
        ans -= 1

print(ans)



### FIXED CODE ###

import itertools

import numpy as np


def main():
    H, W, M = map(int, input().split())
    HW = [list(map(int, input().split())) for _ in range(M)]

    A = np.zeros(H, dtype=np.int64)
    B = np.zeros(W, dtype=np.int64)

    for h, w in HW:
        A[h - 1] += 1
        B[w - 1] += 1

    maxA = np.max(A)
    maxB = np.max(B)

    # 最大値を取るindex
    ind_A = np.arange(H)[A == maxA]
    ind_B = np.arange(W)[B == maxB]

    # 解の候補の数
    nn = len(ind_A) * len(ind_B)

    # Mより候補の数のほうが多いとok
    # 少ないときはM以下なので可算
    ans = maxA + maxB

    if nn <= M:
        for h, w in HW:
            if A[h - 1] == maxA and B[w - 1] == maxB:
                nn -= 1

    print(ans if nn else ans - 1)


main()
### BUGGY CODE ###

a, b = map(int, input().split())
import fractions
n = fractions.gcd(a, b)
devide = 2
l1 = []
while devide <= n:
    while n % devide == 0:
        n = n / devide
        l1.append(devide)
    devide += 1
l1 = list(set(l1))
print(int(len(l1) + 1))

### FIXED CODE ###

a, b = map(int, input().split())
import math
import fractions
n = fractions.gcd(a, b)
devide = 2
l1 = []
while devide <= math.sqrt(n):
    while n % devide == 0:
        n = n / devide
        l1.append(devide)
    devide += 1
l1.append(n)
l1 = list(set(l1))
if n == 1:
    print(int(len(l1)))
else:
    print(int(len(l1) + 1))
### BUGGY CODE ###

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

if c // 2 >= s:
    while c // 2 > s:
        c -= 2
        s += 1
    print(min((c//2),s))
else:
    print(min((c//2),s))

### FIXED CODE ###

s, c = [int(i) for i in input().split()]

if c // 2 >= s:
    a = s + ((c - (s*2))//4)
    print(a)
else:
    a = (c//2)
    print(a)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N, K, Q = [int(value) for value in input().split(' ')]
A = [int(input()) for _ in range(Q)]

for i in range(N):
    if K - Q + A.count(i + 1) > 0:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

import sys
input = sys.stdin.readline
N, K, Q = [int(value) for value in input().split(' ')]
A = [int(input()) for _ in range(Q)]

points = [K - Q] * N

for value in A:
    points[value - 1] += 1

for point in points:
    if point <= 0:
        print('No')
    else:
        print('Yes')
### BUGGY CODE ###

import sys
imput=sys.stdin.readline

class WarshallFloyd():
    def __init__(self, N):
        self.N = N
        self.d = [[float("inf") for i in range(N)]
                  for i in range(N)]  # d[u][v] : 辺uvのコスト(存在しないときはinf)

    def add(self, u, v, c, directed=False):
        """
        0-indexedであることに注意
        u = from, v = to, c = cost
        directed = Trueなら、有向グラフである
        """
        if directed is False:
            self.d[u][v] = c
            self.d[v][u] = c
        else:
            self.d[u][v] = c

    def WarshallFloyd_search(self):
        # これを d[i][j]: iからjへの最短距離 にする
        # 本来無向グラフでのみ全域木を考えるが、二重辺なら有向でも行けそう
        # d[i][i] < 0 なら、グラフは負のサイクルを持つ
        for k in range(self.N):
            for i in range(self.N):
                for j in range(self.N):
                    self.d[i][j] = min(
                        self.d[i][j], self.d[i][k] + self.d[k][j])
        hasNegativeCycle = False
        for i in range(self.N):
            if self.d[i][i] < 0:
                hasNegativeCycle = True
                break
        for i in range(self.N):
            self.d[i][i] = 0
        return hasNegativeCycle, self.d


n,m,l=map(int,input().split())
ABC=[list(map(int, input().split())) for i in range(m)]
q=int(input())
st=[list(map(int, input().split())) for i in range(q)]

graph=WarshallFloyd(n)
graph2=WarshallFloyd(n)
for a,b,c in ABC:
    graph.add(a-1,b-1,c)
hasNegativeCycle, d = graph.WarshallFloyd_search()
#ans = sorted([[i, max(d[i])] for i in range(n)], key=lambda x: x[0])
ans=graph.WarshallFloyd_search()
#print(ans)

for i in range(n):
    for j in range(n):
        if ans[1][i][j]<=l:
            graph2.add(i,j,1)
        else:
            graph2.add(i,j,float('inf'))
ans1=graph2.WarshallFloyd_search()
#print(ans1)
for i,j in st:
    if ans1[1][i-1][j-1]-1!=float('inf'):
        print(ans1[1][i-1][j-1]-1)
    else:
        print(-1)

### FIXED CODE ###

def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d


n,m,l= map(int,input().split()) #n:頂点数　w:辺の数

d=[[float("inf") for i in range(n)] for i in range(n)] 
#d[u][v] : 辺uvのコスト(存在しないときはinf)
for i in range(m):
    a,b,c = map(int,input().split())
    d[a-1][b-1]=c
    d[b-1][a-1]=c
for i in range(n):
    d[i][i] = 0 #自身のところに行くコストは０
warshall_floyd(d)

d2=[[float("inf") for i in range(n)] for i in range(n)] 
for i in range(n):
    for j in range(n):
        if d[i-1][j-1]<=l:
            d2[i-1][j-1]=1
            d2[j-1][i-1]=1
warshall_floyd(d2)
q=int(input())
l=[list(map(int, input().split())) for i in range(q)]
for i in range(q):
    if d2[l[i][0]-1][l[i][1]-1]-1!=float('inf'):
        print(d2[l[i][0]-1][l[i][1]-1]-1)
    else:
        print(-1)
### BUGGY CODE ###

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

count=0

for i in range(N):
    for j in range(N):

        if arr[0][i]<arr[1][j]:
            for k in range(N):

                if arr[1][j]<arr[2][k]:
                    count+=1

print(count)
                

### FIXED CODE ###

N=int(input())
A,B,C=[list(sorted(map(int,input().split()))) for i in range(3)]

count=0

def bs_l(lis,x):
    low,high=0,len(lis)
    while low<high:
        mid=(low+high)//2
        if lis[mid]<x:
            low=mid+1
        else:
            high=mid
    return low        

def bs_r(lis,x):
    low,high=0,len(lis)
    while low<high:
        mid=(low+high)//2
        if lis[mid]>x:
            high=mid
        else:
            low=mid+1
    return low        

for i in B:
    count+=bs_l(A,i)*(N-bs_r(C,i))


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

def resolve(SL):
    # L[0]!=0を起点とする
    cnt = 0
    for i in range(len(SL)-1):
        s0 = SL[i]
        s1 = SL[i+1]
        if(s0>0 and s1>=0):
            SL[(i+1):] = [s-(s1+1) for s in SL[(i+1):]]
            cnt += (s1+1)
        elif(s0<0 and s1<=0):
            SL[(i+1):] = [s+(-s1+1) for s in SL[(i+1):]]
            cnt += (-s1+1)  
    return cnt
            
def ans(L):
#     SL = [sum(L[:(i+1)]) for i in range(len(L))]
    a = L[0]
    c0,c1=0,0
    SL = []
    s = 0
    for i,l in enumerate(L):
        s += L[i]
        SL.append(s)

    if (a>0):
        c0 = resolve(SL)
        c1 = (a+1) + resolve(list(map(lambda x:x-(a+1), SL)))
    elif (a<0):
        c0 = resolve(SL)
        c1 = (-a+1) + resolve(list(map(lambda x:x+(-a+1), SL)))
    else:
        c0 = 1 + resolve(list(map(lambda x:x+1, SL)))
        c1 = 1 + resolve(list(map(lambda x:x-1, SL)))
    
    return(min(c0,c1))
  
N = int(input())
L = [int(x) for x in input().split(' ')]

print(ans(L))


### FIXED CODE ###

import copy 

def resolve(List):
    # L[0]!=0を起点とする
    L = copy.deepcopy(List)
    cnt = 0
    s = L[0]
    for i in range(1,len(L)):
        a = L[i]
        if(s>0 and s+a>=0):
            L[i] = -s-1
            cnt += (s+a+1)
            s = -1
        elif(s<0 and s+a<=0):
            L[i] = -s+1
            cnt += (-s-a+1)
            s = 1
        else:
            s += a
    return cnt      

def ans(List):
    L = copy.deepcopy(List)
    a = L[0]
    c0,c1=0,0

    if (a>0):
        c0 = resolve(L)
        c1 = (a+1) + resolve([-1]+L[1:])
    elif (a<0):
        c0 = resolve(L)
        c1 = (-a+1) + resolve([1]+L[1:])
    else:
        c0 = 1 + resolve([1]+L[1:])
        c1 = 1 + resolve([-1]+L[1:])
    
    return(min(c0,c1))

def main():
    N = int(input())
    List = [int(x) for x in input().split(' ')]
    print(ans(List))

main()
### BUGGY CODE ###

import math

n = input()
 
a = list(map(int, input().split()))
 
total = 1
 
for i in a:
	total *= i
 
if total > math.pow(10, 18):
	total = -1
 
print(total)

### FIXED CODE ###

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

total = 1
li.sort()
for a in li:
    if a == 0:
        total = 0
        break
    total *= a
    if 10 ** 18 < total:
        total = -1
        break
print(total)
### BUGGY CODE ###

n = int(input())
s = [input() for _ in range(n)]
ans = {}
count = []
max_list =[]
for item in s:
    count_i = s.count(item)
    count.append(count_i)

for i in range(n):
    if count[i] == max(count) and not (s[i] in max_list):
        max_list.append(s[i])

max_list.sort()
for item in max_list:
    print(item)

### FIXED CODE ###

from collections import Counter
n = int(input())
s = [input() for _ in range(n)]
c = Counter(s)
ans = []
max_values = max(c.values())

for k in c.keys():
    if c[k] == max_values:
        ans.append(k)

ans = sorted(ans)
for item in ans:
    print(item)
### BUGGY CODE ###

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

for i in range(a, b+1):
    if (a <= i and i < a+k) or (b-k < i and i <= b):
        print(i)


### FIXED CODE ###

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

if 2*k < b-a:
    for i in range(a, a+k):
        print(i)
    for i in range(b-k+1, b+1):
        print(i)
else:
    for i in range(a, b+1):
        if (a <= i and i < a+k) or (b-k < i and i <= b):
            print(i)
### BUGGY CODE ###

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

l = list(range(1, n+1))
divider = 10**9 + 7
ans = [0]*(n + 1)
ans[0] = 1
ans[1] = 1

for i in range(m):
    inp = int(input())
    l.remove(inp)
    if inp == 1:
        ans[1] = 0

if 1 in l:
    l.remove(1)

for i in l:
    ans[i] = ans[i-1] + ans[i-2]
    
   
print(ans[n] % divider)

### FIXED CODE ###

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

l = list(range(1, n+1))
divider = 10**9 + 7
ans = [0]*(n + 1)
broken = [False]*(n+1)
ans[0] = 1
ans[1] = 1

for i in range(m):
    a = int(input())
    broken[a] = True
    if a == 1:
        ans[1] = 0
    
for i in range(2,n+1):
    if broken[i] == False:
        ans[i] = ans[i-1] + ans[i-2]
    
   
print(ans[n] % divider)
### BUGGY CODE ###

import sys
from collections import Counter
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    S = input()
    L = len(S)
    amari = [0] * 2019
    for i in range(L):
        amari[int(S[i:])%2019] += 1
    ans = amari[0]
    for i in range(2019):
        ans += amari[i]*(amari[i]-1)//2
    print(ans)



if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.buffer.readline

INF = float('inf')


def main():
    s = map(int, input()[::-1])
    mod = 2019
    counts = [0] * mod
    counts[0] = 1
    t = 0
    x = 1
    for num in s:
        t = (t + num * x) % mod
        counts[t] += 1
        x = (x * 10) % mod
    ans = 0
    for count in counts:
        if count > 1:
            ans += count * (count - 1) // 2
    print(ans)


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

import sys
input = sys.stdin.readline
def prison():
    N, M = map(int, input().split())
    id_l = set(range(1, N+1))
    for _ in range(M):
        L, R = map(int, input().split())
        id_l = id_l & set(range(L, R+1))
    return len(id_l)


print(prison())

### FIXED CODE ###

def prison():
    N, M = (int(i) for i in input().split())
    L_max = 0
    R_min = float("inf")
    for _ in range(M):
        L, R = (int(i) for i in input().split())
        L_max = max(L, L_max)
        R_min = min(R, R_min)
        result = max(R_min - L_max + 1, 0)
    return result


print(prison())
### BUGGY CODE ###

N, M = map(int, input().split())
ans = 1
for i in range(M//N, 0, -1):
	if M%i == 0:
		ans = i
		break

print(ans)


### FIXED CODE ###

N, M = map(int, input().split())
d = []
for i in range(1, int(M**0.5)+1):
	if M%i == 0:
		d.append(i)
		d.append(M//i)
d.sort()
for i in range(1,len(d)+1):
	if d[-i] <= M//N:
		print(d[-i])
		exit()
### BUGGY CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    dic = {}
    for v in a:
        if v in dic:
            dic[v] += 1
        else:
            dic[v] = 1
    key = [v for v in dic.keys()]
    key.sort(reverse=True)
    ans = 0
    for v in key:
        num = dic[v]
        if num > 0:
            for i in reversed(range(1, 35)):
                target = 2**i
                if 2*v < target or target < v:
                    continue
                u = target - v
                if v == u:
                    z = dic[v]//2
                    ans += z
                    dic[v] -= 2*z
                elif u in dic:
                    x, y = dic[v], dic[u]
                    z = 0
                    if x < y:
                        z = x
                    else:
                        z = y
                    dic[v] -= z
                    dic[u] -= z
                    ans += z
                if dic[v] == 0:
                    break
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    dic = {}
    for v in a:
        if v in dic:
            dic[v] += 1
        else:
            dic[v] = 1
    key = [v for v in dic.keys()]
    key.sort(reverse=True)
    ans = 0
    for v in key:
        num = dic[v]
        if num > 0:
            for i in reversed(range(1, 32)):
                target = 2**i
                if 2*v < target:
                    continue
                if target < v:
                    break
                u = target - v
                if v == u:
                    z = dic[v]//2
                    ans += z
                    dic[v] -= 2*z
                elif u in dic:
                    x, y = dic[v], dic[u]
                    z = 0
                    if x < y:
                        z = x
                    else:
                        z = y
                    dic[v] -= z
                    dic[u] -= z
                    ans += z
                if dic[v] == 0:
                    break
    print(ans)

if __name__ == "__main__":
    main()