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

L,R=[int(x) for x in input().strip().split()]

ans=10**9+1
for i in range(L,R+1,1):
  for j in range(L,R+1,1):
    if i<j:
      ans=min(i*j%2019,ans)
print(ans)
  

  
      





### FIXED CODE ###

import sys
L,R=[int(x) for x in input().strip().split()]

tmp=10**9+1
ans=10**9+1

for i in range(L,R,1):
  for j in range(L+1,R+1,1):
    if i<j:
      ans=min((i*j)%2019,ans)
  
      if ans==0:
        print(0)
        sys.exit()
print(ans)


# 332701087 1753412895
### BUGGY CODE ###

N = int( input() )
A = list(map(int, input().split() ))
S = sum(A)
A.extend(A)
odds = range(0,N,2)
Ans=[-S + 2*sum([s for s,num in zip(A[i:i+N], range(N)) if num in odds] )
     for i in range(N) ]
print(" ".join(map(str,Ans) ))

### FIXED CODE ###

N = int( input() )
A = list(map(int, input().split() ))
S = sum(A)
odds = range(0,N,2)
Ans=[]
Ans.append(-S + 2*sum([s for s,num in zip(A, range(N)) if num in odds] ) )
for i in range(1,N):
    Ans.append(2*A[i-1]-Ans[i-1])
print(" ".join(map(str,Ans) ))
### BUGGY CODE ###

s = str(input())
ans = 0 

for st in ['01', '10']:
    while st in s:
        for i in range(len(s)):
            if s[i:i+2] == st:
                if i > 0 and i + 2 < len(s):
                    s = s[:i] + s[i+2:]
                elif i == 0:
                    s = s[i+2:]
                elif i + 2 == len(s):
                    s = s[:i]
                ans += 2

print(ans)


### FIXED CODE ###

s = str(input())
z = sum([str(x)=='0' for x in s])
o = sum([str(x)=='1' for x in s])
print(2*min(z, o))
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache
import bisect

input = sys.stdin.readline

# N個整数
x, y, z, k = list(map(int, input().split()))

# 1整数
# n = int(input())

# 空白区切りリスト整数
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))

a.sort(reverse=True)
b.sort(reverse=True)
ll = []
for i in a:
    for j in b:

        if len(ll) > 3001 and ll[0] > i + j:
            break
        else:
            bisect.insort(ll, i + j)

ll = ll[0:3000]
c.sort(reverse=True)

lll = [0] * 3000001
for i in ll:
    for j in c:

        if len(lll) > 3001 and lll[0] > i + j:
            break
        else:
            bisect.insort(lll, i + j)

lll.reverse()

for i in range(k):
    print(lll[i])

# 空白区切り文字列
# t, d = input().split()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import itertools
import sys
import math
from functools import lru_cache

# 1整数
# n = int(input())

# 空白区切り2変数
from queue import Queue
from operator import mul
from functools import reduce
from queue import Queue
from operator import mul
from functools import reduce
from functools import lru_cache

input = sys.stdin.readline

# N個整数
x, y, z, kk = list(map(int, input().split()))

# 1整数
# n = int(input())

# 空白区切りリスト整数
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)


ll = []
count = 0
for i in range(len(a)):
    for j in range(len(b)):
        if i * j > kk:

            break
        for k in range(len(c)):
            if i * j * k > kk:
                break
            ll.append(a[i] + b[j] + c[k])
ll.sort(reverse=True)

for i in range(kk):
    print(ll[i])

# 空白区切り文字列
# t, d = input().split()
### BUGGY CODE ###

n=int(input())
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]

ab=[]
for B in b:
    for A in a:
        if B>A:
            ab+=[B]
ans=0
for AB in ab:
    for C in c:
        if AB<C:
            ans+=1
print(ans)

### FIXED CODE ###

import bisect
n=int(input())
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()])
ans=0
for B in b:
    m=bisect.bisect_left(a,B)
    l=bisect.bisect_right(c,B)
    ans+=m*(n-l)
print(ans)
### BUGGY CODE ###

from logging import *
basicConfig(level=DEBUG, format='%(levelname)s: %(message)s')
# disable(CRITICAL)

n = int(input())
X = input()
debug('n {}'.format(n))
debug('X {}'.format(X))
po = X.count('1')

# if po == 0:
#     print(0)
#     exit()

pp = po + 1
pm = max(1, po - 1)

rp = 0
rm = 0
for x in X:
    rp = (rp*2 + int(x)) % pp
    rm = (rm*2 + int(x)) % pm

bp = [0]*(n) # 2^i % (po+1)
bm = [0]*(n) # 2^i % (po-1)
bp[n-1] = 1 % pp
bm[n-1] = 1 % pm
for i in range(n-1,0,-1):
    bp[i-1] = bp[i]*2 % pp
    bm[i-1] = bm[i]*2 % pm

debug('po {}'.format(po))
debug('pp {}'.format(pp))
debug('pm {}'.format(pm))
debug('rp {}'.format(rp))
debug('rm {}'.format(rm))
debug('bp {}'.format(bp))
debug('bm {}'.format(bm))
debug('===')

def popcount(x):
    c = 0
    while x > 0:
        if x & 1: c += 1
        x //= 2
    return c

def f(x):
    if x==0: return 0
    return f(x % popcount(x)) + 1

for i in range(n):
    if X[i] == '0':
        ri = (rp + bp[i]) % pp
    else: # '1'
        if po-1 != 0: ri = (rm - bm[i]) % pm
        else:
            print(0)
            continue
    debug('i {} ri {}'.format(i,ri))
    c = f(ri) + 1
    debug('c {}'.format(c))
    print(c)



### FIXED CODE ###

from logging import *
basicConfig(level=DEBUG, format='%(levelname)s: %(message)s')
disable(CRITICAL)

n = int(input())
X = input()
debug('n {}'.format(n))
debug('X {}'.format(X))
po = X.count('1')

# if po == 0:
#     print(0)
#     exit()

pp = po + 1
pm = max(1, po - 1)

rp = 0
rm = 0
for x in X:
    rp = (rp*2 + int(x)) % pp
    rm = (rm*2 + int(x)) % pm

bp = [0]*(n) # 2^i % (po+1)
bm = [0]*(n) # 2^i % (po-1)
bp[n-1] = 1 % pp
bm[n-1] = 1 % pm
for i in range(n-1,0,-1):
    bp[i-1] = bp[i]*2 % pp
    bm[i-1] = bm[i]*2 % pm

debug('po {}'.format(po))
debug('pp {}'.format(pp))
debug('pm {}'.format(pm))
debug('rp {}'.format(rp))
debug('rm {}'.format(rm))
debug('bp {}'.format(bp))
debug('bm {}'.format(bm))
debug('===')

def popcount(x):
    c = 0
    while x > 0:
        if x & 1: c += 1
        x //= 2
    return c

def f(x):
    if x==0: return 0
    return f(x % popcount(x)) + 1

for i in range(n):
    if X[i] == '0':
        ri = (rp + bp[i]) % pp
    else: # '1'
        if po-1 != 0: ri = (rm - bm[i]) % pm
        else:
            print(0)
            continue
    debug('i {} ri {}'.format(i,ri))
    c = f(ri) + 1
    debug('c {}'.format(c))
    print(c)
### BUGGY CODE ###

from operator import mul
from functools import reduce

def ncr(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


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

numList = [0] * (2*(10**5))
numSet = set()

for i in range(len(a)):
    numList[a[i]] += 1
    if(numList[a[i]]==2):
        numSet.add(a[i])

for i in range(len(a)):
    s = 0
    for j in numSet:
        if(j == a[i]):
            if(numList[j]>2):
                s += ncr(numList[j]-1,2)
        else:
            s += ncr(numList[j],2)
    print(s)

    


### FIXED CODE ###

from operator import mul
from functools import reduce

def ncr(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce(mul, range(n, n - r, -1))
    under = reduce(mul, range(1,r + 1))
    return over // under


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

numList = [0] * (n+1)
numSet = set()

ncrList = [0] * (n+1)

resultList = [0] * (n+1)
resultSet = set()

for i in range(len(a)):
    numList[a[i]] += 1
    if(numList[a[i]]==2):
        numSet.add(a[i])

sums = 0
for i in numSet:
    ncrList[i] = ncr(numList[i], 2)
    sums += ncrList[i]

for i in range(len(a)):
    if(a[i] in resultSet):
        print(resultList[a[i]])
        continue
    s = sums
    if(a[i] in numSet):
        if(numList[a[i]] == 2):
            s -= 1
        else:
            s -= ncrList[a[i]]
            s += ncr(numList[a[i]]-1, 2)
    print(s)
    resultList[a[i]] = s
    resultSet.add(a[i])
### BUGGY CODE ###


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

w = [0]*N
v = [0]*N
Vmax = [[0 for i in range(W+1)] for j in range(N+1)]

for i in range(N):
    w[i],v[i] = map(int, input().split())


# i個目の品物を追加
for i in range(N):
    for j in range(W+1):
        if j<w[i]:
            Vmax[i+1][j] = Vmax[i][j]
            continue        
        if Vmax[i][j-w[i]] + v[i] <= Vmax[i][j]:
            Vmax[i+1][j] = Vmax[i][j]
            continue
        else:
            Vmax[i+1][j] = Vmax[i][j-w[i]] + v[i]      


            
print(Vmax[N][W])


### FIXED CODE ###


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

w = [0 for i in range(N)]
v = [0 for i in range(N)]
Wsum = [0 for i in range(N+1)]
Vsum = [0 for i in range(N+1)]

for i in range(N):
    w[i],v[i] = map(int, input().split())
Wmin = min(w)

w.insert(0,"0")
v.insert(0,"0")


for i in range(N):
    Wsum[i+1] = Wsum[i] + w[i+1]
    Vsum[i+1] = Vsum[i] + v[i+1]


nap_memo = {}

#i番目の品物まで含み制約W2のナップサック問題の最適解
def nap(i,W2):
    #重複計算を避けるためnap(i,W2)を保持
    key = str(i) + ':' + str(W2)
    if key in nap_memo:
        return nap_memo[key]
    #品物0個のときは価値は0
    elif i == 0:
        r = 0
    #制約0のときも価値は0
    elif W2 < Wmin:
        r = 0
    #w[i]がW2を超えるときはi番目の品物は不必要
    elif W2 < w[i]:
        r = nap(i-1,W2)
    #品物の重さ全部足して制約以下なら全部足したものが価値で良い
    elif Wsum[i] <= W2:
        r = Vsum[i]
    #i番目の品物をナップサックに入れるか入れないか
    else:
        r = max( nap(i-1,W2-w[i])+v[i] , nap(i-1,W2) )
    
    nap_memo[key] = r
    return r
    
            
print(nap(N,W))
### BUGGY CODE ###

N = int(input())
P = list(map(int, input().split()))

count = 0
for i in range(N):
  if all(list(map(lambda x: x >= P[i], P[:i]))):
  	count += 1
print(count)


### FIXED CODE ###

N = int(input())
P = list(map(int, input().split()))

count = 0
m = P[0]
for i in range(N):
  if (m >= P[i]):
    count += 1
    m = P[i]
print(count)
### BUGGY CODE ###

N = 0
nodes = []

def GetReachableNodes(s, l, r):
    c = 0
    slL = None
    slR = len(nodes[s])
    for n in nodes[s]:
        if n >= l and slL == None:
            if n > r:
                break
            slL = c
        if n > r:
            slR = c
            break
        c += 1
    return [] if slL == None else nodes[s][slL:slR]

    
try:
    N = int(input())
    nodes = [[] for i in range(N)]
    for i in range(N - 1):
        line = input().split()
        u = int(line[0])
        v = int(line[1])
        nodes[u - 1].append(v - 1)
        nodes[v - 1].append(u - 1)
    for i in range(N):
        nodes[i].sort()
except:
  pass

#print(nodes)

nSubGraphs = 0
for l in range(N):
    for r in range(l, N):
        #print(l, r)
        checked = []
        for s in range(l, r + 1):
            if s not in checked:
                checked.append(s)
                #print(s)
                reachableNodes = GetReachableNodes(s, l, r)
                while len(reachableNodes) > 0:
                    nextReachableNodes = []
                    for i in reachableNodes:
                        nextReachableNodes += [n for n in GetReachableNodes(i, l, r) if n not in checked and n not in nextReachableNodes]
                    #print(reachableNodes, nextReachableNodes)
                    checked += reachableNodes
                    reachableNodes = nextReachableNodes
                nSubGraphs += 1
            
print(nSubGraphs)

### FIXED CODE ###

N = 0
a = 0

try:
    N = int(input())
    for i in range(N + 1):
        a += i * (i + 1) // 2
    for i in range(N - 1):
        line = input().split()
        u = min(int(line[0]), int(line[1])) - 1
        v = max(int(line[0]), int(line[1])) - 1
        a -= (u + 1) * (N - v)        
except:
  pass

print(a)
### BUGGY CODE ###

N = int(input())
K = list(str(input()))
count = 0
for i in range(N-2):
    for j in range(i,N-1):
        for k in range(j,N):
            if K[i] != K[j]:
                if K[i] != K[k]:
                    if K[j] != K[k]:
                        if j-i != k-j:
                            count += 1
print(count)

### FIXED CODE ###

N = int(input())
K = list(str(input()))
R = 0
G = 0
B = 0
for i in range(N):
    if K[i] == 'R':
        R += 1
    if K[i] == 'G':
        G += 1
    if K[i] == 'B':
        B += 1

count = 0
for i in range(N-2):
    for j in range((N-3-i)//2 + 1):
        if K[i] != K[i+j+1]:
            if K[i+j+1] != K[i+j+j+2]:
                if K[i+j+j+2] != K[i]:
                    count += 1

print(R*G*B - count)
### BUGGY CODE ###

from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
L = defaultdict(list)
R = defaultdict(list)
for i in range(N):
    L[i + A[i]].append(i)
    R[i - A[i]].append(i)

# print(L)
# print(R)
ans = 0
for k in L.keys():
    l = L[k]
    r = R[k]
    cnt = 0
    for i in l:
        for j in r:
            if i < j:
                ans += 1
print(ans)

### FIXED CODE ###

from collections import defaultdict
N = int(input())
A = list(map(int, input().split()))
L = defaultdict(int)
R = defaultdict(int)
for i in range(N):
    L[i + A[i]] += 1
    R[i - A[i]] += 1

ans = 0
for k, v in L.items():
    ans += v * R[k]
print(ans)
### BUGGY CODE ###

S = input()
Q = int(input())
reverse = 0
head = []
tail = []
for i in range(Q):
    s = input().split()
    if int(s[0]) == 1:
        reverse = (reverse + 1) % 2
    else:
        if int(s[1]) == 1:
            if reverse == 1:
                tail.append(s[2])
            else:
                head.insert(0, s[2])
        else:
            if reverse == 1:
                head.insert(0, s[2])
            else:
                tail.append(s[2])
head = ''.join(head)
tail = ''.join(tail)
if reverse == 1:
    print(tail[::-1]+S[::-1]+head[::-1])
else:
    print(head+S+tail)

### FIXED CODE ###

def main():
    from sys import stdin
    from collections import deque
    S = input()
    Q = int(input())
    reverse = 0
    head = []
    tail = []
    head_deque = deque(head)
    tail_deque = deque(tail)
    
    for _ in [0] * Q:
        readline = stdin.readline
        s = readline().split()
        if int(s[0]) == 1:
            if reverse == 1:
                reverse = 0
            else:
                reverse = 1
        else:
            if int(s[1]) == 1:
                if reverse == 1:
                    tail.append(s[2])
                else:
                    head_deque.appendleft(s[2])
            else:
                if reverse == 1:
                    head_deque.appendleft(s[2])
                else:
                    tail.append(s[2])
    head = list(head_deque)
    head = ''.join(head)
    tail = ''.join(tail)
    if reverse == 1:
        print(tail[::-1]+S[::-1]+head[::-1])
    else:
        print(head+S+tail)
        
main()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n,k,q = map(int,input().split())
a = [int(input()) for i in range(q)]
for j in range(1,n+1):
  print('Yes' if (k + a.count(j) - q)>0 else 'No')


### FIXED CODE ###

import sys
input = sys.stdin.readline
n,k,q = map(int,input().split())
a = [int(input()) for i in range(q)]
ip = [k-q]*(n+1)
for j in a:
  ip[j] += 1
ans = '\n'.join('Yes' if p > 0 else 'No' for p in ip[1:])
print(ans)
### BUGGY CODE ###

from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    for a in A:
        ans *= a
    if ans > pow(10, 18):
        ans = -1
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from functools import reduce
from fractions import gcd
import math
import bisect
import itertools
import sys
sys.setrecursionlimit(10**7)
input = sys.stdin.readline
INF = float("inf")


# 処理内容
def main():
    N = int(input())
    A = list(map(int, input().split()))
    ans = 1
    if 0 in A:
        ans = 0
    else:
        for a in A:
            ans *= a
            if ans > 1000000000000000000:
                ans = -1
                break
    print(ans)


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

N,M = map(int,input().split())
A = list(map(int,input().split()))
L = []
for i in range(M) :
    b,c = map(int,input().split())
    L.append([b,c])

L = sorted(L,key=lambda x: x[1], reverse=True)
for i in range(len(L)) :
    b,c = L[i]
    b = min(b,10**9-len(A))
    A.extend([c]*b)
ans = sum(sorted(A,reverse=True)[:N])

print(ans)

### FIXED CODE ###

N,M = map(int,input().split())
A = list(map(int,input().split()))
L = [list(map(int,input().split())) for i in range(M)]

P = sorted(([[1,A[i]] for i in range(N)] + L),key=lambda x: x[1],reverse=True)

ans = 0
rest = N

for cost,value in P :
    K = min(cost, rest)
    K = max(0,K)
    ans += K * value
    rest -= cost

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

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

primes = {}

for val in a:
    p = 2
    while p * p <= val:
        if val % p == 0:
            cnt = 0
            while val % p == 0:
                cnt += 1
                val //= p
            if p not in primes:
                primes[p] = cnt
            else:
                primes[p] = max(cnt, primes[p])
        p += 1

    if val != 1:
        if val not in primes:
            primes[val] = 1


lcm = 1
for p in primes:
    lcm = lcm * pow(p, primes[p], MOD) % MOD

   
def inv(x):
    return pow(x, MOD-2, MOD)

ans = 0
for val in a:
    ans += lcm * inv(val) % MOD
    ans %= MOD

print(ans)

         

### FIXED CODE ###

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

primes = {}

for val in a:
    p = 2
    while p * p <= val:
        if val % p == 0:
            cnt = 0
            while val % p == 0:
                cnt += 1
                val //= p
            if p not in primes:
                primes[p] = cnt
            else:
                primes[p] = max(cnt, primes[p])
        p += 1

    if val != 1:
        if val not in primes:
            primes[val] = 1


lcm = 1
for p in primes:
    lcm = lcm * pow(p, primes[p], MOD) % MOD

   
def inv(x):
    return pow(x, MOD-2, MOD)

ans = 0
for val in a:
    ans += lcm * inv(val) % MOD
    ans %= MOD

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

import functools
n = int(input())
a_list = list(map(int,input().split()))

def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    if x%y==0:
        return y
    else:
        while x%y!=0:
            x,y = y,x%y
        return y
res = []

for i in range(n):
    e = a_list.pop(0)
    res.append(functools.reduce(gcd, a_list))
    a_list.append(e)

print(max(res))

### FIXED CODE ###

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

def gcd(m,n):
    x = max(m,n)
    y = min(m,n)
    if y==0:
        return x
    else:
        while x%y!=0:
            x,y = y,x%y
        return y

res = []
l_gcd = [0]*(n+2)
r_gcd = [0]*(n+2)
for i in range(n+1):
    if i ==0:
        l_gcd[i] = 0
        r_gcd[n-i+1] = 0
        continue
    l_gcd[i] = gcd(l_gcd[i-1], a_list[i-1])
    r_gcd[n-i] = gcd(r_gcd[n-i+1], a_list[n-i])

for i in range(n+1):
    res.append(gcd(l_gcd[i],r_gcd[i+1]))

print(max(res))
### BUGGY CODE ###

k, s = map(int, input().split())
count = 0

for i in range(k+1):
    for j in range(k+1):
        for k in range(k+1):
            if i + j + k == s:
                count += 1
print(count)


### FIXED CODE ###

k, s = map(int, input().split())
count = 0

for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            count += 1
print(count)
### BUGGY CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import Counter 
from collections import defaultdict 
def main():
    s = input() 
    n = len(s)
    T = [0]
    dd = defaultdict(int) 
    dd[0] += 1
    for i in range(1, n+1):
        T.append((int(s[-i])*10**(i-1)+T[i-1])%2019)
        dd[(int(s[-i])*10**(i-1)+T[i-1])%2019] += 1
    ans = 0
    for i in dd.values():
        ans += i*(i-1)//2
    print(ans)
if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from collections import Counter 
from collections import defaultdict 

def main():
    s = input() 
    n = len(s)
    T = [0]
    P = 2019
    dd = defaultdict(int) 
    dd[0] += 1
    for i in range(1, n+1):
        x = (int(s[-i])*pow(10, i-1, P) + T[i-1])%P
        T.append(x)
        dd[x] += 1
    ans = 0
    for i in dd.values():
        ans += i*(i-1)//2
    print(ans)
if __name__ == '__main__':
    main()
### BUGGY CODE ###

N,K = list(map(int,input().split()))
h = list(map(int,input().split()))

inf = float("inf")
dp = [inf]*N
dp[0] = 0 #initial situation

for i in range(1,N):
	for k in range(K):
		if i-1-k >= 0:
			dp[i] = min(dp[i],dp[i-1-k] + abs(h[i]-h[i-1-k]))
			
print(dp[N-1])

### FIXED CODE ###

N,K = list(map(int,input().split()))
h = list(map(int,input().split()))

inf = float("inf")
dp = [inf]*N
dp[0] = 0 #initial situation

for i in range(1,N):
	for k in range(K):
		if i-1-k >= 0:
			dp[i] = min(dp[i],dp[i-1-k] + abs(h[i]-h[i-1-k]))
			
print(dp[N-1])
### BUGGY CODE ###

import math
N = int(input())
S = input()
# print(len(S))

case =[]

for i in range(10):
    # dummy1 = [i]
    dummy = [] 
    for num in range(len(S)):
        if int(S[num]) == i:
            dummy.append(num)
    case.append(dummy)

ans = 0

for i in range(0,1000):
    flag = False
    locknum = str(i).zfill(3)
    # print(locknum)
    a = int(locknum[0])
    b = int(locknum[1])
    c = int(locknum[2])
    if len(case[a])==0 or len(case[b]) == 0 or len(case[c]) == 0:
        continue 
    for p in range(len(case[a])):
        if flag == True:break
        for q in range(len(case[b])):
            if flag == True:break
            for r in range(len(case[c])):
                if flag == True:break
                if case[a][p]<case[b][q] and case[b][q]<case[c][r]:
                    # print(a,b,c,case[a][p],case[b][q],case[c][r])
                    ans += 1
                    flag = True
                    
print(ans)
# print(case)



                    

### FIXED CODE ###

import math,time
N = int(input())
S = input()
# length = len(S)
ans = 0
t1 = time.time()
for i in range(1000):
    locknum = str(i).zfill(3)
    a = S.find(locknum[0])
    b = S.find(locknum[1],a+1)
    c = S.find(locknum[2],b+1)
    if a!=-1 and b!=-1 and c!=-1:
        # print(i)
        ans +=1

t2 = time.time()
# print(t2-t1)                 
print(ans)
### BUGGY CODE ###

import numpy as np 

H,W = map(int,input().split())
S = np.array([[[0,1][i == '.'] for i in input()] for _ in range(H)])

funcA = np.frompyfunc(lambda x,y:y and x+y,2,1)
funcB = np.frompyfunc(lambda x,y:x if y and x and 1 else y,2,1)
Hor = funcA.accumulate(S,dtype=np.object,axis=1).astype(np.int)[:,::-1]
Hor = funcB.accumulate(Hor,dtype=np.object,axis=1).astype(np.int)[:,::-1]
Ver = funcA.accumulate(S,dtype=np.object,axis=0).astype(np.int)[::-1,:]
Ver = funcB.accumulate(Ver,dtype=np.object,axis=0).astype(np.int)[::-1,:]
print(np.max(Hor+Ver-1))


### FIXED CODE ###

H,W = map(int,input().split())
S = [0]*H
for i in range(H):
    S[i] = list(input())

def aaa(s):
    i = 0
    l = len(s)
    o = []
    while True:
        if i == l:
            break
        if s[i] == ".":
            n = 0
            while i < l and s[i] == '.':
                i += 1
                n += 1
            o += [n] * n
        else:
            o += [0]
            i += 1
    return o

Hor = [0]*H
y = 0
while y != H:
    Hor[y] = aaa(S[y])
    y += 1

Ver = [0]*W
x = 0
while x != W:
    _ = 0
    s = [0] * H
    while _ != H:
        s[_] = S[_][x]
        _ += 1
    Ver[x] = aaa(s)
    x += 1

ans = 1
x = 0
while x != W:
    y = 0
    while y != H:
        h = Hor[y][x]
        if h:
            v = Ver[x][y]
            ans = max(ans,h+v-1)
        y += 1
    x += 1

print(ans)