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

# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

import functools

def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
def multiple(a, b):
    return a*b // euclid(a, b)
def lcm(nums):
        return functools.reduce(multiple, nums)


N=int(input())
a=list(map(int,input().split()))
calc=(lcm(a))  # 実行結果: 12


ans=0
for index,item in enumerate(a):
    ans+=(calc)//item
    ans%=(10**9+7)

print(int((ans)%(10**9+7)))
    



### FIXED CODE ###

# coding: utf-8
# Your code here!
# coding: utf-8
# Your code here!
import sys
input = sys.stdin.readline

import functools

def euclid(a, b):
    if b == 0:
        return a
    else:
        return euclid(b, a%b)
def multiple(a, b):
    return a*b // euclid(a, b)
def lcm(nums):
        return functools.reduce(multiple, nums)


N=int(input())
a=list(map(int,input().split()))
calc=(lcm(a))  # 実行結果: 12


ans=0
for index,item in enumerate(a):
    ans+=(calc)//item

print(int((ans)%(10**9+7)))
### BUGGY CODE ###

#!/usr/bin/env python3


def main():
    n, m = map(int, input().split())
    a = [int(input()) for _ in range(m)]
    diff_a = [a[i+1] - a[i] for i in range(m - 1)]
    if 1 in diff_a:
        print(0)
        return
    method = [0] * (n + 1)
    method[0] = 1
    if 1 not in a:
        method[1] = 1
    for i in range(2, n + 1):
        if i in a:
            continue
        else:
            method[i] = method[i-1] + method[i-2]
            method[i] %= 1000000007
    print(method[n])


if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

sys.setrecursionlimit(10 ** 8)
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N, M = map(int, readline().split())
A = list(map(int, readlines()))
assert len(A) == M

MOD = 10 ** 9 + 7


def solve():
    broken = [False] * (N + 1)
    for a in A:
        broken[a] = True
    p1, p2 = 1, 0
    for i in range(1, N + 1):
        if broken[i]:
            p1, p2 = 0, p1
        elif i == 1:
            p1, p2 = p1, p1
        else:
            p1, p2 = (p1 + p2) % MOD, p1
    return p1


if __name__ == "__main__":
    print(solve())
### BUGGY CODE ###

#!/usr/bin/env python3

R, C, K = list(map(int, input().split()))

rck = {}
for i in range(K):
    tmp = list(map(int, input().split()))
    rck[(tmp[0], tmp[1])] = tmp[2]


# dp = [[[0 for j in range(R+1)] for i in range(C+1)]

# print(rck)
dp = [0] * (C+1)
for r_i in range(1, R+1):
    tmp0 = 0
    tmp1 = 0
    tmp2 = 0
    tmp3 = 0
    dp_new = [0]*(C+1)
    for c_i in range(1, C+1):
        tmp0 = max(dp[c_i], tmp0)
        tmp1 = max(dp[c_i], tmp1)
        tmp2 = max(dp[c_i], tmp2)
        tmp3 = max(dp[c_i], tmp3)

        index = (r_i, c_i)
        if index in rck:
            tmp3 = max(tmp3, tmp2+rck[index])
            tmp2 = max(tmp2, tmp1+rck[index])
            tmp1 = max(tmp1, tmp0+rck[index])
        dp_new[c_i] = max(tmp0, tmp1, tmp2, tmp3)
    # print(dp_new)
    dp = dp_new
print(dp[-1])


### FIXED CODE ###

#!/usr/bin/env python3

R, C, K = list(map(int, input().split()))

V = [[] for i in range(R)]
for i in range(K):
    r, c, v = list(map(int, input().split()))
    V[r-1].append([c, v])


# dp = [[[0 for j in range(R+1)] for i in range(C+1)]

# print(rck)
dp = [0] * (C+1)
for r in range(1, R+1):
    tmp0 = 0
    tmp1 = 0
    tmp2 = 0
    tmp3 = 0
    V[r-1].sort()
    for c, v in V[r-1]:
        tmp0 = max(dp[c], tmp0)
        tmp1 = max(dp[c], tmp1)
        tmp2 = max(dp[c], tmp2)
        tmp3 = max(dp[c], tmp3)

        tmp3 = max(tmp3, tmp2+v)
        tmp2 = max(tmp2, tmp1+v)
        tmp1 = max(tmp1, tmp0+v)

        dp[c] = max(tmp0, tmp1, tmp2, tmp3)
    for i in range(1, C+1):
        dp[i] = max(dp[i], dp[i-1])
    # print(dp)

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

n = int(input())
arr = list(map(int, input().strip().split()))

mem = [[0 for i in range(n)] for i in range(n)]
for i in range(n):
    mem[i][i] = arr[i]

for diff in range(1, n):
    for L in range(n-diff):
        H = L+diff
        mem[L][H] = max(arr[L]-mem[L+1][H], arr[H]-mem[L][H-1])

print(mem[0][n-1])

### FIXED CODE ###

n = int(input())
arr = list(map(int, input().strip().split()))

mem = [[0 for i in range(n)] for i in range(n)]
for i in range(n):
    mem[i][i] = arr[i]

for diff in range(1, n):
    for L in range(n-diff):
        H = L+diff
        mem[L][H] = max(arr[L]-mem[L+1][H], arr[H]-mem[L][H-1])

print(mem[0][n-1])
### BUGGY CODE ###

# coding: utf-8
n = int(raw_input())
li = map(int, raw_input().split())
li.sort(reverse=False)

count = 0

for i in xrange(n):
    for j in xrange(i+1,n):
        for k in xrange(j+1,n):
            if li[i] < li[j] + li[k] and li[j] < li[i] + li[k] and li[k] < li[i] + li[j]:
                count +=1
            else:
                break
print count

### FIXED CODE ###

# coding: utf-8
n = int(raw_input())
L = map(int, raw_input().split())

#昇順にソート
L.sort()

ans = 0



for a in xrange(n-2):
	c = a + 2
	for b in xrange(a+1,n-1):
		while c < n and L[a] + L[b] > L[c]:
			c += 1
		if c > b:
			ans += (c-b-1)
print ans
### BUGGY CODE ###

inf = 10 ** 13

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

d = [[inf] * n for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    d[a - 1][b - 1] = d[b - 1][a - 1] = c
for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])

e = [[1 if d[i][j] <= l else inf for j in range(n)] for i in range(n)]
for k in range(n):
    for i in range(n):
        for j in range(n):
            e[i][j] = min(e[i][j], e[i][k] + e[k][j])

q = int(input())
for _ in range(q):
    s, t = map(int, input().split())
    a = e[s - 1][t - 1]
    print(a - 1 if a < inf else -1)


### FIXED CODE ###

inf = 10 ** 13

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

d = [[inf] * n for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    d[a - 1][b - 1] = d[b - 1][a - 1] = c
for k in range(n):
    for i in range(n):
        for j in range(n):
            d[i][j] = min(d[i][j], d[i][k] + d[k][j])

e = [[1 if d[i][j] <= l else inf for j in range(n)] for i in range(n)]
for k in range(n):
    for i in range(n):
        for j in range(n):
            e[i][j] = min(e[i][j], e[i][k] + e[k][j])

q = int(input())
for _ in range(q):
    s, t = map(int, input().split())
    a = e[s - 1][t - 1]
    print(a - 1 if a < inf else -1)
### BUGGY CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**7)
n=int(input())
t=[[] for i in range(n)]
for i in range(1,n):
  a=int(input())
  t[a-1].append(i)
def dfs(v):
  if not t[v]:
    return 0
  l=[dfs(i)+1 for i in t[v]]
  l.sort()
  for i in range(len(t[v])-1):
    l[i+1]=max(l[i+1],l[i]+1)
  return l[-1]
print(dfs(0))

### FIXED CODE ###

import sys
input=sys.stdin.readline
sys.setrecursionlimit(10**7)
n=int(input())
t=[[] for i in range(n)]
for i in range(1,n):
  a=int(input())
  t[a-1].append(i)
def dfs(v):
  if not t[v]:
    return 0
  l=[dfs(i)+1 for i in t[v]]
  l.sort()
  for i in range(len(t[v])-1):
    l[i+1]=max(l[i+1],l[i]+1)
  return l[-1]
print(dfs(0))
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce 
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()
A = a[0]

for i in range(1, N):
	A = A*a[i] // gcd(A, a[i])

ans = 0

for i in range(1, A):
	p = 0
	for j in a:
		p += i%j
	ans = max(ans, p)

print(ans)

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, tan, asin, acos, atan, radians, degrees, log2
from itertools import accumulate, permutations, combinations, combinations_with_replacement, product, groupby
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

N = INT()
a = LIST()

print(sum(a)-N)
### BUGGY CODE ###

def resolve():
    from fractions import gcd
    n = int(input())
    a = list(map(int, input().split()))
    mod = 10**9 + 7
    lsd = a[0]
    for i in range(1, n):
        lsd = (lsd * a[i]) // gcd(lsd, a[i])

    ans = 0
    for i in range(n):
        ans += (lsd//a[i]) % mod

    print(int(ans % mod))
resolve()

### FIXED CODE ###

def resolve():
    def lcm(X, Y):
        x = X
        y = Y
        if y > x:
            x, y = y, x
        while x % y != 0:
            x, y = y, x % y
        return X * Y // y
    n = int(input())
    a = list(map(int, input().split()))
    mod = 10**9 + 7
    lsd = a[0]
    for i in range(1, n):
        lsd = lcm(lsd, a[i])
    lsd = lsd % mod

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

    print(int(ans % mod))

resolve()
### BUGGY CODE ###

n = int(input())
factor = []
tmp = n
for i in range(2, int(-(-n ** 0.5 // 1)) + 1):
    while tmp % i == 0:
        factor.append(i)
        tmp //= i
if tmp != 1:
    factor.append(tmp)
w = len(factor)
if w == 0:
    factor.append(n)
    w = 1
if w == 1:
    print(n - 1)
else:
    ans = 1000000000000
    for i in range(1, 2 ** w // 2):
        f2 = [1, 1]
        for j in range(w):
            f2[i & (2 ** j) == 0] *= factor[j]
        ans = min(ans, sum(f2) - 2)
        if ans < n ** 0.5 * 2:
            break
    print(ans)


### FIXED CODE ###

n = int(input())
ans = 1000000000000
for i in range(1, int(n ** 0.5) + 1):
    if n % i == 0:
        a = i
        b = n // i
        ans = min(ans, a + b - 2)
print(ans)
### BUGGY CODE ###

# YouTubeの通り
from operator import itemgetter

def update(i, x):
    i += 1
    while i < n + 1:
        bit[i] += x
        i += i & -i

def get_sum(i):
    i += 1
    s = 0
    while i > 0:
        s += bit[i]
        i -= i & -i
    return s

md = 998244353
n = int(input())
xy = [list(map(int, input().split())) for _ in range(n)]
# yの座標圧縮
xy.sort(key=itemgetter(1))
for i in range(n):
    xy[i][1] = i

xy.sort()
cy = [[0] * 4 for _ in range(n)]
bit = [0] * (n + 1)
for i in range(n):
    x, y = xy[i]
    s = get_sum(y)
    cy[i][3] = pow(2, s, md)
    cy[i][2] = pow(2, i - s, md)
    update(y, 1)
bit = [0] * (n + 1)
for i in range(n - 1, -1, -1):
    x, y = xy[i]
    s = get_sum(y)
    cy[i][0] = pow(2, s, md)
    cy[i][1] = pow(2, n - 1 - i - s, md)
    update(y, 1)
ans = pow(2, n - 1, md) * n % md
for i in range(n):
    c0, c1, c2, c3 = cy[i]
    ans = (ans + (c0 - 1) * (c2 - 1) * c1 * c3 + (c1 - 1) * (c3 - 1) * c0 * c2
           - (c0 - 1) * (c1 - 1) * (c2 - 1) * (c3 - 1)) % md
print(ans)


### FIXED CODE ###

import sys

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

class BitSum:
    def __init__(self, n):
        self.n = n + 1
        self.table = [0] * self.n

    def add(self, i, x):
        i += 1
        while i < self.n:
            self.table[i] += x
            i += i & -i

    def sum(self, i):
        i += 1
        res = 0
        while i > 0:
            res += self.table[i]
            i -= i & -i
        return res

def main():
    md=998244353
    n=II()
    xy=LLI(n)
    yy=set()
    for x,y in xy:yy.add(y)
    ytoj={y:j for j,y in enumerate(sorted(yy))}

    ans=n*(pow(2,n,md)-1)-4*(pow(2,n,md)-1-n)
    ans%=md

    xy.sort()
    bit=BitSum(200005)
    for i,[x,y] in enumerate(xy):
        j=ytoj[y]
        c=bit.sum(j-1)
        ans+=pow(2,c,md)-1
        ans+=pow(2,i-c,md)-1
        ans%=md
        bit.add(j,1)

    bit=BitSum(200005)
    for i,[x,y] in enumerate(xy[::-1]):
        j=ytoj[y]
        c=bit.sum(j-1)
        ans+=pow(2,c,md)-1
        ans+=pow(2,i-c,md)-1
        ans%=md
        bit.add(j,1)

    print(ans)

main()
### BUGGY CODE ###

import collections
import sys
sys.setrecursionlimit(1000000)


# 入力
N = int(input())
A = [int(x) for x in input().split()]

# DPテーブルを初期化
dp = [[[-1 for k in range(310)] for j in range(310)] for i in range(310)]


def rec(i, j, k):
    if dp[i][j][k] >= 0:
        return dp[i][j][k]
    if i == 0 and j == 0 and k == 0:
        return 0.0

    res = 0.0
    if i > 0:
        res += rec(i-1, j, k)*i
    if j > 0:
        res += rec(i+1, j-1, k)*j
    if k > 0:
        res += rec(i, j+1, k-1)*k
    res += N
    res *= 1.0/(i+j+k)

    dp[i][j][k] = res

    return res


c = collections.Counter(A)


# 答えを得て出力
print(rec(c[1], c[2], c[3]))


### FIXED CODE ###

import collections

# 入力
N = int(input())
c = collections.Counter(list(map(int, input().split())))

# DPテーブルを初期化
dp = [[[0.0 for k in range(310)] for j in range(310)] for i in range(310)]


for k in range(0, c[3] + 1):
    for j in range(0, c[2]+c[3]-k + 1):
        for i in range(0, c[1]+c[2]+c[3]-j-k + 1):
            if i == j == k == 0:
                continue
            dp[i][j][k] = (N+i*dp[i - 1][j][k]+j *
                           dp[i + 1][j - 1][k]+k*dp[i][j + 1][k - 1])/(i+j+k)


# 答えを得て出力
print(dp[c[1]][c[2]][c[3]])
### BUGGY CODE ###

a=raw_input()
b=raw_input()
if len(a)<len(b):
	print "LESS"
elif len(a)>len(b):
	print "GREATER"
else:
	p=0
	while True:
		if a[p]<b[p]:
			print "LESS"
			break
		elif a[p]>b[p]:
			print "GREATER"
			break
		else:
			pass


### FIXED CODE ###

a=int(raw_input())
b=int(raw_input())
if a<b:
	print "LESS"
elif a>b:
	print "GREATER"
else:
	print "EQUAL"
### BUGGY CODE ###

import sys

input = sys.stdin.readline

def main():
    n, m, l = map(int, input().split())
    wf = [[(300 * (10**9) + 1) for i in range(n)] for j in range(n)]
    for i in range(m):
        a, b, c = map(int, input().split())
        wf[a-1][b-1] = c
        wf[b-1][a-1] = c
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if wf[i][j] > wf[i][k] + wf[k][j]:
                    wf[i][j] = wf[i][k] + wf[k][j]
    for i in range(n):
        for j in range(n):
            if wf[i][j] <= l:
                wf[i][j] = 1
            else:
                wf[i][j] = 301
    for k in range(n):
        for i in range(n):
            for j in range(n):
                if wf[i][j] > wf[i][k] + wf[k][j]:
                    wf[i][j] = wf[i][k] + wf[k][j]
    q = int(input())
    ans = [None] * q
    for i in range(q):
        s, t = map(int, input().split())
        if wf[s-1][t-1] < 301:
            ans[i] = wf[s-1][t-1]
        else:
            ans[i] = 0
    for i in range(q):
        print(ans[i] - 1)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
import numpy as np
from scipy.sparse.csgraph import csgraph_from_dense, floyd_warshall, shortest_path

input = sys.stdin.readline

def main():
    n, m, l = map(int, input().split())
    wf = [[0 for i in range(n)] for j in range(n)]
    for _ in range(m):
        a, b, c = map(int, input().split())
        wf[a-1][b-1] = wf[b-1][a-1] = c
    wf = np.array(wf)
    for i in range(n):
        wf[i][i] = 0
    wf = shortest_path(wf, method='FW')
    for i in range(n):
        for j in range(n):
            if wf[i][j] <= l:
                wf[i][j] = 1
            else:
                wf[i][j] = 301
    wf = shortest_path(wf, method='FW')
    q = int(input())
    ans = [None] * q
    for i in range(q):
        s, t = map(int, input().split())
        if wf[s-1][t-1] < 301:
            ans[i] = int(wf[s-1][t-1])
        else:
            ans[i] = 0
    for i in range(q):
        print(ans[i] - 1)

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

from fractions import gcd
from functools import reduce

n = int(input())
A = [int(a) for a in input().split()]
ans = 1
for i in range(len(A)):
    B = A.copy()
    B.pop(i)
    _ = reduce(gcd, B)
    if _ > ans:
        ans = _
        
print(ans)

### FIXED CODE ###

from functools import reduce
from fractions import gcd

n = int(input())
A = [int(a) for a in input().split()]

l = [0 for _ in range(n+1)]
r = [0 for _ in range(n+1)]
ans = []

for i in range(n):
    l[i+1] = gcd(l[i],A[i])

for i in range(n-1,-1,-1):
    r[i-1] = gcd(r[i],A[i])
    
for i in range(n):
    ans.append(gcd(l[i],r[i]))
    
print(max(ans))
### BUGGY CODE ###

n=int(input())
a=[int(i) for i in input().split()]
s=[]
for i in range(1,n):
  for j in range(i):
    s.append(a[j]^a[i])
print(sum(s)%(10**9+7))



### FIXED CODE ###

mod=int(1e9)+7

n=int(input())
a=[int(i) for i in input().split()]
ans=0
for b in range(60)[::-1]:
  ans<<=1
  c=sum(a[i]>>b & 1 for i in range(n))
  ans = (ans + c*(n-c)) % mod
print(ans)
### BUGGY CODE ###

n=int(input())
dic=[]
for i in range(n):
  x=input()
  if not x in dic:
    dic.append(x)
    dic.sort()
print(len(dic))

### FIXED CODE ###

n=int(input())
s = list(set([input() for i in range(n)]))
print(len(s))
### BUGGY CODE ###


n = int(input())

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

#mid = n//2 + n%2

ans = [0]*n
for i, a in enumerate(an[::-1]):

#    ta = [x for ii,x in enumerate(an[i:]) if i % (n-(ii+i)) == 0]
#    t = sum(ta)
#    print(ta,t,i,a)
#    ans[-i] = t%2

    ans[-i] = sum([x for ii, x in enumerate(an[i:]) if i % (n-(ii+i)) == 0])%2

m = sum(ans)
print(m)

if m > 0:
    print(*[x for x in ans if x >0])

### FIXED CODE ###


n = int(input())

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

#mid = n//2 + n%2

#print(* range(10)[::2] )

ans = [0]*(n+1)

for _ in range(n):# 0 ... n-1
    i = n-_ # n ... 1

    ta = sum(ans[i::i])
    ans[i] = 0 if ta%2 == an[i-1] else 1

#    print(i, an[i-1::i])


m = sum(ans)
print(m)

if m > 0:
    print(*[i for i, x in enumerate(ans) if x >0])
### BUGGY CODE ###

import collections
n = int(input())
s = [input() for _ in range(n)]
wordlist = collections.Counter(s)
values, counts = zip(*wordlist.most_common())
values = list(values)
counts = list(counts)
for cnt in range(len(counts)):
    if counts[cnt] != max(counts):
        cnt -=1
        break
values = values[:cnt+1]
values.sort()
print("\n".join(values))

### FIXED CODE ###

from collections import Counter

N = int(input())
S = []
for i in range(N):
    S.append(input())
S.sort()
c = Counter(S).most_common()
m = c[0][1]
c.sort()
for i in range(len(c)):
    if c[i][1] == m:
        print(c[i][0])
### BUGGY CODE ###

from collections import defaultdict
#from functools import lru_cache
import itertools

def main():
    N = int(input())
    A = tuple(int(c) for c in input().split(' '))
    L = []
    R = []
    for i, a in enumerate(A):
        L.append(i+a)
        R.append(i-a)
    #print(L)
    #print(R)
    L_t = defaultdict(list)
    for i, l in enumerate(L):
        L_t[l].append(i)
    R_t = defaultdict(list)
    for j, r in enumerate(R):
        R_t[r].append(j)

    x_max = max(L)
    x_min = min(R)
    cnt = 0
    for x in range(x_min, x_max+1):
        l_candidate = L_t[x]
        r_candidate = R_t[x]
        if len(l_candidate) == 0 or len(r_candidate) == 0:
            continue
        else:
            answer_set = set()
            for i,j in itertools.product(l_candidate, r_candidate):
                answer_set.add((i,j))
            cnt += len(answer_set)

    print(cnt)


if __name__ == "__main__":
    main()

### FIXED CODE ###

#解説を見て実装
from collections import Counter

def main():
    N = int(input())
    A = tuple(int(c) for c in input().split(' '))
    L = [i+a for i, a in enumerate(A)]
    R = [i-a for i, a in enumerate(A)]
    #print(L)
    #print(R)

    #はじめL_t = defaultdict(list)としてiの候補を追加していったが、iとjは重複しないのでチェックが不要
    L_t = Counter(L)
    R_t = Counter(R)
    cnt = 0
    x_candidate = set(L) & set(R)
    for x in x_candidate:
        l_candidate = L_t[x]
        r_candidate = R_t[x]
        cnt += l_candidate * r_candidate

    print(cnt)

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

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

# i番目のcostと0番目のcost,i番目のcostと1番目のcost…と比較していく手法
# 構造的にはかなりすっきりしてて分かりやすい

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

dp = [0] + [float("inf")]*(N-1)
for i in range(1,N):
    for j in range(1, min(i+1,K+1)):
        dp[i] = min(dp[i],dp[i-j]+abs(h[i]-h[i-j]))
print(dp[-1])


### FIXED CODE ###

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

cost = [0]
for i in range(2,N+1):
    cost.append( min([cost[j] + abs(h[i-1]-h[j]) for j in range(max(0,i-K-1), i-1)]) )
print(cost[-1])
### BUGGY CODE ###

from collections import deque
from itertools import product, combinations

H, W = map(int, input().split(' '))
maze = [input() for _ in range(H)]

points = [(y, x) for y, x in product(range(H), range(W)) if maze[y][x] == '.']

ans = 0
for (sy, sx), (gy, gx) in combinations(points, r=2):
    checked = set()
    queue = deque()
    queue.append((sy, sx, 0))
    while queue:
        y, x, cost = queue.popleft()
        checked.add((y, x))
        if (y, x) == (gy, gx):
            ans = max(ans, cost)
            break

        for ny, nx in ((y + 1, x), (y - 1, x), (y, x + 1), (y, x - 1)):
            if not 0 <= ny < H:
                continue
            if not 0 <= nx < W:
                continue
            if (ny, nx) in checked:
                continue
            if maze[ny][nx] == '#':
                continue
            queue.append((ny, nx, cost + 1))

print(ans)


### FIXED CODE ###

from collections import deque
from itertools import product

H, W = map(int, input().split(' '))
maze = [input() for _ in range(H)]

points = [(y, x) for y, x in product(range(H), range(W)) if maze[y][x] == '.']

ans = 0
for sy, sx in points:
    costs = {}
    queue = deque()
    queue.append((sy, sx, 0))
    while queue:
        y, x, cost = queue.popleft()
        if (y, x) in costs:
            continue
        else:
            costs[(y, x)] = cost

        for ny, nx in ((y + 1, x), (y - 1, x), (y, x + 1), (y, x - 1)):
            if not 0 <= ny < H:
                continue
            if not 0 <= nx < W:
                continue
            if (ny, nx) in costs:
                continue
            if maze[ny][nx] == '#':
                continue
            queue.append((ny, nx, cost + 1))

    ans = max(ans, max(costs.values()))

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

X, Y = map(int, input().split())

memo = [[[-1, -1] for _ in range(X + Y + 1)] for _ in range(X + Y + 1)]
def search(x, y, person):
    if x <= 1 and y <= 1:
        return False if person == 0 else True

    if x == 2 and y == 0 or x == 0 and y == 2:
        return True if person == 0 else False

    if memo[y][x][person] != -1:
        return memo[y][x][person]

    ret = False
    for i in range(2, x + 1, 2):
        ret |= search(x - i, y + i // 2, 1 if person == 0 else 0)
    for i in range(2, y + 1, 2):
        ret |= search(x + i // 2, y - i, 1 if person == 0 else 0)

    memo[y][x][person] = ret
    return ret

ans = search(X, Y, 0)
print('Alice' if ans else 'Brown')

### FIXED CODE ###

X, Y = map(int, input().split())

if abs(X - Y) <= 1:
    print('Brown')
else:
    print('Alice')