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

n = int(input())
lst1 = list(map(int,input().split()))
mod = 10**9+7

import fractions as math
#リスト l の最大公約数
def lcmlist(l):
    a = l[0]
    for i in range(len(l)):
        a = (a*l[i]) //math.gcd(a,l[i])
    return a

g = lcmlist(lst1)
ans = 0
for i in range(n):
    ans += g//lst1[i]%mod

print(ans%mod)




### FIXED CODE ###

#互いに素なa,bについて、a*x+b*y=1の一つの解
def egcd(a, b):
    (x, lastx) = (0, 1)
    (y, lasty) = (1, 0)
    while b != 0:
        q = a // b
        (a, b) = (b, a % b)
        (x, lastx) = (lastx - q * x, x)
        (y, lasty) = (lasty - q * y, y)
    return (lastx, lasty, a)

def mod_inv(a, m):
    (inv, q, gcd_val) = egcd(a, m)
    return inv % m

import fractions
mod = (10**9)+ 7
n = int(input())
a = list(map(int, input().split()))
lcm = 1
for i in range(n):
    gcd = fractions.gcd(lcm, a[i])
    lcm *= a[i]
    lcm = lcm // gcd
lcm %= mod
ans = 0
for i in range(n):
    k = mod_inv(a[i], mod)
    ans += lcm * k
    ans %= mod
print(ans)
### BUGGY CODE ###

import numpy as np

n, k = map(int, input().split())
A = list(map(int, input().split()))
All = [[0]*40 for i in range(n)]
K = [0]*40
stopper = 0
sum_ = 0



for i in range(len(A)):
    bin_a = format(A[i],'b')
    list_a = [int(i) for i in bin_a]
    All[i] = [0]*(40-len(list_a))+ list_a
    
bin_k =   format(k,'b') 
list_k = [int(i) for i in bin_k]
K = [0]*(40-len(list_k))+list_k

b = np.cumsum(All, axis = 0)
B = b[len(b)-1]
    
for i in range(40):
    if K[i]==1 and B[i]>= (n+1)//2:
        K[i]=0
        stopper = i
        break

if stopper!=0 and stopper<=38:
    for i in range(stopper+1,40):
        if  B[i]>= (n+1)//2:
            K[i] = 0
        else:
            K[i] = 1

for i in range(n):
    for j in range(1,41):
        All[i][-j] = K[-j]^All[i][-j]

c = np.cumsum(All,axis = 0)
C = c[len(c)-1]
for i in range(1,len(C)+1):
    sum_ = sum_ + C[-i]*(2**(i-1))

print(sum_)

### FIXED CODE ###

import numpy as np

n, k = map(int, input().split())
A = list(map(int, input().split()))
All = [[0]*41 for i in range(n)]
K = [0]*41
stopper = 0
sum_ = 0



for i in range(len(A)):
    bin_a = format(A[i],'b')
    list_a = [int(i) for i in bin_a]
    All[i] = [0]*(41-len(list_a))+ list_a
    
bin_k =   format(k,'b') 
list_k = [int(i) for i in bin_k]
K = [0]*(41-len(list_k))+list_k

b = np.cumsum(All, axis = 0)
B = b[len(b)-1]
    
for i in range(41):
    if K[i]==1 and B[i]>= (n+1)//2:
        K[i]=0
        stopper = i
        break

if stopper!=0 and stopper<=39:
    for i in range(stopper+1,41):
        if  B[i]>= (n+1)//2:
            K[i] = 0
        else:
            K[i] = 1
            
            
for i in range(41):
    if K[i]==1:
        B[i] = n-B[i]

for i in range(1,42):
    sum_ = sum_ + B[-i]*(2**(i-1))

print(sum_)
### BUGGY CODE ###

S = input()
res = 0

for i in range(len(S)-3):
    for j in range(i+4,len(S)+1):
        num = int(S[i:j])
        if num % 2019 == 0:
            res += 1

print(res)

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Sun Sep  6 23:39:24 2020

@author: liang
"""
#from scipy.special import comb

counter = [0]*2019
counter[0] = 1 # 0 = 0 (mod 2019)

S = input()
tmp = 0
"""
#大きい数を一気に掛けない
for i in range(1,len(S)+1):
    tmp += int(S[-i])*10**(i-1)    #スライスの方が早い（けど、漸化式的に累積和を出せ）
    #print(tmp%2019)
    tmp %= 2019                    #大きい数を割るな
    counter[tmp%2019] += 1

ans = 0
for i in range(2019):
    if counter[i] >= 2:
        #ans += comb(counter[i], 2, exact=True)
        ans += counter[i]*(counter[i]-1)//2
print(ans)
"""
MOD = 2019
#reversed(s) ?
t = 1
for i in range(1,len(S)+1):
    tmp += int(S[-i])*t
    #print("A", tmp)
    tmp %= MOD 
    t *= 10
    #print("B", tmp)
    t %= MOD
    #print(tmp)
    counter[tmp] += 1
    
print(sum(i*(i-1)//2 for i in counter))
### BUGGY CODE ###

N = int(input())

cnt = 0
for A in range(1, N):
  for B in range(1, N // A + 1):
    if A * B < N:
      cnt += 1
      
print(cnt)

### FIXED CODE ###

N = int(input())

cnt = 0
for A in range(1, N):
  for B in range(1, (N - 1) // A + 1):
    cnt += 1
      
print(cnt)
### BUGGY CODE ###

from itertools import permutations
import sys

sys.setrecursionlimit(10 ** 6)
from bisect import *
from collections import *
from heapq import *

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 SI(): return sys.stdin.readline()[:-1]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
int1 = lambda x: int(x) - 1
def MI1(): return map(int1, sys.stdin.readline().split())
def LI1(): return list(map(int1, sys.stdin.readline().split()))
p2D = lambda x: print(*x, sep="\n")
dij = [(1, 0), (0, 1), (-1, 0), (0, -1)]

def main():
    n,t=MI()
    ab=LLI(n)
    ab.sort()
    dp=[-1]*(t+1)
    dp[0]=0
    for a,b in ab:
        for i in range(t-1,-1,-1):
            pre=dp[i]
            if pre==-1:continue
            ni=min(t,i+a)
            dp[ni]=max(dp[ni],pre+b)
    print(max(dp))

main()


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")

def main():
    n, t = map(int, input().split())
    ab = []
    for _ in range(n):
        a, b = map(int, input().split())
        ab.append((a, b))
    ab.sort()
    dp = [0] * (t + 1)
    for a, b in ab:
        mx = 0
        for i in range(t - 1, -1, -1):
            dpi = dp[i]
            if dpi > mx: mx = dpi
            if i - a >= 0:
                dp[i] = max(dpi, dp[i - a] + b)
        dp[t] = max(dp[t], mx + b)
    print(dp[t])
    # print(dp)

main()
### BUGGY CODE ###

import copy
K=int(input())
primes=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199]
yakusuu_array=[]
for i in range(200):
  i+=1
  tmp=[]
  while i!=1:
    for prime in primes:
      if i % prime ==0:
        tmp.append(prime)
        i//=prime
  yakusuu_array.append(tmp)


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

ans=0
for i in range(1,K+1):
    for j in range(1,K+1):
        x=gcd(i,j)
        for k in range(1,K+1):
            ans+=gcd(x,k)
print(ans)


### FIXED CODE ###

n = int(input())
 
from math import gcd
 
y = 0
for i in range(1, n+1):
    for j in range(1, n+1):
        x = gcd(i, j)
        for k in range(1, n+1):
            y += gcd(x,k)
 
print(y)
### BUGGY CODE ###

import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M, *LRD = map(int, read().split())

    G = [[] for _ in range(N)]
    for l, r, d in zip(*[iter(LRD)] * 3):
        G[l - 1].append((r - 1, d))
        G[r - 1].append((l - 1, -d))

    seen = [False] * N
    for i in range(N):
        if seen[i]:
            continue

        dist = [-1] * N
        dist[i] = 0
        queue = deque([i])
        while queue:
            v = queue.popleft()
            for nv, d in G[v]:
                if seen[nv]:
                    if dist[nv] != dist[v] + d:
                        print('No')
                        return
                else:
                    dist[nv] = dist[v] + d
                    seen[nv] = True
                    queue.append(nv)

    print('Yes')
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from collections import deque

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    N, M, *LRD = map(int, read().split())

    G = [[] for _ in range(N)]
    for l, r, d in zip(*[iter(LRD)] * 3):
        G[l - 1].append((r - 1, d))
        G[r - 1].append((l - 1, -d))

    dist = [INF] * N
    for i in range(N):
        if dist[i] != INF:
            continue

        dist[i] = 0
        queue = deque([i])
        while queue:
            v = queue.popleft()
            for nv, d in G[v]:
                if dist[nv] != INF:
                    if dist[nv] != dist[v] + d:
                        print('No')
                        return
                else:
                    dist[nv] = dist[v] + d
                    queue.append(nv)

    print('Yes')
    return


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

N = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(N-1):
    for j in range(N):
        if i < j:
            ans = ans + A[i]*A[j]
        else:
            ans = ans
print(ans%(10**9+7))

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
ans = 0
hoge = 0
mod = 10**9+7
for i in range(N):
    hoge = hoge + A[i]
    hoge = hoge % mod

for i in range(N):
    hoge = hoge - A[i]
    if hoge < 0:
        hoge = hoge + mod
    ans = ans + A[i] * hoge
    ans = ans % mod

print(ans%mod)
### BUGGY CODE ###

import sys
from scipy.sparse import csc_matrix
from scipy.sparse.csgraph import dijkstra

input = sys.stdin.readline
N = int(input())

P=set()
for _ in range(N - 1):
  a, b, c = map(int, input().split())
  P.add((c, a - 1, b - 1))

d, i, j = zip(*P)
G = csc_matrix((d, (i, j)),(N, N))

Q, K = map(int, input().split())
P = dijkstra(G, indices=K - 1, directed=False)
for _ in range(Q):
  x, y = map(int, input().split())
  print(int(P[x - 1] + P[y - 1]))

### FIXED CODE ###

from collections import deque

N = int(input())
ABC = [list(map(int, input().split())) for _ in range(N - 1)]
Q, K = map(int, input().split())
XY = [list(map(int, input().split())) for _ in range(Q)]

G = [[] * N for _ in range(N)]
for a, b, c in ABC:
  G[a - 1].append((b - 1, c))
  G[b - 1].append((a - 1, c))

D = [-1] * N
D[K - 1] = 0

q = deque()
q.append(K - 1)
while q:
  n = q.popleft()
  for i, c in G[n]:
    if D[i] < 0:
      q.append(i)
      D[i] = D[n] + c

for x, y in XY:
  print(D[x - 1] + D[y - 1])
### BUGGY CODE ###

N = int(input())
C = [int(input()) for _ in range(N)]
   
i=0 
while i+1<len(C):
    if C[i]==C[i+1]:
        C.pop(i+1)
    else:
        i+=1

DP = [1]
dic = {}      

for i in range(len(C)):  
    DP.append((DP[-1]+dic.get(C[i],0))%(10**9+7))
    dic[C[i]] = DP[-1]            
print(DP[-1])

### FIXED CODE ###

N = int(input())
C = [int(input()) for _ in range(N)]
C = [x for x,y in zip(C[:-1],C[1:]) if x!=y] + [C[-1]]

DP = [1]
dic = {}

for i in range(len(C)):   
    DP.append((DP[-1]+dic.get(C[i],0))%(10**9+7))    
    dic[C[i]] = DP[-1]
print(DP[-1])
### BUGGY CODE ###

(N, K) = map(lambda a: int(a), input().split())
A = list(map(lambda a: int(a), input().split()))

def proc():
    global A
    B = [0 for _ in range(N)]

    for i in range(0,N):
        f = max(0, i - A[i])
        t = min(N-1, i + A[i])
        #for j in range(max(0, f), min(N, t)+1):
        #    B[j] += 1
        B[f] += 1
        if t+1 < N:
            B[t+1] -= 1
    for i in range(1,N):
        B[i] += B[i-1]
    A = B

for _ in range(0, min(K,41)):
    proc()

print(" ".join(map(lambda a: str(a), A)))

### FIXED CODE ###

import numpy as np
from numba import njit

(N, K) = map(int, input().split())
A = np.array(list(map(int, input().split())))

@njit
def solve(N,K,A):
    for j in range(0, K):
        B = np.zeros(N, dtype=np.int64)

        for i in range(0,N):
            f = max(0, i - A[i])
            t = min(N-1, i + A[i])
            #for j in range(max(0, f), min(N, t)+1):
            #    B[j] += 1
            B[f] += 1
            if t+1 < N:
                B[t+1] -= 1
        A = np.cumsum(B)
        if np.all(A == N):
            return A
        i += 1
    return A
    

print(" ".join(map(str, solve(N,K,A))))
### BUGGY CODE ###

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

lr = []
for _ in range(m):
    l, r = map(int, input().split())
    lr.append([l, r])

cnt = 0
for i in range(1, n+1):
    for l, r in lr:
        if not l <= i <= r:
            break
    else:
        cnt += 1

print(cnt)

### FIXED CODE ###

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

L, R = [], []
for _ in range(m):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)

max_l = max(L)
min_r = min(R)

if max_l <= min_r:
    print(min_r - max_l + 1)
else:
    print(0)
### BUGGY CODE ###

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

upper = M // N

ans = None
for i in reversed(range(1,upper+1)):
    if M % i == 0:
        ans = i
        break

print(ans)

### FIXED CODE ###

import bisect

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

vector = []

i = 1
while i * i <= M:
    if M%i == 0:
        vector.append(i)
        vector.append(M//i)
    i+=1

vector.sort()

bottom = M//N
index = bisect.bisect_right(vector, bottom)

ans = vector[index-1]
print(ans)
### BUGGY CODE ###

from collections import deque

def solve():
    H, W = map(int, input().split())

    l = []
    for _ in range(H):
        l.append([0 if s=="." else 1 for s in input()])

    def dfs(sh, sw, gh, gw):
        q = deque([(sh, sw)])
        dist = [[10**12]*W for _ in range(H)]
        dist[sh][sw] = 0
        while q:
            h, w = q.popleft()
            for h1, w1 in [(h+1, w), (h, w+1), (h-1, w), (h, w-1)]:
                if not (0<=h1<H and 0<=w1<W):continue
                if l[h1][w1]:continue
                if dist[h1][w1] > dist[h][w] + 1:
                    dist[h1][w1] = dist[h][w] + 1
                    q.append((h1, w1))
        return dist[gh][gw]

    ans = 0
    for sh in range(H):
        for sw in range(W):
            for gh in range(H):
                for gw in range(W):
                    if gw==sw and gh==sh:
                        continue
                    if l[gh][gw] or l[sh][sw]:
                        continue
                    ans = max(ans, dfs(sh, sw, gh, gw))
    print(ans)

solve()

### FIXED CODE ###

H, W = map(int, input().split())
m = [list(input()) for _ in range(H)]
inf = 10**3

V = H*W
maze = [[inf]*V for _ in range(V)]

for i in range(V):
    maze[i][i] = 0

for py in range(H):
    for px in range(W):
        if m[py][px] == "#":
            continue
        candidate = [(px+1, py), (px-1, py), (px, py+1), (px, py-1)]
        for x, y in candidate:
            if not (0<=x<W and 0<=y<H):continue
            if m[y][x] == "#":
                continue
            maze[W*py+px][W*y+x] = 1

for k in range(V):
    for i in range(V):
        for j in range(V):
            maze[i][j] = min(maze[i][j], maze[i][k]+maze[k][j])

print(max([j for i in maze for j in i if j!=inf]))
### BUGGY CODE ###

def main():
    n = int(input())
    ans = 0

    fac = 2
    e = 1
    while pow(fac, 2) <= n:
        while n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1

        while n % fac == 0:
            n //= fac

    fac = 3
    e = 1
    while pow(fac, 2) <= n:
        while n % (div := pow(fac, e)) == 0:
            n //= div
            ans += 1
            e += 1

        while n % fac == 0:
            n //= fac
        e = 1
        fac += 2

    if n != 1:
        ans += 1

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from collections import Counter
from itertools import accumulate


def prime_factorize(n):
    """素因数分解し，ユニークな素因数のsetを返す。"""
    ans = []
    ans_add = ans.append
    while n % 2 == 0:
        ans_add(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            ans_add(f)
            n //= f
        else:
            f += 2
    if n != 1:
        ans_add(n)
    return ans


def main():
    n = int(input())
    primes = prime_factorize(n)
    acc = tuple(accumulate(range(1, 42)))
    counted = Counter(primes)
    ans = 0

    for c in counted.values():
        for i, x in enumerate(acc):
            if c >= x:
                tmp = i + 1
            else:
                break
        ans += tmp

    print(ans)


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

import sys
input = sys.stdin.readline

h,w = map(int,input().split())
c = []
for i in range(h):
  a = input()
  c.append(a)
  
from collections import deque

def bfs(sh,sw):
    d = [[False] * w for i in range(h)]

    dx = [1, 0, -1, 0]
    dy = [0, 1, 0, -1]

    que = deque([])
    que.append((sh,sw,0))
    d[sh][sw] = True

    while que:
        p = que.popleft()
        if c[p[0]][p[1]] == '#':
            break
        for i in range(4):
            nw = p[1] + dx[i]
            nh = p[0] + dy[i]

            if 0 <= nw < w and 0 <= nh < h and d[nh][nw] == False:
                que.append((nh,nw,p[2]+1))
                d[nh][nw] = True
    return p[2]
  
ans = 0
for i in range(h):
  for j in range(w):
    res = bfs(i,j)
    ans = max(ans,res)
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline

h,w = map(int,input().split())
c = []
for i in range(h):
  a = input()
  c.append(a)
  
from collections import deque

d = [[-1] * w for i in range(h)]
dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]

que = deque([])
for i in range(h):
  for j in range(w):
    if c[i][j] == '#':
      que.append((i,j,0))
      d[i][j] = 0

ans = 0
while que:
  p = que.popleft()
  for i in range(4):
      nw = p[1] + dx[i]
      nh = p[0] + dy[i]
      if 0 <= nw < w and 0 <= nh < h and d[nh][nw]==-1:
          que.append((nh,nw,p[2]+1))
          d[nh][nw] = p[2]+1
          ans = max(ans,p[2]+1)

print(ans)
### BUGGY CODE ###

X = input()
dp = [0] * (len(X)+1)
dp[1] = 1
S = [X[0]]
for i in range(2, len(X)+1):
    if X[i-1] == 'S':
        S.append('S')
        dp[i] = dp[i-1] + 1
    else:
        if 'S' in S:
            S.remove('S')
            dp[i] = dp[i-1] - 1
        else:
            S.append('T')
            dp[i] = dp[i-1] + 1
print(dp[-1])


### FIXED CODE ###

X = input()
s = 0
t = 0
for x in X:
    if x == 'S':
        s += 1
    else:
        if s > 0:
            s -= 1
        else:
            t += 1
print(s+t)
### BUGGY CODE ###

n, *A = map(int, open(0).read().split())
mod = 10**9 + 7
ans = 0
d = 1
while any(A):
  c = 0
  for i in range(n):
    q, r = divmod(A[i], 2)
    A[i] = q
    c += r
  ans += c*(n-c) * d
  ans %= mod
  d *= 2
print(ans % mod)

### FIXED CODE ###

import sys
inputs = sys.stdin.readlines()

n = int(inputs[0])
A = list(map(int, inputs[1].split()))
MOD = 10 ** 9 + 7

bit = len(format(max(A), 'b'))
ans = 0
for i in range(bit):
    nb_1 = sum(((a >> i) & 1 for a in A))
    ans += (nb_1 * (n - nb_1)) << i
    ans %= MOD
    
print(ans)
### BUGGY CODE ###

import sys
input=sys.stdin.readline
from collections import deque

def main():
    N = int(input())
    Q = [deque(map(int, input().split())) for _ in range(N)]
    games = N*(N-1)//2

    days = 0
    nxt = [i for i in range(N)] # 翌日に対戦相手を更新する選手のリスト
    opp = [0]*N # 選手毎の、次の対戦相手のリスト
    while 1:
        days += 1
        for i in nxt:
            opp[i] = Q[i].popleft() - 1 if Q[i] else -1

        gamed = [0]*N # 選手がその日に試合済みかどうか
        tmp = [] # 次の日の更新のため、試合をした選手をメモ
        for i in nxt:
            if gamed[i] == 0 and opp[i] >= 0 and i == opp[opp[i]]:
#                print("game:", i+1, opp[i]+1, days)
                tmp.append(i)
                tmp.append(opp[i])
                gamed[i] = gamed[opp[i]] = 1
                games -= 1
        if games == 0:
            break
        elif not tmp:
            print(-1)
            return
        nxt = tmp
    print(days)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input=sys.stdin.readline
from collections import deque

def main():
    N = int(input())
    Q = [deque(map(int, input().split())) for _ in range(N)]
    games = N*(N-1)//2

    days = 0
    nxt = [i for i in range(N)] # 翌日に対戦相手を更新する選手のリスト
    opp = [0]*N # 選手毎の、次の対戦相手のリスト
    while 1:
        days += 1
        for i in nxt:
            opp[i] = Q[i].popleft() - 1 if Q[i] else -1

        tmp = set() # 次の日の更新のため、試合をした選手をメモ
        for i in nxt:
            if i not in tmp and i == opp[opp[i]]:
#                print("game:", i+1, opp[i]+1, days)
                tmp.add(i)
                tmp.add(opp[i])
                games -= 1
        if games == 0:
            break
        elif not tmp:
            print(-1)
            return
        nxt = tmp
    print(days)

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

#設定
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

class Graph(object):
	def __init__(self):
		self.graph = defaultdict(list)

	def __len__(self):
		return len(self.graph)

	def add_edge(self, a, b):
		self.graph[a].append(b)

	def get_nodes(self):
		return self.graph.keys()

def DFS(G, XOR, visit, node):
	for i in G.graph[node]:
		if visit[i] != "Yes":
			visit[i] = "Yes"
			DFS(G, XOR, visit, i)
			XOR[node] = XOR[node] ^ (XOR[i] + 1)

#処理内容
def main():
	N = int(input())
	G = Graph()
	for i in range(N - 1):
		x, y = getlist()
		x -= 1
		y -= 1
		G.add_edge(x, y)
		G.add_edge(y, x)

	#計算
	XOR = [0] * N
	visit = ["No"] * N
	visit[0] = "Yes"
	DFS(G, XOR, visit, 0)
	if XOR[0] == 0:
		print("Bob")
	else:
		print("Alice")
	

if __name__ == '__main__':
	main()

### FIXED CODE ###

#設定
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

class Graph(object):
	def __init__(self):
		self.graph = defaultdict(list)

	def __len__(self):
		return len(self.graph)

	def add_edge(self, a, b):
		self.graph[a].append(b)

	def get_nodes(self):
		return self.graph.keys()

def DFS(G, XOR, visit, node):
	for i in G.graph[node]:
		if visit[i] != "Yes":
			visit[i] = "Yes"
			DFS(G, XOR, visit, i)
			XOR[node] ^= XOR[i] + 1

#処理内容
def main():
	N = int(input())
	G = Graph()
	for i in range(N - 1):
		x, y = getlist()
		x -= 1
		y -= 1
		G.add_edge(x, y)
		G.add_edge(y, x)

	#計算
	XOR = [0] * N
	visit = ["No"] * N
	visit[0] = "Yes"
	DFS(G, XOR, visit, 0)
	if XOR[0] == 0:
		print("Bob")
	else:
		print("Alice")
	

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

import itertools
from collections import deque

H, W = [int(_) for _ in input().split()]
A = [[_ for _ in input()] for _ in range(H)]
Q = deque([])
for i, j in itertools.product(range(H), range(W)):
    if A[i][j] == '#':
        A[i][j] = 0
        Q += [[i, j]]
while Q:
    i, j = Q.popleft()
    for ni, nj in [[i - 1, j], [i + 1, j], [i, j - 1], [i, j + 1]]:
        if 0 <= ni < H and 0 <= nj < W:
            if A[ni][nj] == '.':
                A[ni][nj] = A[i][j] + 1
                Q += [[ni, nj]]
print(max(max(_) for _ in A))


### FIXED CODE ###

import itertools
from collections import deque

H, W = [int(_) for _ in input().split()]
A = [list(input()) for _ in range(H)]
Q = deque([])
for i, j in itertools.product(range(H), range(W)):
    if A[i][j] == '#':
        Q += [[i, j, 0]]
while Q:
    i, j, d = Q.popleft()
    for ni, nj in [[i - 1, j], [i + 1, j], [i, j - 1], [i, j + 1]]:
        if 0 <= ni < H and 0 <= nj < W and A[ni][nj] == '.':
            A[ni][nj] = '#'
            Q += [[ni, nj, d + 1]]
print(d)