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

n = int(input())
a = list(map(int,input().split()))
ans = 1
for j in range(max(a),1,-1):
  c = list(map(lambda x: x % j,a))
  c_ng = [i for i in c if i > 0]
  #print("j=",j,"c=",c,"c_ng=",c_ng)
  if len(c_ng) <= 1:
    ans = j
    break
print(ans)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
a.sort()
ans = 1
if n == 2:
  print(max(a))
else:
  a0 = a[0]
  a1 = a[1]
  r = 0
  while True:
    r = a1 % a0
    if r == 0:
      b0 = a0
      break
    elif r > a0:
      a1, a0 = r, a0
    else:
      a1, a0 = a0, r
  a1 = a[1]
  a2 = a[2]
  r = 0
  while True:
    r = a2 % a1
    if r == 0:
      b1 = a1
      break
    elif r > a1:
      a2, a1 = r, a1
    else:
      a2, a1 = a1, r
  a0 = a[0]
  a2 = a[2]
  r = 0
  while True:
    r = a2 % a0
    if r == 0:
      b2 = a0
      break
    elif r > a0:
      a2, a0 = r, a0
    else:
      a2, a0 = a0, r
  max_a = max(b0,b1,b2)
  kouho = []
  for j in range(max_a,1,-1):
    if max_a % j == 0:
      c = list(map(lambda x: x % j,a))
      c_ng = [i for i in c if i > 0]
    #print("j=",j,"c=",c,"c_ng=",c_ng)
      if len(c_ng) <= 1:
        ans = j
        break
  print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

n = int(input())
import sys
vals = [None]*n
def quest(q):
    print(q)
    sys.stdout.flush()
    res = input()
    if res=="Vacant":
        exit()
        res = -1
    elif res=="Male":
        res = 1
    else:
        res = 0
    vals[q] = res
    return res

k = n//2
res1 = quest(0)
res2 = quest(k)

if (res2-res1)%2 == k%2:
    l = k+1
    r = n-1
else:
    l = 1
    r = k
    
while l<r+1:
    m = (l+r)//2
    res = quest(m)
    if (res-vals[l])%2 == (l-m)%2:
        l = m+1
    else:
        r = m-1
quest(l)
quest(r)

### FIXED CODE ###

import sys
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")

n = int(input())
import sys
vals = [None]*n
def quest(q):
    print(q)
    sys.stdout.flush()
    res = input()
    if res=="Vacant":
        exit()
        res = -1
    elif res=="Male":
        res = 1
    else:
        res = 0
    vals[q] = res
    return res

k = n//2
res1 = quest(0)
res2 = quest(k)

if (res2-res1)%2 != k%2:
    l = 0
    r = k
else:
    l = k
    r = n
    
while l<r+1:
    m = (l+r)//2
    res = quest(m)
    if (res-vals[l])%2 != (l-m)%2:
        r = m
    else:
        l = m
quest(l)
quest(r)
### BUGGY CODE ###

import numpy as np

s=input()
l=len(s)
a=10**9+7

if s[l-1] == '?':
  n=np.array([1,1,1,1,1,1,1,1,1,1,0,0,0], dtype='uint64')
else:
  n=np.array([0,0,0,0,0,0,0,0,0,0,0,0,0], dtype='uint64')
  n[int(s[l-1])]=1
d=np.array([0,0,0,0,0,0,0,0,0,0,0,0,0], dtype='uint64')

m=1
for i in range(1,len(s)):
  m=(m*10)%13
  if s[l-1-i] == '?':
    for j in range(13):
      for k in range(10):
        d[(m*k+j)%13] += n[j]
  else:
    for j in range(13):
      d[(m*int(s[l-1-i])+j)%13] += n[j]

  for j in range(13):
    n[j]=d[j]%a
    d[j]=0

print(n[5])


### FIXED CODE ###

S=input()
a=[0]*13
a[0]= 1

for c in S:
  dp=[0]*13
  for i in range(13):
    dp[(i*10)%13]=a[i]%(10**9+7)
  dp+=dp

  if c=='?':
    for i in range(13):
      a[i]=sum(dp[i+4:i+14])
  else:
    for i in range(13):
      a[i]=dp[i+13-int(c)]

print(a[5]%(10**9+7))
### BUGGY CODE ###

num = int(input())
range_arr = range(num)

strs = [[] for i in range_arr]
for i in range_arr:
    strs[i] = input()

def conv(str):
    str_arr = list(str)
    str_arr.sort()
    return ''.join(str_arr)

new_strs = list(map(lambda v: conv(v), strs))
new_strs.sort()
compact_strs = list(set(new_strs))

cnt = 0
for str in compact_strs:
    str_count = new_strs.count(str)
    if str_count >= 2:
        cnt += int(str_count*(str_count-1)/2)

print(cnt)


### FIXED CODE ###

from collections import Counter

num = int(input())
range_arr = range(num)

strs = [[] for i in range_arr]
for i in range_arr:
    strs[i] = input()

def sort(str):
    str_arr = list(str)
    str_arr.sort()
    return ''.join(str_arr)

new_strs = list(map(lambda v: sort(v), strs))
strs_length = len(new_strs)

sum = 0
counter = Counter()
for tmp_str in new_strs:
    sum += counter[tmp_str]
    counter[tmp_str] += 1

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

n = int(input())
li_a = list()
for _ in range(n):
    li_a.append(int(input()))

for i in range(n):
    li_w = li_a[::]
    li_w.pop(i)
    print(max(li_w))

### FIXED CODE ###

n = int(input())
li_a = list()
d_a = dict()

for _ in range(n):
    wk = int(input())
    li_a.append(wk)

    get = d_a.get(wk, 0)
    d_a[wk] = get + 1

li_top2 = sorted(d_a.keys(), reverse=True)[:2]

for i in range(n):
    val = li_a[i]

    if val not in li_top2:
        print(li_top2[0])
    else:
        if val == li_top2[0] and d_a.get(val, 0) == 1:
            print(li_top2[1])
        else:
            print(li_top2[0])
### BUGGY CODE ###

def fac(n):
  s = 1
  for i in range(1, n+1):
    s = s*i
  return s

def cmb(n,r):
  if n == r:
    return 1
  else:
    return fac(n) // (fac(r)*fac(n-r))

N = int(input())
S = []
ans = 0
n = 1

for i in range(N):
  s = list(input())
  s.sort()
  
  S.append(s)
  
S.sort()

for i in range(N-1):
  if S[i] == S[i+1]:
    n += 1
  elif n >= 2:
    ans += cmb(n,2)
    n = 1
  else:
    n = 1
  
if S[N-1] == S[N-2]:
  ans += cmb(n,2)
  
print(ans)

### FIXED CODE ###

import collections

N = int(input())
S = []

for i in range(N):
  s = input()
  ss = [i for i in s]
  ss.sort()
  s = ''.join(ss)
  S.append(s)
  
c = collections.Counter(S)
ans = 0

for b in c:
  ans += c[b] * (c[b] - 1) // 2
  
print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
def gcd(a,b):
    while b:
        a,b = b,a%b
    return a
def lcm(a,b):
    return a*b//gcd(a,b)
k=1
for i in range(n):
    k = lcm(k,a[i])
ans=0
for i in range(n):
    ans += k//a[i]
    ans %= 1000000007
print(ans)


### FIXED CODE ###

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

def gcd(a,b):
    return gcd(b,a%b) if b != 0 else a
mod = 10**9+7

def lcm(a,b):
    return a*b%mod * pow(gcd(a,b),mod-2,mod) % mod

num = {}

for i in range(n):
    nown=a[i]
    tmp = {}
    for i in range(2,int(nown**0.5) + 5):
        while nown % i ==0:
            nown//=i
            if(i in tmp):
                tmp[i]+=1
            else:
                tmp[i] = 1
    if nown != 1:
        tmp[nown] = 1    
    for key in tmp:
        if (key in num):
            num[key] = max(num[key],tmp[key])
        else:
            num[key] = tmp[key]

kobai = 1
for key in num:
    kobai *= pow(key, num[key],mod)
    kobai %= mod
    
ans = 0

for i in range(n):
    ans += kobai * pow(a[i],mod-2,mod) %mod
    ans %= mod

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

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()

    d = [1] * (N + 1)

    for i in range(2, N + 1):
        for j in range(i, N + 1, i):
            d[j] += 1

    ans = 0
    for i in range(1, N + 1):
        ans += i * d[i]

    print(ans)

if __name__ == '__main__':
    resolve()


### FIXED CODE ###

import bisect, collections, copy, heapq, itertools, math, string, sys
input = lambda: sys.stdin.readline().rstrip() 
sys.setrecursionlimit(10**7)
INF = float('inf')
def I(): return int(input())
def F(): return float(input())
def SS(): return input()
def LI(): return [int(x) for x in input().split()]
def LI_(): return [int(x)-1 for x in input().split()]
def LF(): return [float(x) for x in input().split()]
def LSS(): return input().split()

def resolve():
    N = I()

    ans = 0
    for i in range(1, N + 1):
        num = N // i
        e = num * i
        ans += (i + e) * num // 2

    print(ans)

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

n,m = map(int,input().split())
a = []
a.append(0)
for i in range(m):
    b = int(input())
    b -= 1
    a.append(b)
a.append(n)
b = []
b.append(1)
b.append(2)

for i in range(n-2):
    c =b[i]
    d = b[i+1]
    e = c + d
    b.append(e)

c = []
if a[1] == 0:
    c.append(1)
else:
    c.append(b[a[1] - a[0]  - 1])
i = 1
while i <= m:
    if a[i + 1] - a[i] - 3 >= 0:
        c.append(b[a[i + 1] - a[i]  - 3])
        i += 1
    elif a[i + 1] - a[i] - 2 == 0:
        c.append(1)
    else:
        c.append(0)
        break
#print(c)
d = c[0] 
i = 1
#print(d)
while i < len(c):
    d = d * c[i]
    i += 1
e = 1000000007
print(d % e)
#print(b[0])



### FIXED CODE ###

n,m = map(int,input().split())
mod = 10**9 + 7
a = [1] * (n+1)
for i in range(m):
    b = int(input())
    a[b] = 0

        
for i in range(2,n+1):
    if a[i] != 0:
        a[i] = a[i-1] + a[i-2]
#print(a)
print(a[n] % mod)
### BUGGY CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

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

h_all = 0
for i in range(N):
    if S[i]=='?':
        h_all += 1

a = 0
b = 0
h = 0
numAB = 0
numAH = 0
numHB = 0
numHH = 0
dp = [0]*N

for i in range(N):
    if S[i]=='A':
        if i>=1:
            dp[i] = dp[i-1]
        a += 1
    elif S[i]=='B':
        if i>=1:
            dp[i] = dp[i-1]
        numAB += a
        numHB += h
        b += 1
    elif S[i]=='?':
        if i>=1:
            if h_all>=1:
                dp[i] = (dp[i-1]+numAB*3**(h_all-1)) %mod
            if h_all>=2:
                dp[i] = (dp[i]+numAH*3**(h_all-2)) %mod
                dp[i] = (dp[i]+numHB*3**(h_all-2)) %mod
            if h_all>=3:
                dp[i] = (dp[i]+numHH*3**(h_all-3))%mod
        numAH += a
        numHH += h
        h += 1
    else:
        if i>=1:
            dp[i] = (dp[i-1]+numAB*3**h_all) %mod
            if h_all>=1:
                dp[i] = (dp[i]+numAH*3**(h_all-1)) %mod
                dp[i] = (dp[i]+numHB*3**(h_all-1)) %mod
            if h_all>=2:
                dp[i] = (dp[i]+numHH*3**(h_all-2))%mod

print(dp[N-1])

### FIXED CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

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

h_all = 0
for i in range(N):
    if S[i]=='?':
        h_all += 1

a = 0
b = 0
h = 0
numAB = 0
numAH = 0
numHB = 0
numHH = 0
dp = [0]*N

beki3 = pow(3,h_all-3,mod) if h_all>=4 else 1
beki2 = beki3*3 % mod if h_all>=3 else 1
beki1 = beki2*3 %mod if h_all>=2 else 1
beki0 = beki1*3 %mod if h_all>=1 else 1

for i in range(N):
    if S[i]=='A':
        if i>=1:
            dp[i] = dp[i-1]
        a += 1
    elif S[i]=='B':
        if i>=1:
            dp[i] = dp[i-1]
        numAB += a
        numHB += h
        b += 1
    elif S[i]=='?':
        if i>=1:
            if h_all>=1:
                dp[i] = (dp[i-1]+numAB*beki1) %mod
            if h_all>=2:
                dp[i] = (dp[i]+numAH*beki2) %mod
                dp[i] = (dp[i]+numHB*beki2) %mod
            if h_all>=3:
                dp[i] = (dp[i]+numHH*beki3)%mod
        numAH += a
        numHH += h
        h += 1
    else:
        if i>=1:
            dp[i] = (dp[i-1]+numAB*beki0) %mod
            if h_all>=1:
                dp[i] = (dp[i]+numAH*beki1) %mod
                dp[i] = (dp[i]+numHB*beki1) %mod
            if h_all>=2:
                dp[i] = (dp[i]+numHH*beki2)%mod

print(dp[N-1])
### BUGGY CODE ###

import collections
S = input()
N = len(S)
M = [0]
for i in range(N):
  M.append(int(S[:i+1] + '0' * (N-1-i)) % 2019)
count = collections.Counter(M)
print(sum([c*(c-1)//2 for c in count.values()]))

### FIXED CODE ###

import collections
S = input()
N = len(S)
M = [0]
mod = 0
ten = 1
for s in S[::-1]:
  mod += (int(s) * ten) % 2019
  mod %= 2019
  M.append(mod)
  ten *= 10
  ten %= 2019 
count = collections.Counter(M)
print(sum([c*(c-1)//2 for c in count.values()]))
### BUGGY CODE ###

N, W = map(int, input().split())
w = [0]
v = [0]
for _ in range(N):
    a, b = map(int, input().split())
    w.append(a)
    v.append(b)

dp = [[0 for _ in range(W + 1)] for _ in range(N + 1)]

for i in range(1, N + 1):
    for j in range(1, W + 1):
        if j >= w[i]:
            dp[i][j] = max(dp[i][j], dp[i - 1][j - w[i]] + v[i])
        dp[i][j] = max(dp[i - 1][j], dp[i][j])

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


### FIXED CODE ###

import sys


def main():
    input = sys.stdin.readline

    N, W = map(int, input().split())
    dp = [0] * (W + 1)

    WV = (map(int, input().split()) for _ in range(N))

    for w, v in WV:
        for j in range(W, w - 1, -1):
            tmp = dp[j - w] + v
            if tmp > dp[j]:
                dp[j] = tmp

    print(dp[-1])


main()
### BUGGY CODE ###

#coding: utf-8
s = list(map(int, input()))
cnt = 0
while len(set(s)) > 1:
    for i in range(len(s)-1):
        if (s[i] == 1 and s[i+1] == 0) or (s[i] == 0 and s[i+1] == 1):
            cnt += 2
            del s[i:i+2]
            break
print(cnt)

### FIXED CODE ###

#coding: utf-8
s = list(map(int, input()))
cnt = 0
zero = s.count(0)
one = s.count(1)
print(zero*2 if zero < one else one * 2)
### BUGGY CODE ###

n=int(input())
import  functools
import operator
prod=functools.partial(functools.reduce, operator.mul)

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

ans=prod(a)

if ans>10**18:
    print(-1)
else:
    print(ans)


### FIXED CODE ###

n=int(input())
import  functools
import operator
prod=functools.partial(functools.reduce, operator.mul)
a=list(map(int,input().split()))
a.sort(reverse=True)
if a[0]*a[1]>10**18 and a[-1]!=0:
    print(-1)
    exit()
if a[-1]==0:
    print(0)
    exit()
    
ans=prod(a)

if ans>10**18:
    print(-1)
else:
    print(ans)
### BUGGY CODE ###

s = input()
t = input()
N = len(s)
s2 = s + s
cs = set(t)
#print(cs)
table = {}
for c in cs:
  l = []
  for i in range(len(s)):
    j = s2.find(c, i)
    l.append(-1 if j < 0 else j-i)
  table[c] = l
#print(table)
r = 0
for c in t:
  d = table[c][r%N]
  if d < 0:
    print(-1)
    exit()
  r += d+1
print(r)


### FIXED CODE ###

s = input()
t = input()
N = len(s)
s2 = s + s
cs = set(t)
#print(cs)
table = {}
for c in cs:
  if s.find(c) < 0:
    table[c] = [-1]*N
    continue
  l = [-2] * N
  p = 0
  while p < N:
    i = s2.find(c, p)
    while p <= i:
      if p < N:
        l[p] = i-p
      p += 1
  table[c] = l
#print(table)
r = 0
for c in t:
  d = table[c][r%N]
  if d < 0:
    print(-1)
    exit()
  r += d+1
print(r)
### BUGGY CODE ###

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

while M > 0:
    max_index = A.index(max(A))
    A[max_index] = A[max_index] // 2
    M -= 1
print(sum(A))


### FIXED CODE ###

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

while M > 0:
    A.sort(reverse=True)
    if A[0] == 0:
        break
    ham = A[0] // 2
    for i, a in enumerate(A):
        if ham < a and M > 0:
            A[i] = A[i] // 2
            M -= 1
        else:
            break
print(sum(A))
### BUGGY CODE ###

from collections import defaultdict
from itertools import permutations

N,M,R=map(int,input().split())
r=[int(x) for x in input().split()]

INF=10**20
d=[[INF for x in range(N)] for y in range(N)]

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

def warshall_floyd(N):
  for i in range(N):
    for j in range(N):
      for k in range(N):
        d[j][k]=min(d[j][k],d[j][i]+d[i][k])

ans=INF
warshall_floyd(N)
for root in permutations(r):
  cnt=0
  for i in range(len(root)-1):
    cnt+=d[root[i]-1][root[i+1]-1]
  ans=min(ans,cnt)
print(ans)

### FIXED CODE ###

from itertools import permutations

N,M,R=map(int,input().split())
r=[int(x) for x in input().split()]

INF=float('inf')
d=[[INF for x in range(N)] for y in range(N)]

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):
  for j in range(N):
    for k in range(N):
      if d[j][i]+d[i][k] < d[j][k]:
        d[j][k]=d[j][i]+d[i][k]

ans=INF
for root in permutations(r):
  cnt=0
  for i in range(R-1):
    cnt+=d[root[i]-1][root[i+1]-1]
    if cnt>ans:
      break
  ans=min(ans,cnt)
print(ans)
### BUGGY CODE ###

def factors(n):
    gaps = [1,2,2,4,2,4,2,4,6,2,6]
    length, cycle = 11, 3
    f, fs, nxt = 2, [], 0
    while f * f <= n:
        while n % f == 0:
            fs.append(f)
            n /= f
        f += gaps[nxt]
        nxt += 1
        if nxt == length:
            nxt = cycle
    if n > 1: fs.append(n)
    return fs

import itertools
import numpy as np

def powerset(L):
  pset = set()
  for n in range(len(L) + 1):
    for sset in itertools.combinations(L, n):
      pset.add(sset)
  return pset
    
def list_diff(first, second):
        first = first.copy()
        for s in second:
            first.remove(s)
        return first

def main():
    N = int(input())
    facs = factors(N)
    st = powerset(facs)

    mn_ij = 10**12
    for i in st:
        i = list(i)
        j = list_diff(facs, i)
        i, j = np.prod(i), np.prod(j)

        mn_ij = min(mn_ij, i+j)

    print(int(mn_ij-2))

if __name__ == "__main__":
    main()


### FIXED CODE ###

import math

def main():
    N = int(input())
    rt_N = math.ceil(math.sqrt(N))

    mn_ij = 10**12
    for i in range(1, rt_N+1):
        if N % i == 0:
            j = N // i

            mn_ij = min(mn_ij, i+j)
        
        mn_ij = min(mn_ij, i+j)

    # print(list(map(len,[ st, facs]) ))
    print(int(mn_ij-2))

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

# -*- coding: utf-8 -*-
a,b = map(int, input().split())
c = str(input())
d = [list(map(int, input().split())) for i in range(0,b)]

for i in d:
    moji = c[i[0]-1:i[1]]
    count = 0
    for t in range(0,len(moji)-1):
        if moji[t]+moji[t+1] == "AC":
            count = count + 1
    print(count)

### FIXED CODE ###

# -*- coding: utf-8 -*-
from itertools import accumulate
a,b = map(int, input().split())
c = str(input())
d = [list(map(int, input().split())) for i in range(0,b)]

flg = []
for i in range(a-1):
    moji = c[i:i+2]
    if moji == "AC":
        flg.append(1)
    else:
        flg.append(0)

flg2 = [0] + flg
flg2 = list(accumulate(flg2))

for a in d:
    print(flg2[a[1]-1] - flg2[a[0]-1])
### BUGGY CODE ###

from collections import defaultdict
from copy import copy
from queue import Queue

H, W = map(int, input().split())

maze = []
for _ in range(H):
  maze.append([i for i in input()])
  
# 無向グラフを作ってワーシャルフロイド法で解く

inf = float("inf")
d = defaultdict(lambda: inf)
for i in range(H):
  for j in range(W):
    if maze[i][j] == '.':
      d[((i, j), (i, j))] = 0

directions = [(-1, 0), (1, 0), (0, -1), (0, 1)]
for i in range(H):
  for j in range(W):
    if maze[i][j] == '.':
      for di, dj in directions:
        if i + di >= 0 and i + di < H\
        and j + dj >= 0 and j + dj < W\
        and maze[i + di][j + dj] == '.':
          d[((i, j), (i + di, j + dj))] = 1
          d[((i + di, j + dj), (i, j))] = 1

            
# 連結成分ごとにワーシャルフロイド法を実行し、最大距離を計算する
for i1 in range(H):
  for j1 in range(W):
    for i2 in range(H):
      for j2 in range(W):
        for i3 in range(H):
          for j3 in range(W):
            d[((i1, j1), (i3, j3))]\
            = min(
              d[((i1, j1), (i3, j3))],
              d[((i1, j1), (i2, j2))] + d[((i2, j2), (i3, j3))]
            )

# 全ての連結成分の最大距離を求めて出力

ret = 0
for i1 in range(H):
  for j1 in range(W):
    for i2 in range(H):
      for j2 in range(W):
        if d[((i1, j1), (i2, j2))] != inf\
        and d[((i1, j1), (i2, j2))] > ret:
          ret = d[((i1, j1), (i2, j2))]
          
print(ret)

### FIXED CODE ###

import bisect
import math
from queue import Queue
import sys
from copy import copy, deepcopy
from collections import defaultdict, Counter, deque
from itertools import combinations, permutations
from heapq import heapify, heappop, heappush

read = sys.stdin.read
readline = sys.stdin.readline 
readlines = sys.stdin.readlines 


inf = float("inf")

def main():

    H, W = map(int, readline().split())
    S = [[s for s in input()] for h in range(H)]
    
    ret = 0
    
    delta = [(-1, 0), (1, 0), (0, -1), (0, 1)]
    
    
    
    for h in range(H):
        for w in range(W):
            if S[h][w] == '.':
                tmp_ret = 0
                maze = deepcopy(S)
                maze[h][w] = tmp_ret
                
                q1 = Queue()
                q1.put((h, w))
                
                q2 = Queue()
                
                while not (q1.empty() and q2.empty()):
                    while not q1.empty():
                        h, w = q1.get()
                        for dh, dw in delta:
                            if h + dh < H and h + dh >= 0 \
                            and w + dw < W and w + dw >= 0 \
                            and maze[h + dh][w + dw] == '.':
                                maze[h + dh][w + dw] = tmp_ret
                                q2.put((h + dh, w + dw))

                    if not q2.empty():
                        q1 = q2
                        q2 = Queue()
                        tmp_ret += 1
                        
                ret = max(ret, tmp_ret)
    
    print(ret)


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

x=int(input())
cnt=0
i=0
while x>0:
    if cnt%2 == 0:
        x -= 6
        cnt += 1
    else:
        x -= 5
        cnt += 1
print(cnt)

### FIXED CODE ###

x=int(input())
a=(x//11)*2
if x%11 == 0:
    b=0
elif x%11 <= 6:
    b=1
else:
    b=2
print(a+b)
### BUGGY CODE ###

x = int(input())
a = 2
b = 0
A = []
A.append(1 ** 5 - x)

while True:
    if (a + 1) ** 5 - a ** 5 > 10 ** 9:
        break
    A.append(a ** 5 - x)
    a = a + 1

while True:
    if b ** 5 in A:
        break
    elif -b ** 5 in A:
        b = -b
        break
    b = b + 1

a = int((x + b ** 5) ** 0.2)

print(a, b)

### FIXED CODE ###

x = int(input())
a = 2
b = 0
A = []
A.append(1 ** 5 - x)

while True:
    if (a + 1) ** 5 - a ** 5 > 10 ** 10:
        break
    A.append(a ** 5 - x)
    a = a + 1

while True:
    if b ** 5 in A:
        break
    elif -b ** 5 in A:
        b = -b
        break
    b = b + 1

a = int((x + b ** 5) ** 0.2)

print(a, b)