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

N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
for i in range(29):
  a_nex=sorted([p%(2*2**i) for p in a])
  b_nex=sorted([p%(2*2**i) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and b_nex[p]<2**i-k:
      p+=1
    while q<N and b_nex[q]<2*2**i-k:
      q+=1
    while r<N and b_nex[r]<3*2**i-k:
      r+=1
    l+=q-p+N-r
  ans+=l%2<<i
print(ans)   
  


### FIXED CODE ###

N=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
def f(i):
  res=0
  t=2**i
  a_nex=sorted([p%(2*t) for p in a])
  b_nex=sorted([p%(2*t) for p in b])
  l=0
  p=q=r=0
  for k in reversed(a_nex):
    while p<N and k+b_nex[p]<t:
      p+=1
    while q<N and k+b_nex[q]<2*t:
      q+=1
    while r<N and k+b_nex[r]<3*t:
      r+=1
    l+=q-p+N-r
  res=(l%2)<<i
  return res
for k in range(29):
  ans+=f(k)
print(ans)
### BUGGY CODE ###

import math
import sys
import os
from operator import mul
# import sympy

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")

# 約数
def divisor_count(n):
    divisors = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors += 1
            if i != n // i:
                divisors += 1

    return divisors

N = I()
ans = 0

for i in range(1,N+1):
    # ans += i * sympy.divisor_count(i)
    ans += i * divisor_count(i)
    # print(i,sympy.divisor_count(i))

print(ans)

### FIXED CODE ###

import math
import sys
import os
from operator import mul
import numpy as np
# import sympy

sys.setrecursionlimit(10**7)

def _S(): return sys.stdin.readline().rstrip()
def I(): return int(_S())
def LS(): return list(_S().split())
def LI(): return list(map(int,LS()))

if os.getenv("LOCAL"):
    inputFile = basename_without_ext = os.path.splitext(os.path.basename(__file__))[0]+'.txt'
    sys.stdin = open(inputFile, "r")
INF = float("inf")

N = I()
ans = 0

# 足し方の見方を変える。等差数列の和をKまで足す
# 1 + 2 + 3 + 4 +...
#   + 2     + 4 +...
for i in range(1,N+1):
    # Nを超えない整数
    y = N//i
    sum = y*(y+1)*i/2
    ans += sum

print(int(ans))





# 素数 エラトステネス
def seachPrimeNum(N):
   max = int(np.sqrt(N))
   seachList = [i for i in range(2,N+1)]
   primeNum = []
   while seachList[0] <= max:
       primeNum.append(seachList[0])
       tmp = seachList[0]
       seachList = [i for i in seachList if i % tmp != 0]
   primeNum.extend(seachList)
   return primeNum

# 約数
def divisor_count(n):
    divisors = 0
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors += 1
            if i != n // i:
                divisors += 1

    return divisors
### BUGGY CODE ###

import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy


def main():
    n = int(input())
    a_list = tuple(map(int, input().split()))
    num = 1000000000000000000
    ans = 1
    n = 10**7
    for i in range(n):
        ans *= 10
    
    if ans <= num:
        print(ans)
    else:
        print(-1)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, gcd
from copy import deepcopy


def main():
    n = int(input())
    a_list = tuple(map(int, input().split()))
    num = 1e18
    ans = 1
    if (0 in a_list):
        print(0)
        sys.exit()
    for i in range(n):
        ans *= a_list[i]
        if ans > num:
            print(-1)
            sys.exit()

    
    if ans <= num:
        print(ans)
    else:
        print(-1)

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

N = int(input())
a = [int(i) for i in input().split()]

_sum = 0

for i in range(N):
    a.remove(max(a))
    _sum += max(a)
    a.remove(max(a))

print(_sum)


### FIXED CODE ###

N = int(input())
a = [int(i) for i in input().split()]

a.sort(reverse=True)
print(sum(a[1:2*N][::2]))
### BUGGY CODE ###

h, w, m = map(int, input().split())
s = [[False] * w for _ in range(h)]
num_h = [0] * h
num_w = [0] * w
for _ in range(m):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    s[hi][wi] = True
    num_h[hi] += 1
    num_w[wi] += 1
max_h_list = []
max_h_val = 0
max_w_list = []
max_w_val = 0
for hi in range(h):
    if num_h[hi] > max_h_val:
        max_h_list = [hi]
        max_h_val = num_h[hi]
    elif num_h[hi] == max_h_val:
        max_h_list.append(hi)
for wi in range(w):
    if num_w[wi] > max_w_val:
        max_w_list = [wi]
        max_w_val = num_w[wi]
    elif num_w[wi] == max_w_val:
        max_w_list.append(wi)

if len(max_h_list) * len(max_w_list) > m:
    print(max_h_val + max_w_val)
    exit()
for max_hi in max_h_list:
    for max_wi in max_w_list:
        if s[max_hi][max_wi] == False:
            print(max_h_val + max_w_val)
            exit()
print(max_h_val + max_w_val - 1)


### FIXED CODE ###

h, w, m = map(int, input().split())
s = dict()
num_h = [0] * h
num_w = [0] * w
for _ in range(m):
    hi, wi = map(int, input().split())
    hi -= 1
    wi -= 1
    s[(hi, wi)] = True
    num_h[hi] += 1
    num_w[wi] += 1
max_h_list = []
max_h_val = 0
max_w_list = []
max_w_val = 0
for hi in range(h):
    if num_h[hi] > max_h_val:
        max_h_list = [hi]
        max_h_val = num_h[hi]
    elif num_h[hi] == max_h_val:
        max_h_list.append(hi)
for wi in range(w):
    if num_w[wi] > max_w_val:
        max_w_list = [wi]
        max_w_val = num_w[wi]
    elif num_w[wi] == max_w_val:
        max_w_list.append(wi)

if len(max_h_list) * len(max_w_list) > m:
    print(max_h_val + max_w_val)
    exit()
for max_hi in max_h_list:
    for max_wi in max_w_list:
        if s.get((max_hi, max_wi), False) == False:
            print(max_h_val + max_w_val)
            exit()
print(max_h_val + max_w_val - 1)
### BUGGY CODE ###

H, W = map(int, input().rstrip().split())
checked = [[True]*(W+2)]
checked += [[True] + [-1]*W + [True] for i in range(H)]
checked += [[True]*(W+2)]

black_list = []
# 初期化
# 0 => 黒、 -1 => 白
for i in range(H):
    row = input().rstrip()
    for j in range(W):
        if row[j] == "#":
            checked[i+1][j+1] = True
            black_list.append((i+1, j+1))

# 黒の周辺4方向のうち、白だったら黒にする
ans = -1
while len(black_list) > 0:
    ans += 1
    tmp = []
    for x, y in black_list:
        # 上
        if checked[x-1][y] == -1:
            checked[x-1][y] = True
            tmp.append((x-1, y))
        # 下
        if checked[x+1][y] == -1:
            checked[x+1][y] = True
            tmp.append((x+1, y))
        # 左
        if checked[x][y-1] == -1:
            checked[x][y-1] = True
            tmp.append((x, y-1))

        # 右
        if checked[x][y+1] == -1:
            checked[x][y+1] = True
            tmp.append((x, y+1))

    black_list = tmp

print(ans)


### FIXED CODE ###

H, W = map(int, input().rstrip().split())
checked = [[True]*(W+2)]
checked += [[True] + [ch == "#" for ch in input().rstrip()] + [True]
            for i in range(H)]
checked.append([True]*(W+2))

black_list = []
# 初期化
# 0 => 黒、 -1 => 白
for i in range(1, H+1):
    for j in range(1, W+1):
        if checked[i][j]:
            black_list.append((i, j))

# 黒の周辺4方向のうち、白だったら黒にする
ans = -1
while black_list:
    ans += 1
    tmp = []
    for x, y in black_list:
        # 上
        if not checked[x-1][y]:
            checked[x-1][y] = True
            tmp.append((x-1, y))
        # 下
        if not checked[x+1][y]:
            checked[x+1][y] = True
            tmp.append((x+1, y))
        # 左
        if not checked[x][y-1]:
            checked[x][y-1] = True
            tmp.append((x, y-1))

        # 右
        if not checked[x][y+1]:
            checked[x][y+1] = True
            tmp.append((x, y+1))

    black_list = tmp

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

import itertools
N = int(input())
L = map(int,input().split())
tmp = list(itertools.combinations(L,3))
ans = 0
for i in range(len(tmp)):
    if abs(tmp[i][1] - tmp[i][2]) < tmp[i][0]:
        if tmp[i][0] < (tmp[i][1] + tmp[i][2]):
            ans += 1
print(ans)

### FIXED CODE ###

import itertools
import bisect
N = int(input())
L = sorted(list(map(int,input().split())))
ans = 0
for i in range(N-2):
    a = L[i]
    for j in range(i+1,N-1):
        b = L[j]
        ind_cmin = j+1
        ind_cmax = bisect.bisect_left(L,a+b)-1
        ans += ind_cmax - ind_cmin + 1
print(ans)
### BUGGY CODE ###

L, R = map(int, input().split())
ans = 2018
END = False

for i in range(2019):
    j = i + 1
    while j <= R-L:
        ans = min( ((L+i)*(L+j)) % 2019, ans)
        j += 1
    if ans == 0 or i > R-L:
        break

print(ans)

### FIXED CODE ###

L, R = map(int, input().split())
ans = 2018
END = False

for i in range(2019):
    j = i + 1
    while j <= R-L:
        ans = min( ((L+i)*(L+j)) % 2019, ans)
        j += 1
        if ans == 0:
            END = True
            break
    if END or i > R-L:
        break

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

a = int(input())
b = []
c = []
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = sorted(list(input()))
    if strings not in b:
      check = False
      b.append(strings)
      c.append(1)
    if check == True:
      for j in range(len(b)):
          if b[j] == strings:
              ans += c[j]
              c[j] += 1

print(ans)

### FIXED CODE ###

a = int(input())
b = {}
strings = ''
ans = 0

for i in range(a):
    check = True
    strings = ''.join(sorted(list(input())))
    if strings not in b.keys():
      check = False
      b[strings] = 1
    if check == True:
      ans += b[strings]
      b[strings] += 1

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

from itertools import combinations

input()
A = {i: int(height) for i, height in enumerate(input().split(), 1)}

res = 0
for a1_id, a2_id in combinations(A.keys(), 2):
    if abs(a1_id - a2_id) == (A[a1_id] + A[a2_id]):
        res += 1

print(res)


### FIXED CODE ###

from collections import Counter

N = int(input())
A = [int(height) for height in input().split()]

m = Counter(i - elem for i, elem in enumerate(A))
res = 0
for i, elem in enumerate(A):
    res += m[i + elem]

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

N, W, H = [int(x) for x in input().split()]

map_x = [False] * W
count_x = 0
map_y = [False] * H
count_y = 0

wifi = []
for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    wifi.append((x - w, x + w, y - w, y + w))


def check_x(l):
    for x1, x2, _, _ in wifi:
        if x1 <= l < x2:
            return True
    return False


def check_y(l):
    for _, _, y1, y2 in wifi:
        if y1 <= l < y2:
            return True
    return False


ans_x = True
for x in range(W):
    if not check_x(x):
        ans_x = False
        break

if not ans_x:
    for y in range(H):
        if not check_y(y):
            print('No')
            exit()

print('Yes')

### FIXED CODE ###

N, W, H = [int(x) for x in input().split()]

map_x = [0] * W
map_y = [0] * H

for _ in range(N):
    x, y, w = [int(x) for x in input().split()]
    mx = max(0, x - w)
    map_x[mx] = max(map_x[mx], x + w - mx)
    my = max(0, y - w)
    map_y[my] = max(map_y[my], y + w - my)


def check_wifi(wifi):
    m = 0
    end = len(wifi)

    for i, x in enumerate(wifi):
        if x and i + x > m:
            m = i + x

        if m >= end:
            return True

        if i < m:
            continue

        return False

    return False


print('Yes' if check_wifi(map_x) or check_wifi(map_y) else 'No')
### BUGGY CODE ###

n = int(input())
s = [input() for i in range(n)]

count = 0
list1 = []
for i in range(n):
    dic1 = {}
    for k in range(10):
        
        if s[i][k] in dic1:
            dic1[s[i][k]] += 1
        else:
            dic1[s[i][k]] = 1
    list1.append(dic1)
        
for i in range(n):
    for j in range(i + 1, n):
        if list1[i] == list1[j]:    
            count += 1
print(count)

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]

count = 0
dic1 = {}
#print(s)
for i in range(n):
    #print(s[i])
    so = sorted(s[i])
    so = ''.join(so)
    if so in dic1:
        count += dic1[so]
        dic1[so] += 1
    else:
        dic1[so] = 1
    #print(count, dic1)
print(count)
### BUGGY CODE ###

H,W=map(int, input().split())
M=[list(map(lambda x:1 if x=='#' else 0,input())) for _ in range(H)]

R=[[0 for _ in range(H*W+W)] for __ in range(H*W+W)]

#横1マス
for y in range(H):
    l=M[y]
    for x in range(W-1):
        if l[x]^l[x+1]:
            R[y*W+x][y*W+x+1]=1
            R[y*W+x+1][y*W+x]=1

#縦1マス
for x in range(W):
    for y in range(H-1):
        if M[y][x]^M[y+1][x]:
            R[y*W+x][(y+1)*W+x]=1
            R[(y+1)*W+x][y*W+x]=1

for z in range(H*W+W):
    for p in range(H*W+W):
        for q in range(H*W+W):
            if R[p][z] and R[q][z]:
                if R[p][q]&1: continue
                d=R[p][z]+R[q][z]
                R[p][q]=R[q][p]=d

ans=0
for p in range(H*W+W):
    for q in range(p+1,H*W+W):
        if R[p][q]&1: ans+=1
print(ans)


### FIXED CODE ###

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

used=[[False for _ in range(W)] for __ in range(H)]
def dfs(sx,sy):
    global used
    if used[sy][sx]: return (0,0)
    black=white=0
    stack=[(sx,sy)]
    used[sy][sx]=True
    while stack:
        x,y=stack.pop()
        if M[y][x]=='#':
            black+=1
        else:
            white+=1
        for dx,dy in [(1,0),(-1,0),(0,1),(0,-1)]:
            nx,ny=x+dx,y+dy
            if 0<=nx<W and 0<=ny<H and not used[ny][nx]:
                if M[y][x]!=M[ny][nx]:
                    stack.append((nx,ny))
                    used[ny][nx]=True
    return (black,white)

ans=0
for y in range(H):
    for x in range(W):
        black,white=dfs(x,y)
        ans+=black*white
print(ans)
### BUGGY CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random,resource

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    x = I()

    c = collections.defaultdict(int)
    r = 0
    t = -x
    while True:
        r += 1
        t += x
        t %= 360
        if t >= 180:
            c[t - 180] -= 1
        else:
            c[t] += 1

        if all(v == 0 for v in c.values()):
            return r

    return -1


print(main())




### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random,resource

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    x = I()

    g = math.gcd(x, 360)

    return 360 // g


print(main())
### BUGGY CODE ###

import sys

def main():
  input = sys.stdin.readline
  N, M, Q  = map(int, input().split())
  
  DP = [[0 for _ in range(501)] for _ in range(N+1)] 
  for _ in range(M):
    l, r = map(int, input().split())
    DP[l][r] += 1

  A = [[0 for _ in range(N+1)] for _ in range(N+1)]
  for i in range(1, N+1):
    for j in range(i, N+1):
      for k in range(i, j+1):
        A[i][j] += sum(DP[k][:j+1])


  for _ in range(Q):
    p, q = map(int, input().split())
    print(A[p][q])


if __name__ == '__main__':
  main()

### FIXED CODE ###

import sys

def main():
  input = sys.stdin.readline
  N, M, Q  = map(int, input().split())
  
  DP = [[0 for _ in range(N+1)] for _ in range(N+1)] 
  for _ in range(M):
    l, r = map(int, input().split())
    DP[l][r] += 1

  cum = [[0 for _ in range(N+1)] for _ in range(N+1)]
  for i in range(1, N+1):
    for j in range(1, N+1):
      cum[i][j] = DP[i][j] + cum[i-1][j] + cum[i][j-1] - cum[i-1][j-1]

  for _ in range(Q):
    p, q = map(int, input().split())
    print(cum[q][q] - cum[p-1][q] - cum[q][p-1] + cum[p-1][p-1])


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

import bisect

A,B,Q = map(int,input().split())
S = [int(input()) for i in range(A)]
T = [int(input()) for i in range(B)]

for i in range(Q):
	x = int(input())
	ids = bisect.bisect_left(S,x)
	idt = bisect.bisect_left(T,x)
	ans = 0
	sl = -10000000000000000
	sr = 10000000000000000
	tl = -10000000000000000
	tr = 10000000000000000
	if ids!=0:
		sl = S[ids-1]
	if ids!=A:
		sr = S[ids]
	if idt!=0:
		tl = T[idt-1]
	if idt!=B:
		tr = T[idt]
	ans = min(max(sr,tr)-x,x-min(sl,tl))
	ans = min(ans,2*abs(x-sl)+abs(x-tr),abs(x-sl)+2*abs(x-tr),2*abs(x-sr)+abs(x-tl),abs(x-sr)+2*abs(x-tl))
	print(ans)


### FIXED CODE ###

import bisect

A,B,Q = map(int,input().split())
S = [int(input()) for i in range(A)]
T = [int(input()) for i in range(B)]

for i in range(Q):
	x = int(input())
	ids = bisect.bisect_left(S,x)
	idt = bisect.bisect_left(T,x)
	ans = 0
	sl = -10000000000000000
	sr = 10000000000000000
	tl = -10000000000000000
	tr = 10000000000000000
	if ids!=0:
		sl = S[ids-1]
	if ids!=A:
		sr = S[ids]
	if idt!=0:
		tl = T[idt-1]
	if idt!=B:
		tr = T[idt]
	ans = min(max(sr,tr)-x,x-min(sl,tl))
	ans = min(ans,2*abs(x-sl)+abs(x-tr),abs(x-sl)+2*abs(x-tr),2*abs(x-sr)+abs(x-tl),abs(x-sr)+2*abs(x-tl))
	print(ans)
### BUGGY CODE ###

a,b,k=map(int,input().split())
for i in range(k):
    if a>0:
        a-=1
    elif b>0:
        b-=1
    else:
        break
print(a,b)

### FIXED CODE ###

a,b,k=map(int,input().split())
print(a-k,b) if a>k else print(0,b-(k-a)) if a+b>k else print(0,0)
### BUGGY CODE ###

from fractions import gcd
def lcm(x, y):
  return (x * y) // gcd(x, y)
n,m=map(int,input().split())
x=lcm(n,m)
y=x//gcd(n,m)
a=input()
b=input()

for i in range(x):
  if i==0:
    if a[0] !=b[0]:
      print(-1)
      exit()
  elif i % y ==0:
    if a[i//(x//n)] !=b[i//(x//m)]:
      print(-1)
      exit()
print(x)

### FIXED CODE ###

from fractions import gcd
def lcm(x, y):
  return (x * y) // gcd(x, y)
n,m=map(int,input().split())
x=lcm(n,m)
y=x//gcd(n,m)
a=input()
b=input()

for i in range(x//y):
  if a[(x//m)*i] != b[(x//n)*i]:
    print(-1)
    exit()
print(x)
### BUGGY CODE ###

from sys import stdin
import numpy as np
def main():
    #入力
    readline=stdin.readline
    n=int(readline())
    abc=np.array([list(map(int,readline().split())) for _ in range(n)],dtype=np.int64)

    x=np.array([1,2])
    y=np.array([2,0])
    z=np.array([0,1])

    dp=np.zeros((n+1,3),dtype=np.int64)
    for i in range(1,n+1):
        dp[i]=[(dp[i-1,x]+abc[i-1,x]).max(),(dp[i-1,y]+abc[i-1,y]).max(),(dp[i-1,z]+abc[i-1,z]).max()]

    print(dp[n].max())

if __name__=="__main__":
    main()

### FIXED CODE ###

def main():
    N=int(input())
    abc=[0]*N
    for i in range(N):
        xyz=list(map(int,input().split()))
        abc[i]=xyz
    dp=[[0]*3 for _ in range(N+1)]
    for i in range(1,N+1):
        for j in range(3):
            dp[i][j]=max(dp[i-1][(j-1)%3]+abc[i-1][(j-1)%3],dp[i-1][(j-2)%3]+abc[i-1][(j-1)%3])

    print(max(max(dp[N][0],dp[N][1]),dp[N][2]))

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

# -*- coding: utf-8 -*-

from math import factorial

x,y = map(int,input().split())
cnt = 0

for i in range(0,x//2+1):
    if (x-2*i)*2+i == y:
        cnt += factorial(x-i)//(factorial(x-2*i)*factorial(i))

print(cnt%(10**9+7))

### FIXED CODE ###

x,y = map(int,input().split())
ans = 0
mod = 10**9+7

if (x+y)%3 == 0:
    m = (2*y-x)//3
    n = (2*x-y)//3
    if m >= 0 and n >= 0:
        fac = [1]*(m+n+1)
        for i in range(2,m+n+1): 
            fac[i] = fac[i-1]*i % mod
        ans = fac[m+n]*(pow(fac[m],mod-2,mod)*pow(fac[n],mod-2,mod)%mod)%mod

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

import sys
stdin = sys.stdin

N = int(stdin.readline().rstrip())
A = list(map(int,stdin.readline().split()))
mod = 10**9+7
ans = 0
for i in range(61):
    bits = 0
    for x in A:
        if (x>>i)&1:
            bits += 1
    ans += ((bits*(N-bits))* 2**i) %mod
ans %= mod
print(ans)


### FIXED CODE ###

import sys
stdin = sys.stdin
 
mod = 10**9 + 7
 
def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))
 
def main():
    n = ni()
    a = na()
    ans = 0
    for i in range(61):
        cnt = 0
        for ai in a:
            if (ai >> i) & 1:
                cnt += 1
        ans += ((cnt * (n - cnt)) * 2**i) % mod
    ans %= mod
    print(ans)
 
 
if __name__ == "__main__":
    main()
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
import functools
import operator
prod = functools.partial(functools.reduce, operator.mul)
B = prod(A)
if B <= 10 ** 18:
    print(B)
else:
    print(-1)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
 
 
ans = 1
if 0 in a:
    print(0)
    exit()
 
for i in a:
    ans *= i
    if ans > 10**18:
        print(-1)
        exit()
 
print(ans)
### BUGGY CODE ###

n,m=[int(i) for i in input().split()]
l=[]
for i in range(n):
    a=int(input())
    l.append(a)
l=sorted(l)
b=l[0:m]
maxs=max(b)-min(b)
for i in range(0,(n-m)):
    b.pop(0)
    b.append(l[i+m])
    c=(max(b)-min(b))
    if(c<maxs):
        maxs=c
print(maxs)

### FIXED CODE ###

N, K = map(int, input().split())
h = sorted([int(input()) for i in range(N)])

hmax = 0
hmin = 0
ans = 10**10
for i in range(N - K + 1):
    hmax = h[i + K - 1]
    hmin = h[i]
    if hmax - hmin < ans:
        ans = hmax - hmin
print(ans)