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


N = int(input())


def count_divisors(x):
    count = 0
    for i in range(1,int(x**(1/2))+1):
        if x%i == 0:
            count += 2
        if x%i == 0 and i == x**(1/2):
            count -= 1
    return count
ans = 0
for n in range(1,N+1):
    
    ans += n * count_divisors(n)
print(ans)

### FIXED CODE ###

import sys
import math
import itertools
import collections
from collections import deque

sys.setrecursionlimit(1000000)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline().strip()

NI = lambda: int(input())
NMI = lambda: map(int, input().split())
NLI = lambda: list(NMI())
SI = lambda: input()

def main():
    N = NI()
    ans = 0
    for n in range(1,N+1):
        ans += (N//n)*(2*n+(N//n-1)*n)//2
    print(ans)


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

import itertools

n, m = [int(_) for _ in input().split()]
a = []
b = []
for i in range(0, m):
    ai, bi = [int(_) for _ in input().split()]
    a.append(ai)
    b.append(bi)

flag = False
for i, j in itertools.product(range(0, m), range(0, m)):
    if a[i] == 1 and b[i] == a[j] and b[j] == n:
        flag = True

if flag:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

import itertools

n, m = [int(_) for _ in input().split()]
a = []
b = []
for i in range(0, m):
    ai, bi = [int(_) for _ in input().split()]
    a.append(ai)
    b.append(bi)

first = [b[i] for i in range(0, m) if a[i] == 1]
second = [a[i] for i in range(0, m) if b[i] == n]

if set(first) & set(second):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
### BUGGY CODE ###

import itertools

N = int(input())
S = input()
delete_length = N - 3
pass_dict = {}

count = 0
for c in itertools.combinations(range(N), delete_length):
    pass_word = ''
    for i in range(N):
        if i not in c:
            pass_word = pass_word + S[i]
    
    if pass_word not in pass_dict:
        pass_dict[pass_word] = 1
        count += 1

print(count)

### FIXED CODE ###

def I(): return int(input())
N = I()
S = input()
ans = 0
for i in range(1000):
    num = str(i).zfill(3)
    if S.find(num[0])==-1:
        continue
    S1 = S[S.find(num[0])+1:]
    if S1.find(num[1])==-1:
        continue
    S2 = S1[S1.find(num[1])+1:]
    if S2.find(num[2])==-1:
        continue
    ans += 1
print(ans)
### BUGGY CODE ###

h, w, m = map(int, input().split())
bord_x, bord_y = [0 for i in range(h)], [0 for i in range(w)]
bord = [[0 for _j in range(w)] for _i in range(h)]

hw = []
for _i in range(m):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    bord_x[s] += 1
    bord_y[t] += 1
    hw.append([s, t])

x_max, y_max = max(bord_x), max(bord_y)

cnt = 0
for i, j in hw:
    if bord_x[i] == x_max and bord_y[j] == y_max:
        cnt += 1

if cnt == bord_x.count(x_max)*bord_y.count(y_max):
    x_max -= 1

print(x_max+y_max)

### FIXED CODE ###

h, w, m = map(int, input().split())
bord_x, bord_y = [0]*h, [0]*w
 
hw = []
for _i in range(m):
    s, t = map(int, input().split())
    s -= 1
    t -= 1
    bord_x[s] += 1
    bord_y[t] += 1
    hw.append([s, t])
 
x_max, y_max = max(bord_x), max(bord_y)
 
cnt = 0
for i, j in hw:
    if bord_x[i] == x_max and bord_y[j] == y_max:
        cnt += 1
 
if cnt == bord_x.count(x_max)*bord_y.count(y_max):
    x_max -= 1
 
print(x_max+y_max)
### BUGGY CODE ###

N,S=map(int,input().split())
A=list(map(int,input().split()))
MOD=998244353
dp=[[0 for _ in range(S+1)] for _ in range(N+1)]
dp[0][0]=1
for i in range(N):
    for j in range(S+1):
        dp[i+1][j]+=dp[i][j]*2
        dp[i+1][j]%=MOD
        if j+A[i]<=S:
            dp[i+1][j+A[i]]+=dp[i][j]
            dp[i+1][j+A[i]]%=MOD
print(dp[-1][-1])

### FIXED CODE ###

N,S=map(int,input().split())
A=list(map(int,input().split()))
MOD=998244353
dp=[[0 for _ in range(S+1)] for _ in range(N+1)]
dp[0][0]=1
for i in range(N):
    for j in range(S+1):
        dp[i+1][j]+=dp[i][j]*2
        dp[i+1][j]%=MOD
        if j+A[i]<=S:
            dp[i+1][j+A[i]]+=dp[i][j]
            dp[i+1][j+A[i]]%=MOD
print(dp[-1][-1])
### BUGGY CODE ###

n, m = map(int, input().split())
a = [int(input()) for _ in range(m)]
MOD = 10 ** 9 + 7
# ---------------------------
dp = [0] * (n + 1)
dp[0] = 1
if (1 in a):
    dp[1] = 0
else:
    dp[1] = 1
# dp approach

for i in range(2, n + 1):
    if (i in a):
        dp[i] = 0
    else:
        dp[i] = dp[i - 1] + dp[i - 2]


print(dp[n] % MOD)


### FIXED CODE ###

n, m = map(int, input().split())
a = set([int(input()) for _ in range(m)])
'''
a = [0] * (10 ** 5)
for i in range(m):
    a[int(input())] = 1
'''

MOD = 10 ** 9 + 7
# ---------------------------
dp = [0] * (n + 1)
dp[0] = 1
if (1 in a):
    # if (a[1] == 1):
    dp[1] = 0
else:
    dp[1] = 1
# dp approach

for i in range(2, n + 1):
    if (i in a):
        # if (a[i] == 1):
        # (x in list)で探索すると、時間がかかるっぽい
        #dp[i] = 0
        continue
    elif (dp[i - 1] == 0 and dp[i - 2] == 0):
        print(0)
        exit()
    else:
        dp[i] = (dp[i - 1] + dp[i - 2]) % MOD


#print(dp[n] % MOD)
print(dp[n])
### BUGGY CODE ###

import itertools
import sys
H,N = map(int,input().split())
Attacks = [_ for _ in map(int,input().split())]
Attacks.sort(reverse = True)
if sum(Attacks) < H:
    print('No')
    sys.exit(0)
else:
    for i in range(1,N+1):
        if sum(Attacks[0:i]) >= H:
            print('Yes')
            sys.exit(0)
print('No')


### FIXED CODE ###

import sys
H,N = map(int,input().split())
Attacks = [_ for _ in map(int,input().split())]
if sum(Attacks) < H:
    print('No')
    sys.exit(0)
if sum(Attacks) >= H:
    print('Yes')
    sys.exit(0)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
from heapq import heappop, heappush
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
q = []
for i,b in enumerate(B):
    heappush(q,(-b,i))
answer = 0
while len(q)>0:
    b,i = heappop(q)
    b = -b
    if b < A[i]:
        answer = -1
        break
    sub = B[(i-1)%N] + B[(i+1)%N]
    t = ( b - A[i]) // sub
    if t == 0:
        if b == A[i]:
            continue
        answer = -1
        break
    B[i] -= sub * t
    answer += t
    heappush(q,(-B[i],i))
print(answer)



### FIXED CODE ###

import sys
input = sys.stdin.readline
from heapq import heappop, heappush
N = int(input())
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
q = []
for i,b in enumerate(B):
    heappush(q,(-b,i))
answer = 0
while len(q)>0:
    b,i = heappop(q)
    b = -b
    if b < A[i]:
        answer = -1
        break
    sub = B[(i-1)%N] + B[(i+1)%N]
    t = ( b - A[i]) // sub
    if t == 0:
        if b == A[i]:
            continue
        answer = -1
        break
    B[i] -= sub * t
    answer += t
    heappush(q,(-B[i],i))
print(answer)
### BUGGY CODE ###

n,k=(int(i) for i in input().split())
a=[[int(i) for i in input().split()] for i in range(n)]
#print(a)

ans=0
while ans < k:
    mina=min(a)
#    print(a)
    a.remove(mina)
    ans+=mina[1]
    
print(mina[0])


### FIXED CODE ###

n,k=(int(i) for i in input().split())
a=[[int(i) for i in input().split()] for i in range(n)]
#print(a)

a.sort()
i=0
ans=0
while ans < k:
    ans+=a[i][1]
    i+=1

print(a[i-1][0])
### BUGGY CODE ###

k = int(input())
if k % 2 == 0:
    print(-1)
else:
    val = 0
    for i in range(10**6+1):
        val = val * 10 + 7
        if val % k == 0:
            print(i+1)
            break

### FIXED CODE ###

k = int(input())
if k % 2 == 0:
    print(-1)
else:
    val = 0
    for i in range(10**6+1):
        val = (val * 10 + 7) % k
        if val % k == 0:
            print(i+1)
            break
        elif i == 10**6:
            print(-1)
### BUGGY CODE ###

master_list = list(map(int, input().split(' ')))

next_list = [x for x in range(master_list[0], master_list[1]+1)]

if master_list[2] >= len(next_list):
    print(*next_list, sep='\n')
else:
    a_list = next_list[0:master_list[2]]
    b_list = next_list[-master_list[2]:]
    last_list = sorted(list(set(a_list) | set(b_list)))
    print(*last_list, sep='\n')


### FIXED CODE ###

master_list = list(map(int, input().split(' ')))

sabun = master_list[1] - master_list[0]

if master_list[2] >= sabun:
    next_list = [x for x in range(master_list[0], master_list[1] + 1)]
    print(*next_list, sep='\n')
else:
    a_list = [x for x in range(master_list[0], master_list[0] + master_list[2])]
    b_list = [x for x in range(master_list[1], master_list[1] - master_list[2], -1)]
    last_list = sorted(list(set(a_list) | set(b_list)))
    print(*last_list, sep='\n')
### BUGGY CODE ###

x=int(input())
for i in range(x+1):
  for j in range(-abs(i)-1,x+1):
    a=i
    b=j
    if a**5-b**5==x:
      break
  else:
    continue
  break
print(a,b)


### FIXED CODE ###

x=int(input())
for a in range(150):
  for b in range(-150,150):
    if a**5-b**5==x:
      print(a,b)
      break
  else:
    continue
  break
### BUGGY CODE ###

k, s = map(int,input().split())
ans = 0
x = 0
y = 0
z = 0
for i in range(k+1):
    y = 0
    for n in range(k+1):
        z = 0
        for m in range(k+1):
            if x + y + z == s:
                ans += 1
            z += 1
        y += 1
    x += 1
print(ans)

### FIXED CODE ###

k, s = map(int,input().split())
x = 0
y = 0
z = 0
ans = 0
for i in range(k+1):
    for n in range(k+1):
        z = s - (i + n)
        if 0 <= z and z <= k:
            ans += 1
print(ans)
### BUGGY CODE ###

from collections import Counter

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

def prime_factorize(n):
    res = []
    i = 2
    while i * i <= n:
        if n % i == 0:
            res.append(i)
            n //= i
        else:
            i += 1 + (i != 2)
    if n != 1:
        res.append(n)
    return res


lcm_factors = Counter()
for ai in a:
    lcm_factors |= Counter(prime_factorize(ai))

lcm = 1
for k, v in lcm_factors.items():
    lcm *= pow(k, v, MOD)
    lcm %= MOD

ans = 0
for ai in a:
    ans += lcm * pow(ai, MOD - 2, MOD)
    ans %= MOD

print(ans)

### FIXED CODE ###

from collections import Counter

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

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,211,223,227,229,233,239,241,251,257,263,269,
271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,
389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,
503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,
631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,
757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,
883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997,
1009
]

def prime_factorize(n):
    res = []
    i = 0
    while primes[i] * primes[i] <= n:
        if n % primes[i] == 0:
            res.append(primes[i])
            n //= primes[i]
        else:
            i += 1
    if n != 1:
        res.append(n)
    return res


lcm_factors = Counter()
for ai in a:
    prime_factors = prime_factorize(ai)
    counter = Counter(prime_factors)
    for k, v in counter.items():
        if k in lcm_factors:
            lcm_factors[k] = max(lcm_factors[k], v)
        else:
            lcm_factors[k] = v

lcm = 1
for k, v in lcm_factors.items():
    lcm *= pow(k, v, MOD)
    lcm %= MOD

ans = 0
for ai in a:
    ans += lcm * pow(ai, MOD - 2, MOD)
    ans %= MOD

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

n,m=map(int,input().split())
a=[int(input()) for _ in range(m)]
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    dp[i]=(dp[i-2]+dp[i-1])%1000000007
    if i in a:
        dp[i]=0
print(dp[n])

### FIXED CODE ###

n,m=map(int,input().split())
a=set(int(input()) for _ in range(m))
dp=[0]*(n+1)
dp[0]=1
for i in range(1,n+1):
    dp[i]=(dp[i-2]+dp[i-1])%1000000007
    if i in a:
        dp[i]=0
print(dp[n])
### BUGGY CODE ###

import decimal
import math

N, K = map(int, input().split())
coin = [decimal.Decimal('0.5')**k for k in range(10**5)]
ans = 0

for i in range(1,N+1):
    tmp = decimal.Decimal(str(math.log2(K/i)))
    x = int(math.log2(K/i))
    if i >= K:
        ans += decimal.Decimal(1/N)
    else:
        if tmp - x != 0:
            x += 1
        ans += decimal.Decimal(1/N) * coin[x]

print(ans)


### FIXED CODE ###

import math
N,K = map(int,input().split())
ans = 0
 
for i in range(1,N+1):
    if i >= K:
        ans += (1/N)
        continue
    X = int(math.log((K/i), 2))
    if (K/i) % 2**X == 0:
        pass
    else:
        X += 1
    ans += (1/N) * (1/2) ** X
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n,m = map(int,input().split())
d = {}
pairs = []
for i in range(m):
    p,y = map(int,input().split())
    if p in d.keys():
        d[p].append(y)
    else:
        d.setdefault(p,[y])
    pairs.append((p,y))

for i in d.keys():
    d[i] = sorted(d[i])

for pairs_ele in pairs:
    p = pairs_ele[0]
    y = pairs_ele[1]
    x = d[p].index(y) + 1
    print('{:0=6}{:0=6}'.format(p,x))

### FIXED CODE ###

import sys
input = sys.stdin.readline

n, m = map(int, input().split())
pyi = []
for i in range(m):
    p,y= map(int, input().split())
    pyi.append([p,y,i]) #県番号、誕生年、市番号の順

pyi.sort(key=lambda x: x[1]) #誕生年でソート
pyi.sort(key=lambda x: x[0]) #県番号でソート
#県番号の順番で並びつつも、同県の中では誕生年順になっている

ken = 0 #県番号の初期化
for i in range(m):
    if pyi[i][0] != ken: #新しい県に突入した時
        ken = pyi[i][0] #県番号を更新
        x = 1 #xは同県内での順位を表す
    else: #前と同じ県の時
        x += 1 #同県内の順位は1つ手前の市+1
    pyi[i].append(x) #リストpyiの要素の各リストの末尾に同県内の順位を付け加える

pyi.sort(key=lambda x: x[2]) #出力順に直すために市番号でソート
for i in range(m): #県番号と同県内の順位をゼロ埋めして出力
    print(str(pyi[i][0]).zfill(6)+str(pyi[i][3]).zfill(6))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 11:26:39 2019
D - 連結 / Connectivity
実行時間制限: 2 sec / メモリ制限: 256 MB

配点 : 
400 点
@author: justwah
"""

class UnionFind:
    def __init__(self, N):
        self.rank = [0]*N
        self.parent = [i for i in range(N)]
        self.n = N
        
    def root(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]
        
    def merge(self, a, b):
        a = self.root(a)
        b = self.root(b)
        if a == b:
            return
        if self.rank[a] < self.rank[b]:
            self.parent[a] = b
        else:
            self.parent[b] = a
            if self.rank[a] == self.rank[b]:
                self.rank[a] +=1
                
    def same(self, a, b):
        return self.root(a) == self.roob(b)


n, k, l = map(int, input().split())
same = [0]*n

uf_road = UnionFind(n)
for _ in range(k):
    p, q = map(int, input().split())
    uf_road.merge(p-1, q-1)

uf_rail = UnionFind(n)
for _ in range(l):
    r, s = map(int, input().split())
    uf_rail.merge(r-1, s-1)
    
for i in range(n):
    for j in range(n):
        if (uf_road.parent[i] - uf_road.parent[j] == 0) \
            and (uf_rail.parent[i] - uf_rail.parent[j] == 0):
            same[i] +=1

for i in range(n):
    print(same[i], end = ' ')

### FIXED CODE ###

# -*- coding: utf-8 -*-
"""
Created on Wed Sep 11 11:26:39 2019
D - 連結 / Connectivity
実行時間制限: 2 sec / メモリ制限: 256 MB

配点 : 
400 点
@author: justwah
"""
from collections import Counter

class UnionFind:
    def __init__(self, N):
        self.rank = [0]*N
        self.parent = [i for i in range(N)]
        self.n = N
        
    def root(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.root(self.parent[x])
            return self.parent[x]
        
    def merge(self, a, b):
        a = self.root(a)
        b = self.root(b)
        if a == b:
            return
        if self.rank[a] < self.rank[b]:
            self.parent[a] = b
        else:
            self.parent[b] = a
            if self.rank[a] == self.rank[b]:
                self.rank[a] +=1
                
    def same(self, a, b):
        return self.root(a) == self.roob(b)


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

uf_road = UnionFind(n)
for _ in range(k):
    p, q = map(int, input().split())
    uf_road.merge(p-1, q-1)

uf_rail = UnionFind(n)
for _ in range(l):
    r, s = map(int, input().split())
    uf_rail.merge(r-1, s-1)
    
ctr = Counter()
for i in range(n):  # make a list to count number of cities that both road and rail-wise are in the same group
    r1 = uf_road.root(i)
    r2 = uf_rail.root(i)
    ctr[(r1,r2)] += 1

ans = []
for i in range(n): # print the group size of that city when looped
    r1 = uf_road.root(i)
    r2 = uf_rail.root(i)
    ans.append(ctr[(r1,r2)])

print(*ans)   # * is for unpack the list
### BUGGY CODE ###

#X = ["a", "ba", "zxx", "abb", "ab"]
#print(sorted(X))

s = str(input())
K = int(input())
ans = []
N = len(s)

for i in range(N):
  for j in range(i + 1,N + 1):
    x = s[i:j]
    if x not in ans:
      ans.append(x)
#print(ans)
  
print(sorted(ans)[K - 1])


### FIXED CODE ###

#X = ["a", "ba", "zxx", "abb", "ab"]
#print(sorted(X))

s = str(input())
K = int(input())
ans = []
N = len(s)

for i in range(N):
  y = min(N + 1, i + K + 1)
  for j in range(i + 1,y):
    x = s[i:j]
    if x not in ans:
      ans.append(x)
#print(ans)
  
print(sorted(ans)[K - 1])
### BUGGY CODE ###

import math
n, m = map(int, input().split())
a = list(map(int, input().split()))
for i in range(m):
  a.sort()
  a[-1] /= 2
  #print(a)
for i in range(n):
  a[i] = math.floor(a[i])
#print(a)
print(sum(a))


### FIXED CODE ###

from collections import deque
n,m = list(map(int,input().split()))
a = list(map(int,input().split()))

A = deque(sorted(a,reverse=True))
B = deque([])

for _ in range(m):
    #if _ % (m//10) == 0: print(A, B)
    if A:
        if B:
            if (A[0] > B[0]):
                B.append(A.popleft()//2)
                continue
        else:
            B.append(A.popleft()//2)
            continue
    b = B.popleft()
    B.append(b//2)

print(sum(A)+sum(B))
### BUGGY CODE ###

import numpy as np

N = int(input())
a = list(map(int,input().split()))
dp = [0] * (N+1)
dp[0] = abs(a[0])
for i in range(1, N):
    dp[i] = abs(a[i]-a[i-1])
dp[N] = abs(a[-1])

for i in range(N):
    ans = sum(dp)
    ans -= dp[i]+dp[i+1]
    if i == 0:
        ans += abs(a[i+1])
    elif i == N-1:
        ans += abs(a[i-1])
    else:
        ans += abs(a[i+1] - a[i-1])
    print(ans)


### FIXED CODE ###

import numpy as np

N = int(input())
a = list(map(int,input().split()))
dp = [0] * (N+1)
dp[0] = abs(a[0])
for i in range(1, N):
    dp[i] = abs(a[i]-a[i-1])
dp[N] = abs(a[-1])
result = sum(dp)
for i in range(N):
    ans = result
    ans -= dp[i]+dp[i+1]
    if i == 0:
        ans += abs(a[i+1])
    elif i == N-1:
        ans += abs(a[i-1])
    else:
        ans += abs(a[i+1] - a[i-1])
    print(ans)
### BUGGY CODE ###

N = int(input())

sum = 0
tmp = N
while tmp > 0:
  sum += tmp % 10
  tmp // 10
if N % sum == 0:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N = int(input())
 
sum = 0
tmp = N
while tmp > 0:
  sum += tmp % 10
  tmp //= 10
if N % sum == 0:
  print("Yes")
else:
  print("No")
### BUGGY CODE ###

from sys import stdin, gettrace
import sys
sys.setrecursionlimit(1000000)
if not gettrace():
    def input():
        return next(stdin)[:-1]
 
 
# def input():
#    return stdin.buffer.readline()

def recursion(s1,s2,i,j,n1,n2,dp):
    if i>=n1 or j>=n2:
        return ""   
    if s1[i]==s2[j]:
        if dp[i+1][j+1]==-1:
            string=recursion(s1,s2,i+1,j+1,n1,n2,dp)
            dp[i+1][j+1]=string
        else:
            string=dp[i+1][j+1]
        return s1[i]+string
    else:
        if dp[i+1][j]==-1:
            x=recursion(s1,s2,i+1,j,n1,n2,dp)
            dp[i+1][j]=x
        else:
            x=dp[i+1][j]
        if dp[i][j+1]==-1:
            y=recursion(s1,s2,i,j+1,n1,n2,dp)
            dp[i][j+1]=y
        else:
            y=dp[i][j+1]
        if len(x)>len(y):
            return x
        else:
            return y

def main():
    s1=input()
    s2=input()
    n1,n2=len(s1),len(s2)
    dp=[[-1 for j in range(n2+1)] for i in range(n1+1)]
    print(recursion(s1,s2,0,0,len(s1),len(s2),dp))
 
 
if __name__ == "__main__":
    main()

### FIXED CODE ###

s1=input()
s2=input()
n1,n2=len(s1),len(s2)
dp=[[-1 for j in range(n2+1)] for i in range(n1+1)]
for i in range(n1,-1,-1):
    for j in range(n2,-1,-1):
        if i==n1 or j==n2:
            dp[i][j]=0
        else:
            if s1[i]==s2[j]:
                dp[i][j]=1+dp[i+1][j+1]
            else:
                dp[i][j]=max(dp[i][j+1],dp[i+1][j])
n=""
i,j=0,0
while i<n1 and j<n2:
    if dp[i][j]==dp[i+1][j]:
        i+=1
    elif dp[i][j]==dp[i][j+1]:
        j+=1
    else:
        n+=s1[i]
        i+=1
        j+=1
print(n)
### BUGGY CODE ###

N, M = map(int, input().split())
A = []
for _ in range(M):
    A.append(int(input()))

case = [0] * (N + 1)
case[0] = 1
if not 1 in A:
    case[1] = 1
for x in range(2, N + 1):
    if x in A:
        case[x] = 0
    elif x - 1 in A:
        case[x] = case[x - 2]
    else:
        case[x] = case[x - 1] + case[x - 2] % 1000000007

print(case[N]%1000000007)

### FIXED CODE ###

N, M = map(int, input().split())
A = [1] * (N + 1)
ans = [0] * (N + 1)
ans[0] = 1
for _ in range(M):
    A[int(input())] = 0
for i in range(1, N + 1):
    ans[i] = (ans[i - 2] * A[i - 2] + ans[i - 1] * A[i - 1]) % 1000000007

print(ans[N])
### BUGGY CODE ###


import numpy as np
nl = lambda: list(map(int, input().split()))
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())

yokos = []
for row in range(H):
    count = 0
    yoko = []
    for col in range(W):
        if grid[row][col] == '.':
            count += 1
        else:
            yoko.extend([count] * count)
            yoko.append(0)
            count = 0
    if count > 0:
        yoko.extend([count] * count)
    yokos.append(yoko)


tates = []
for col in range(W):
    count = 0
    tate = []
    for row in range(H):
        if grid[row][col] == '.':
            count += 1
        else:
            tate.extend([count] * count)
            tate.append(0)
            count = 0
    if count > 0:
        tate.extend([count] * count)
    tates.append(tate)

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, yokos[row][col] + tates[col][row] - 1)

print(int(res))




### FIXED CODE ###

nl = lambda: list(map(int, input().split()))
sl = lambda: input().split()
n = lambda: int(input())
s = lambda: input()

H, W = nl()
grid = []
for i in range(H):
    grid.append(s())

ups = [[0]*W for j in range(H)]
downs = [[0]*W for j in range(H)]
lefts = [[0]*W for j in range(H)]
rights = [[0]*W for j in range(H)]

for col in range(W):
    p = 0
    for row in range(H):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        ups[row][col] = p

    p = 0
    for row in range(H-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        downs[row][col] = p

for row in range(H):
    p = 0
    for col in range(W):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        lefts[row][col] = p

    p = 0
    for col in range(W-1, -1, -1):
        if grid[row][col] == '#':
            p = 0
        else:
            p += 1
        rights[row][col] = p

res = 0
for row in range(H):
    for col in range(W):
        res = max(res, ups[row][col] + downs[row][col] + lefts[row][col] + rights[row][col] -3)
print(res)