Harryxun/stf_run huggingface dataset:
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)

nums = {}
nums[1] = 2
nums[2] = 5
nums[3] = 5
nums[4] = 4
nums[5] = 5
nums[6] = 6
nums[7] = 3
nums[8] = 7
nums[9] = 6

dp = [-float('inf')]*(N+1)
dp[0] = 0

for i in range(N+1):
    for a in A:
        if i-nums[a] >= 0:
            dp[i] = max(dp[i], dp[i-nums[a]]+1)

ans = ""
i = N
while i > 0:
    for a in A:
        if dp[i]-1 == dp[i-nums[a]]:
            ans += str(a)
            i = i-nums[a]
            break
print(ans)


### FIXED CODE ###

# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = map(int, input().split())
A = list(map(int, input().split()))
A = sorted(A, reverse=True)

nums = {}
nums[1] = 2
nums[2] = 5
nums[3] = 5
nums[4] = 4
nums[5] = 5
nums[6] = 6
nums[7] = 3
nums[8] = 7
nums[9] = 6

dp = [-float('inf')]*(N+1)
dp[0] = 0

for i in range(N+1):
    for a in A:
        if i-nums[a] >= 0:
            dp[i] = max(dp[i], dp[i-nums[a]]+1)

ans = ""
i = N
while i > 0:
    for a in A:
        if i >= nums[a] and dp[i]-1 == dp[i-nums[a]]:
            ans += str(a)
            i = i-nums[a]
            break
print(ans)
from sys import stdin, stdout
from collections import defaultdict
def readLine_int_list():return list(map(int, stdin.readline().split()))
def readLine_int_list_reverse(): return list(map(int, stdin.readline().split())).reverse()
def readAll_int(): return list(map(int, stdin))
def readLine_str_list():return list(map(str, stdin.readline().split()))
def readAll_str(): return list(map(str, stdin))

import re

def main():
	_s = input()
	t = input()
	pattern=""
	for i in t:
	    pattern += "[?{}]".format(i)

	ans = ""
	f = False
	for i in range(len(_s)):
	    if _s[i] == '?' or _s[i] == t[0]:
	        tmp = _s[i:i+len(t)]
	        match = re.match(pattern , tmp)
	        if match:
	            f = True
	            ans += 'X'
	        else:
	            ans += 'a'
	    else:
	        ans += _s[i]
	
	
	for i in range(len(ans)):
	    if ans[i] == "X":
	       _ans = [_ for _ in ans]
	       _ans[i:i+len(t)] = t
	       for i in range(len(_ans)):
	           if _ans[i] == "X":
	               _ans[i] = 'a'
	       
	ans = ''.join(_ans)
	if f:
	    print(ans)
	else:
	    print("UNRESTORABLE")
	    
if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin, stdout
from collections import defaultdict
def readLine_int_list():return list(map(int, stdin.readline().split()))
def readLine_int_list_reverse(): return list(map(int, stdin.readline().split())).reverse()
def readAll_int(): return list(map(int, stdin))
def readLine_str_list():return list(map(str, stdin.readline().split()))
def readAll_str(): return list(map(str, stdin))

import re

def main():
	_s = input()
	t = input()
	pattern=""
	for i in t:
	    pattern += "[?{}]".format(i)
	l=[]
	ans = ""
	f = False
	ff = False
	for i in range(len(_s)):
	    if _s[i] == '?' or _s[i] == t[0]:
	        tmp = _s[i:i+len(t)]
	        match = re.match(pattern , tmp)
	        if match:
	            f = True
	            if _s[i] == t:
	                ans += _s[i]
	                ff = True
	            else:
	                ans += 'X'
	        else:
	            ans += 'a'
	    else:
	        ans += _s[i]
	    
# 	print(ans)
	for i in range(len(ans)):
	    if ans[i] == "X":
	       _ans = [_ for _ in ans]
	       
	       if ff:
	           l.append(''.join(_ans).replace("X","a"))
	       else:
	           _ans[i:i+len(t)] = t
	           for i in range(len(_ans)):
	               if _s[i] != '?':
	                   _ans[i] = _s[i]
	           l.append(''.join(_ans).replace("X","a"))
	       
	if f:
	    ans = ''.join(min(l))
	    print(ans)
	else:
	    print("UNRESTORABLE")
	    
if __name__ == "__main__":
    main()
n = int(input())
a = {i+1:int(input()) for i in range(n)}

def find(ad, nexti, cnt, s):
    cnt += 1
    s.add(nexti)
    if ad[nexti] == 2:
        return cnt
    elif ad[nexti] in s:
        return -1
    else:
        return find(ad, ad[nexti], cnt, s)

print(find(a, 1, 0, set()))


### FIXED CODE ###

n = int(input())
a = {i+1:int(input()) for i in range(n)}
nexti = 1
for i in range(n):
    if a[nexti] == 2:
        print(i+1)
        exit()
    nexti = a[nexti]
print(-1)
import sys
from collections import deque
sys.setrecursionlimit(10 ** 5)
input = sys.stdin.readline


def main():
    N, Q = map(int, input().split())
    ans = deque([0] * N)
    con = deque([[] for _ in range(N)])

    for _ in range(N - 1):
        p, c = map(int, input().split())
        con[p-1].append(c-1)
        con[c-1].append(p-1)

    for _ in range(Q):
        p, v = map(int, input().split())
        ans[p-1] += v

    stacks = deque()
    stacks.append((0, -1))

    while stacks:
        stack = stacks.pop()
        node, parent = stack[0], stack[1]

        children = con[node]
        for child in children:
            if child == parent:
                continue
            ans[child] += ans[node]
            stacks.append((child, node))

    print(*ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

n = int(input())
s = input()

if n >= 3200:
  print(s)
else:
  print('red')
N,Q = map(int,input().split())
T = [[] for i in range(N+1)]
V = [0]*(N+1)
for _ in range(N-1):
    a,b = map(int,input().split())
    T[a].append(b)
    T[b].append(a)
for _ in range(Q):
    p,x = map(int,input().split())
    V[p]+=x
def f(v,p):
    global T,V
    for c in T[v]:
        if c==p:continue
        V[c]+=V[v]
        f(c,v)
f(1,0)
print(*V[1:])

### FIXED CODE ###

N,Q = map(int,input().split())
T = [0]*(N+1)
V = [0]*(N+1)
for _ in range(N-1):
    a,b = map(int,input().split())
    T[b] = a
for _ in range(Q):
    p,x = map(int,input().split())
    V[p]+=x
for i in range(1,N+1):
    V[i]+=V[T[i]]
print(*V[1:])
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    n, x = map(int, input().split())
    l = list(map(int, input().split()))
    l.insert(0, 0)

    num = 0
    sum = 0
    while sum + l[num] <= x:
        sum += l[num]
        num += 1

    print(num)


### FIXED CODE ###

import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    n, x = map(int, input().split())
    llist = list(map(int, input().split()))
    llist.insert(0, 0)

    res = 0
    sum = 0
    for l in llist:
        if (sum + l) <= x:
            res += 1
            sum += l
        else:
            break
    
    print(res)
import math

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

n=math.gcd(a,b)
ans=[]
for i in range(1,n+1):
    if n%int(i)==0:
        ans.append(i)

ans1=ans[::-1]

print(ans1[k-1])

### FIXED CODE ###

a,b,k=map(int,input().split())
A=set()
for i in range(1,a+1):
    if a%i==0:
        A.add(i)
B=set()
for j in range(1,b+1):
    if b%j==0:
        B.add(j)
ans=A & B
ans2=list(ans)
ans3=sorted(ans2, reverse=True)
#print(ans3)
print(ans3[k-1])
from math import factorial
N,K = map(int, input().split())
mod = 10**9 + 7
for i in range(1,K+1):
    try:
        comb = int(factorial(K-1) / factorial(i-1) / factorial(K-i))
    except ValueError:
        comb = 1
    try:
        sec = int(factorial(N-K+1) / factorial(N-K-i+1) / factorial(i))
    except ValueError:
        sec = 1
    print((comb * sec)%mod)

### FIXED CODE ###

from math import factorial
N,K = map(int, input().split())
mod = 10**9 + 7
def com(n,r):
    if n<r:
        return 0
    return int(factorial(n) // factorial(r) // factorial(n-r))
for i in range(1,K+1):
    comb = com(N-K+1,i)
    sec = com(K-1,i-1)
    print((comb * sec)%mod)
N = int(input())
for k in range(1,7):
    if(N < 2**k):
        ans = 2**(k-1)
        break

print(ans)

### FIXED CODE ###

N = int(input())
for k in range(1,8):
    if(N < 2**k):
        ans = 2**(k-1)
        break

print(ans)
n = int(input())
k = int(input())

print(k*(k-1)**(n-1))

### FIXED CODE ###

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


print(k*(k-1)**(n-1))
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
c=[list(map(int,input().split())) for _ in range(m)]
ans=[[] for _ in range(n)]
for i in range(n):
  for j in range(n):
    p,q=a[i]
    r,s=c[j]
    d=abs(p-r)+abs(q-s)
    ans[i].append((d,j+1))
  ans[i]=sorted(ans[i])
for i in ans:
  print(ans[0][1])

### FIXED CODE ###

n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
c=[list(map(int,input().split())) for _ in range(m)]
ans=[[] for _ in range(n)]
for i in range(n):
  p,q=a[i]
  for j in range(m):
    r,s=c[j]
    d=abs(p-r)+abs(q-s)
    ans[i].append((d,j+1))
  ans[i]=sorted(ans[i])
for i in ans:
  print(i[0][1])
x1, y1, x2, y2 = (int(i) for i in input().split())
x_range = x2 - x1
y_range = y2 - y1

distance = pow(pow(x_range, 2) + pow(y_range, 2), 1/2)

print(distance)

### FIXED CODE ###


x1, y1, x2, y2 = (float(i) for i in input().split())
x_range = x2 - x1
y_range = y2 - y1

distance = pow(pow(x_range, 2) + pow(y_range, 2), 1/2)

print(distance)
S = input()

a = S[0]
a_count = 0
b_count = 0

for i in S:
    if i==a:
        a_count += 1
    else:
        b = i
for i in S:
    if i==b:
        b_count +=1

if a_count == 2 and b_count == 2:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

S = input()

a = S[0]
b = 'b'
a_count = 0
b_count = 0

for i in S:
    if i==a:
        a_count += 1
    else:
        b = i
for i in S:
    if i==b:
        b_count +=1

if a_count == 2 and b_count == 2:
    print('Yes')
else:
    print('No')
#!/usr/bin/env python
# -*- coding: utf-8 -*-

# AGC028：A - Two Abbreviations
import numpy as np


def main():
    n, m = [int(i) for i in raw_input().strip().split(' ')]
    s = raw_input().strip()
    t = raw_input().strip()
    l = np.lcm(n, m) # 45
    n1 = l/n # 45/15 = 3
    m1 = l/m # 45/9 = 5
    l1 = np.lcm(n1, m1) # lcm(3, 5) = 15

    # d  n  s  u  s  r  a  y  u  k  u  a  i  i  a  
    # d    u    j    r    u    n    u    m    a    
    for i in range(l/l1):
        if s[i*m1] != t[i*n1]:
            print '-1'
            return
    print str(l)


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

# AGC028：A - Two Abbreviations
# import numpy as np
import fractions
def lcm(a,b): return abs(a * b) / fractions.gcd(a,b) if a and b else 0

def main():
    n, m = [int(i) for i in raw_input().strip().split(' ')]
    s = raw_input().strip()
    t = raw_input().strip()
    # l = np.lcm(n, m) # 45
    l = lcm(n, m) # 45
    n1 = l/n # 45/15 = 3
    m1 = l/m # 45/9 = 5
    # l1 = np.lcm(n1, m1) # lcm(3, 5) = 15
    l1 = lcm(n1, m1) # lcm(3, 5) = 15

    # d  n  s  u  s  r  a  y  u  k  u  a  i  i  a  
    # d    u    j    r    u    n    u    m    a    
    for i in range(l/l1):
        if s[i*m1] != t[i*n1]:
            print '-1'
            return
    print str(l)


if __name__ == '__main__':
    main()
# coding: utf-8
# Your code here!
import math
h,n = map(int, input().split())
aa = [None]
bb = [None]
mp = []
for _ in range(h + 1):
  	mpp = []
	for __ in range(n+1):
      mpp.append(None)
    mp.append(mpp)
# 体力i 技の種類j
for j in range(1, n+1):
  a, b = map(int, input().split())
  aa.append(a)
  bb.append(b)

for i in range(1, h+1):
    mp[i][0] = float("inf")
for j in range(1, n+1):
    for i in range(1, h+1):
        if i - aa[j] >= 1:
          # print(i, j, i - aa[j])
          mp[i][j] = min(mp[i][j-1], mp[i - aa[j]][j] + bb[j])
        else:
          mp[i][j] = min(mp[i][j-1], bb[j])
print(mp[h][n])

### FIXED CODE ###

# coding: utf-8
# Your code here!
def main():
    import math
    h,n = map(int, input().split())
    aa = [0]*(n+1)
    bb = [0]*(n+1)
    mp = [[None for _ in range(n+1)] for _ in range(h+1)]
    # 体力i 技の種類j
    for j in range(1, n+1):
      mp[0][j] = 0
      aa[j], bb[j] = map(int, input().split())
    for i in range(1, h+1):
        mp[i][0] = float("inf")
    for j in range(1, n+1):
        for i in range(1, h+1):
        	mp[i][j] = min(mp[i][j-1], mp[max(0, i - aa[j])][j] + bb[j])
    print(mp[h][n])

if __name__ == '__main__':
    main()
# -*- Coding: utf-8 -*-
N, X = map(int, input().split())
L = list(map(int,input().split()))

index = 0
Sum = L[0]
while Sum <= X:
    Sum += L[index+1]
    index += 1

print(index+1) 



### FIXED CODE ###

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

ans = 1 #位置0も1にカウントするから
p = 0 #今のポジション
for i in range(N):
    p += L[i]
    if p <= X:
         ans += 1
    else:
        break

print(ans)
N, Y = map(int, input().aplit())
boolean = False
for i in range(N+1):
    for j in range(N+1-i):
        if (Y - 10000 * i + 5000 * j) // 1000 == (N - i - j):
            boolean = True
            break

if boolean:
    print(i, j, N - i - j)
else:
    print(-1, -1, -1)

### FIXED CODE ###

N, Y = map(int, input().split())
boolean = False
for i in range(N+1):
    if boolean:
        break
    for j in range(N+1-i):
        if (Y - 10000 * i - 5000 * j) / 1000 == (N - i - j):
            boolean = True
            print(i, j, N - i - j)
            break

if not boolean:
    print(-1, -1, -1)
def PoorOrNot(number_list):
  number_dict = {}
  for num in number_list:
    if num not in number_dict:
      number_dict[num] = 1
  if len(number_dict) == 2:
    return "Yes"
  else:
    return "No"
  
number_list = list[map(int, input().split())]
print (PooeOrNot(number_list))

### FIXED CODE ###

def PoorOrNot(number_list):
  number_dict = {}
  for num in number_list:
    if num not in number_dict:
      number_dict[num] = 1
  if len(number_dict) == 2:
    return "Yes"
  else:
    return "No"
  
number_list = list(map(int, input().split()))
print (PoorOrNot(number_list))
n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
s = 0
for x in B:
    s += x
for i in range(n-1):
    if A[i+1]-A[i]==1:
        s += C[A[i]]
print(s)

### FIXED CODE ###

n = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
s = 0
for x in B:
    s += x
for i in range(n-1):
    if A[i+1]-A[i]==1:
        s += C[A[i]-1]
print(s)
import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
N, M, S, T = [int(_) for _ in input().split()]
UVAB = [[int(_) for _ in input().split()] for _ in range(M)]
G1 = [[0] * N for _ in range(N)]
G2 = [[0] * N for _ in range(N)]

for u, v, a, b in UVAB:
    u -= 1
    v -= 1
    G1[u][v] = G1[v][u] = a
    G2[u][v] = G2[v][u] = b


def dijkstra(V, G, i):
    INF = float('inf')

    H = []
    d = 0
    D = [INF] * V
    D[i] = 0
    used = [False] * V
    used[i] = True

    while True:
        for j in G[i].keys():
            heapq.heappush(H, (d + G[i][j], j))
        v = -1
        while H:
            d, j = heapq.heappop(H)
            if not used[j]:
                v = j
                break
        if v == -1:
            break
        else:
            used[v] = True
            D[v] = d
            i = v
    return D


D1 = dijkstra(N, G1, S - 1)
D2 = dijkstra(N, G2, T - 1)

D = [10**15 - sum(_) for _ in zip(D1, D2)]
for i in range(N - 1, 0, -1):
    D[i - 1] = max(D[i - 1], D[i])
print(*D, sep='\n')


### FIXED CODE ###

import math, string, itertools, fractions, collections, re, array, bisect, sys, random, time, copy, functools
from heapq import heappush, heappop, heappushpop, heapify, heapreplace
input = sys.stdin.readline

N, M, S, T = [int(_) for _ in input().split()]
UVAB = [[int(_) for _ in input().split()] for _ in range(M)]
G1 = collections.defaultdict(lambda: collections.defaultdict(int))
G2 = collections.defaultdict(lambda: collections.defaultdict(int))

for u, v, a, b in UVAB:
    u -= 1
    v -= 1
    G1[u][v] = G1[v][u] = a
    G2[u][v] = G2[v][u] = b


def dijkstra(V, G, start):
    INF = float('inf')
    D = [INF for _ in range(V)]
    D[start] = 0
    H = [(0, start)]
    while H:
        du, u = heappop(H)
        if D[u] < du:
            continue
        for v, d in G[u].items():
            if D[v] > du + d:
                D[v] = du + d
                heappush(H, (D[v], v))
    return D


D1 = dijkstra(N, G1, S - 1)
D2 = dijkstra(N, G2, T - 1)

D = [10**15 - sum(_) for _ in zip(D1, D2)]
for i in range(N - 1, 0, -1):
    D[i - 1] = max(D[i - 1], D[i])
print(*D, sep='\n')
from math import gcd
N , X = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [abs(x[i]-X) for i in range(N)]
res = y[0]
for i in range(1,N):
    res = gcd(res,y[i])
print(res)


### FIXED CODE ###

from fractions import gcd
N , X = [int(i) for i in input().split()]
x = [int(i) for i in input().split()]
y = [abs(x[i]-X) for i in range(N)]
res = y[0]
for i in range(1,N):
    res = gcd(res,y[i])
print(res)
friend_dic = {}
block_dic = {}
cluster_size = {}

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

for i in range(N):
    friend_dic[i+1] = 0
    block_dic[i+1] = 0
    cluster_size[i+1] = 0

for _ in range(M):
    a, b = map(int, input().split())
    friend_dic[a] += 1
    friend_dic[b] += 1

for _ in range(K):
    a, b = map(int, input().split())
    block_dic[a] += 1
    block_dic[b] += 1

def dfs(graph, start, cluster):
    cluster.append(start)
    for neighbor in graph[start]:
        if neighbor not in cluster:
            dfs(graph, neighbor, cluster)


result = ""
for i in range(1, N+1):
    if cluster_sizes[i] != 0:
        cluster_size = cluster_sizes[i]
    else:
        cluster = []
        dfs(friend_dic, i, cluster)
        cluster_size = len(cluster)
        for v in cluster:
            cluster_sizes[v] = cluster_size
    result += str(cluster_size - friend_dic[i] - block_dic[i] - 1)

print(" ".join(result))


### FIXED CODE ###

class UnionFind:
    """
    parents: 各要素の親要素
             要素がrootの場合には　-(そのグループに属する要素数) を格納
    """
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        # xが属するグループのrootを取得
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        # 高い方の木の根に低い方の木の根を結合
        if self.parents[x] > self.parents[y]:
            x, y = y, x

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

    def size(self, x):
        return - self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

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

    def group_count(self):
        return len(self.roots())

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

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

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

union_find = UnionFind(n)
friends_counter = {i: 0 for i in range(n)}
blocks_counter = {i: 0 for i in range(n)}

for _ in range(m):
    a, b = map(int, input().split())
    union_find.union(a-1, b-1)
    friends_counter[a-1] += 1
    friends_counter[b-1] += 1

for _ in range(k):
    c, d = map(int, input().split())
    if union_find.same(c-1, d-1):
        blocks_counter[c-1] += 1
        blocks_counter[d-1] += 1

result = []
for i in range(n):
    result.append(str(union_find.size(i) - friends_counter[i] - blocks_counter[i] - 1))

print(" ".join(result))
if int(input()) % 2 == 0:
    print("Even")
else:
    print("Odd")

### FIXED CODE ###

list = input().split()
a, b = int(list[0]), int(list[1])

if a * b % 2 == 0:
    print("Even")
else:
    print("Odd")
N, K = map(int, input().split())
h[] = int(input().split())
for i in h:
  if i > K:
    total+=1
print(total)    

### FIXED CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split()))
total=0
for i in h:
  if i >= K:
    total+=1
print(total)
ll=[list(map(int,input().split())) for i in range(3)]
for i in range(2):
  for j in range(i+1,3):
    for k in range(3):
      if ll[k][i]==ll[k][j]:
          if not all(ll[t][i]==ll[t][j] for t in range(3)):
            print('No')
            exit()
      if ll[i][k]==ll[j][k]:
        if not all(ll[i][t]==ll[j][t] for t in range(3)):
          print('No')
          exit()
su=0
for lll in ll:
  s=sum(lll)
  su+=s
if su%3!=0:
  print('No')
else:

### FIXED CODE ###

l=[list(map(int,input().split())) for i in range(3)]
x=l[0][0]
y=l[0][1]
z=l[0][2]
a=0
b=l[1][0]-x
c=l[2][0]-x
if b+y==l[1][1] and b+z==l[1][2] and c+y==l[2][1] and c+z==l[2][2]:
  print('Yes')
else:
  print('No')
a,b,k = input().strip().split
a,b,k = [int(a), int(b), int(k)]

if k < a:
	a = a-k
elif k >= a+b:
	a = 0
	b = 0
elif a+b > k > a:
	b = b-(k-a)
    a = 0

### FIXED CODE ###

s,t = input().split()
print(t + s)
n,d=map(int,input().split())

cnt=0
dist=0

for i in range(n){
  x,y=map(int,input().split())
  dist = x**2 + y**2
  if (dist <= d){
    cnt+=1
  }
}

print(cnt)

### FIXED CODE ###

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

cnt=0
dist=0

for i in range(n):
  x,y=map(int,input().split())
  dist = x**2 + y**2
  if dist <= d**2:
    cnt+=1

print(cnt)
a=int(input())
b=input().split(' ')
m=0
s=1
j=0
while m<a:
	if b[m]==0:
      print(0)
      j=j+1
    
    m=m+1

m=0
while m<a and j==0:
    s=s*int(b[m])
    if s>10**18:
		print(-1)
    
    m=m+1


else:
    print(s)

### FIXED CODE ###

a=int(input())
b=input().split(' ')
m=0
s=1
i=0
o=0
while i<a:
    if int(b[i])==0:
        print(0)
        o=o+1
    i=i+1
while m<a and o==0:
    s=s*int(b[m])
    m=m+1
    if s>10**18 and o==0:
        print(-1)
        o=o+1
        break

if o==0:
    print(s)
num = int(input())
colors = map(str, input().split())

if len(set(colors)) == 3:
    print('Three')
else:
    print('Four')

### FIXED CODE ###

n = int(input())
print(n//3)
def f(a):
    cnt=0
    st=set()
    while True:
        if n%2!=0:
            tmp=a/2
        else:
            tmp=3*a+1
        if tmp in st:
            break
        st.add(tmp)
        a=tmp
    return cnt
a=int(input())     
ans= f(s)
print(ans)

### FIXED CODE ###

def f(s):
    cnt = 0
    st = set()

    cnt += 1
    st.add(s)

    while True:
        cnt += 1

        if s % 2 == 0:
            tmp = s / 2
        else:
            tmp = 3 * s + 1

        if tmp in st:
            break

        st.add(tmp)
        s = tmp
    return cnt


s = int(input())
ans = f(s)
print(ans)