Harryxun/stf_run huggingface dataset:
l,r = map(int,input().split())

if r-l >= 2019:
      print(0)
else:
      m = 2019
      for i in range(l,r+1):
            for j in range(i+1,r+1):
                  m = min(m,(i*j)%2019)
print(m)

### FIXED CODE ###

from itertools import combinations

l,r = map(int,input().split())

if r - l >= 2019:
    print(0)
else:
    m = 2019
    for i, j in combinations(range(l, r+1),2):
        tmp = i*j % 2019
        if m > tmp:
            m = tmp
    print(m)
date = input()
firstvalid = isMonth(date[0:2])
secondvalid = isMonth(date[2:])

if firstvalid && secondvalid:
  print('AMBIGUOUS')
elif firstvalid:
  print('MMYY')
elif secondvalid:
  print('YYMM')
else:
  print('NA')
  


def isMonth(x):
  return 1 <= int(x) <= 12


### FIXED CODE ###

def isMonth(x):
  y = int(x)
  return (1 <= y and y <= 12)

date = input()
firstvalid = isMonth(date[0:2])
secondvalid = isMonth(date[2:])
 
if firstvalid and secondvalid:
  print('AMBIGUOUS')
elif firstvalid:
  print('MMYY')
elif secondvalid:
  print('YYMM')
else:
  print('NA')
n = int(input())
a = [[int(input())-1, False] for _ in range(n)]
a[0][1] = True
now = 0
cnt = 0
while True:
    now = a[now][0]
    if a[now][1]:
        print(f"now={now}") 
        print(-1)
        break
    a[now][1] = True
    cnt += 1
    if now == 1:
        print(cnt)
        break


### FIXED CODE ###

n = int(input())
a = [[int(input())-1, False] for _ in range(n)]
a[0][1] = True
now = 0
cnt = 0
while True:
    now = a[now][0]
    if a[now][1]:
        print(-1)
        break
    a[now][1] = True
    cnt += 1
    if now == 1:
        print(cnt)
        break
from math import gcd
n = int(input())
l = list(map(int, input().strip().split()))
maxe = -1
     
for i in range(n):
    for j in range(n):
        if i != j:
            g = gcd(l[i],l[j])
            maxe = max(maxe, g)
print(maxe)

### FIXED CODE ###

from fractions import gcd
N = int(input())
A = list(map(int, input().split()))
 
X1 = [0] * (N+2)
X2 = [0] * (N+2)
 
for i in range(N):
    X1[i+1] = gcd(X1[i], A[i])
for i in range(N,0,-1):
    X2[i] = gcd(X2[i+1], A[i-1])

k = []
for i in range(N):
    k.append(gcd(X1[i],X2[i+2]))

print(max(k))
#!/usr/bin/env python3
n,p= map(int,input().split())
s = input()
ans = 0
if p == 2 or p == 5:#右端を固定すれば2,5で割り切れるならそれ以降は全部いけるのでn-iをたす
    for i in range(n):
        if int(s[-1-i]) % p == 0:
            ans += n-i
    print(ans)
    exit()
else:
  s = s[::-1]#反転させてしたからみる
  cnt = [0]*p # pで割った時のあまり
  cnt[0] = 1 # 0の時はなにも取らない時全体も入るので+1する
  for i,c in enumerate(map(int,s)):#enumerateでiterator i , s[i]の値cを同時に取得
    k = c*pow(10,i) + cnt[i-1]
    k = k % p
  for i in range(p):
    ans += cnt[i]*(cnt[i]-1) //2
  print(ans)



### FIXED CODE ###

#!/usr/bin/env python3
n,p= map(int,input().split())
s = input()
ans = 0
if p == 2 or p == 5:#右端を固定すれば2,5で割り切れるならそれ以降は全部いけるのでn-iをたす
    for i in range(n):
        if int(s[-1-i]) % p == 0:
            ans += n-i
    print(ans)
    exit()
else:
  s = s[::-1]#反転させてしたからみる
  cnt = [0]*p # pで割った時のあまり
  cnt[0] = 1 # 0の時はなにも取らない時全体も入るので+1する
  modp = 0
  for i,c in enumerate(map(int,s)):#enumerateでiterator i , s[i]の値cを同時に取得
    modp = (c*pow(10,i,p) + modp)%p
    cnt[modp] += 1
  for i in range(p):
    ans += cnt[i]*(cnt[i]-1) //2
  print(ans)
def a_darker_and_darker(H, W, Grid, INF=float('inf')):
    def is_in_field(row, col):
        return (0 <= row < W) and (0 <= col < H)

    grid, q = [[None] * W for _ in range(H)], []
    # 黒マスがどこにあるかを調べる。ついでにgridを初期化
    for row in range(H):
        for col in range(W):
            if Grid[row][col] == '#':
                grid[row][col] = True
                q.append((row, col))
            else:
                grid[row][col] = False

    # '#'があるマスから上下左右に移動することを繰り返して任意のマスに到達する。
    # 何回繰り返せばすべてのマスに到達できるか？
    directions = ((-1, 0), (0, 1), (1, 0), (0, -1))  # 上右下左の隣接マスを指定
    ans = 0
    while q:
        tmp = []
        for row, col in q:
            for dr, dc in directions:
                nr, nc = row + dr, col + dc
                if is_in_field(nr, nc) and (not grid[nr][nc]):
                    grid[nr][nc] = True
                    tmp.append((nr, nc))
        ans += (1 if tmp else 0)
        q = tmp
    return ans

H, W = [int(i) for i in input().split()]
Grid = [input() for _ in range(H)]
print(a_darker_and_darker(H, W, Grid))

### FIXED CODE ###

def a_darker_and_darker(H, W, Grid):
    def is_in_field(row, col):
        return (0 <= row < H) and (0 <= col < W)

    grid, q = [[None] * W for _ in range(H)], []
    # 黒マスがどこにあるかを調べる。ついでにgridを初期化
    for row in range(H):
        for col in range(W):
            if Grid[row][col] == '#':
                grid[row][col] = True
                q.append((row, col))
            else:
                grid[row][col] = False

    # '#'があるマスから上下左右に移動することを繰り返して任意のマスに到達する。
    # 何回繰り返せばすべてのマスに到達できるか？
    directions = ((-1, 0), (0, 1), (1, 0), (0, -1))  # 上右下左の隣接マスを指定
    ans = 0
    while q:
        tmp = []
        for row, col in q:
            for dr, dc in directions:
                nr, nc = row + dr, col + dc
                if is_in_field(nr, nc) and (not grid[nr][nc]):
                    grid[nr][nc] = True
                    tmp.append((nr, nc))
        ans += (1 if tmp else 0)
        q = tmp
    return ans

H, W = [int(i) for i in input().split()]
Grid = [input() for _ in range(H)]
print(a_darker_and_darker(H, W, Grid))
n = int(input())
x = int(input())
t = int(input())
 
if(n%x==0):
  count = n // x
else:
  count = n // x + 1
 
print(count*t)

### FIXED CODE ###

n = []
n = input().split()
n_1 = int(n[0])
x = int(n[1])
t = int(n[2])
 
if(n_1%x==0):
  count,mod = divmod(n_1,x)
else:
  count,mod = divmod(n_1,x)
  count = count + 1
 
print(count*t)
def main():
    import sys
    input = sys.stdin.readlin
    
    n,q=map(int,input().split())
    tree=[[] for _ in range(n)]
    for i in range(n-1):
        a,b=map(int,input().split())
        tree[a-1].append(b-1)
        tree[b-1].append(a-1)
    p=[0]*q
    x=[0]*q
    for i in range(q):
        p[i],x[i] = map(int,input().split())
        
    px=[[] for i in range(n)]
    for pp,xx in zip(p,x):
        px[pp-1].append(xx)
    px=[sum(i) for i in px]
    c=[0]*n
    flag=[True]*n
     
    from collections import deque
    q = deque([(-1,0,0)])
    while q:
        parent,child,point = q.popleft()
        if parent!=-1:
            flag[parent]=False
        point+=px[child]
        c[child]=point
        for y in tree[child]:
            if y == parent:
                continue
            if flag[y]:
                q.append((child,y,point))
    print(*c)
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline
    
    n,q=map(int,input().split())
    tree=[[] for _ in range(n)]
    for i in range(n-1):
        a,b=map(int,input().split())
        tree[a-1].append(b-1)
        tree[b-1].append(a-1)
    p=[0]*q
    x=[0]*q
    for i in range(q):
        p[i],x[i] = map(int,input().split())
        
    px=[[] for i in range(n)]
    for pp,xx in zip(p,x):
        px[pp-1].append(xx)
    px=[sum(i) for i in px]
    c=[0]*n
    flag=[True]*n
     
    from collections import deque
    q = deque([(-1,0,0)])
    while q:
        parent,child,point = q.popleft()
        if parent!=-1:
            flag[parent]=False
        point+=px[child]
        c[child]=point
        for y in tree[child]:
            if y == parent:
                continue
            if flag[y]:
                q.append((child,y,point))
    print(*c)
if __name__ == '__main__':
    main()
N,H,W = map(int,input().split())

print ((N-H+1) * (N-W+1))

### FIXED CODE ###

N=int(input())
H=int(input())
W=int(input())

print ((N-H+1) * (N-W+1))
while True:	
	H,W = map(int, input().split())
	if H==0 and W==0: break
	for y in range(0,H):
		for x in range(0,W):
			print("#",end="")
	    print('\n')
print('\n')


### FIXED CODE ###

while True:	
	H,W = map(int, input().split())
	if H==0 and W==0: break
	for y in range(0,H):
		for x in range(0,W):
			print("#",end="")
			
		print()
	print()
def p_d():
    from bisect import bisect_right
    A, B, Q = map(int, input().split())
    INF = 10 ** 9
    s = [-INF] + [int(input()) for _ in range(A)] + [INF]
    t = [-INF] + [int(input()) for _ in range(B)] + [INF]
    ans = []
    for _ in range(Q):
        x = int(input())
        b, d = bisect_right(s, x), bisect_right(t, x)
        res = INF
        for S in [s[b - 1], s[b]]:
            for T in [t[d - 1], t[d]]:
                d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
                res = min((d1, d2, res))
        ans.append(str(res))
    print("\n".join(ans))


if __name__ == '__main__':
    p_d()


### FIXED CODE ###

def p_d():
    from bisect import bisect_right
    A, B, Q = map(int, input().split())
    INF = 10 ** 18
    s = [-INF] + [int(input()) for _ in range(A)] + [INF]
    t = [-INF] + [int(input()) for _ in range(B)] + [INF]
    ans = []
    for _ in range(Q):
        x = int(input())
        b, d = bisect_right(s, x), bisect_right(t, x)
        res = INF
        for S in [s[b - 1], s[b]]:
            for T in [t[d - 1], t[d]]:
                d1, d2 = abs(S - x) + abs(T - S), abs(T - x) + abs(S - T)
                res = min((d1, d2, res))
        ans.append(str(res))
    print("\n".join(ans))


if __name__ == '__main__':
    p_d()
n = int(input())
a = int(input())
b = int(input())

if n ==1:
    print('Hello World')
if n == 2:
    print(a+b)

### FIXED CODE ###

n = int(input())


if n ==1:
    print('Hello World')
if n == 2:
    a = int(input())
    b = int(input())
    print(a+b)
for i in range(n):
    bb=int(input())
    for j in range(3):
        if bb==b1[j]:
            b1[j]=0
        elif bb==b2[j]:
            b2[j]=0
        elif bb==b3[j]:
            b3[j]=0
if sum(b1)==0 or sum(b2)==0 or sum(b3)==0:
    print("Yes")
elif b1[0]==b2[0]==b3[0]==0:
    print("Yes")
elif b1[1]==b2[1]==b3[1]==0:
    print("Yes")
elif b1[2]==b2[2]==b3[2]==0:
    print("Yes")

    
elif b1[0]==b2[1]==b3[2]==0:
    print("Yes")
elif b1[2]==b2[1]==b3[0]==0:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

b1=list(map(int,input().split()))
b2=list(map(int,input().split()))
b3=list(map(int,input().split()))
n=int(input())

for i in range(n):
    bb=int(input())
    for j in range(3):
        if bb==b1[j]:
            b1[j]=0
        elif bb==b2[j]:
            b2[j]=0
        elif bb==b3[j]:
            b3[j]=0
if sum(b1)==0 or sum(b2)==0 or sum(b3)==0:
    print("Yes")
elif b1[0]==b2[0]==b3[0]==0:
    print("Yes")
elif b1[1]==b2[1]==b3[1]==0:
    print("Yes")
elif b1[2]==b2[2]==b3[2]==0:
    print("Yes")
elif b1[0]==b2[1]==b3[2]==0:
    print("Yes")
elif b1[2]==b2[1]==b3[0]==0:
    print("Yes")
else:
    print("No")
from bisect import bisect_left,bisect_right
n=int(input())
a=list(map(int,input().split()))
edge=[[]for _ in range(n)]
for _ in range(n-1):
  u,v=map(int,input().split())
  u-=1
  v-=1
  edge[u].append(v)
  edge[v].append(u)
ans=[-1]*n
dp=[10**10]*n

#オイラーツアー
#n=頂点数、s=始点、edge=隣接リスト
#木構造を投げると訪問順listが帰ってくる、|ans|=2*n-1
#適宜書き換えて実装を楽にしましょう
def EulerTour(n,s,e):
  EulerTour_list=[]
  def EulerTour_dfs(i,root):
    EulerTour_list.append(i)
    ind=bisect_right(dp,a[i])
    bef=dp[ind]
    dp[ind]=a[i]
    ans[i]=bisect_left(dp,10**10)
    for j in e[i]:
      if j!=root:
        EulerTour_dfs(j,i)
    if root!=-1:
      EulerTour_list.append(root)
      dp[ind]=bef
  EulerTour_dfs(s,-1)
  return EulerTour_list

EulerTour(n,0,edge)
print(*ans)

### FIXED CODE ###

#入力高速化 + 再帰回数制限解除
import sys
input=sys.stdin.readline
sys.setrecursionlimit(10000000)

from bisect import bisect_left,bisect_right
n=int(input())
a=list(map(int,input().split()))
edge=[[]for _ in range(n)]
for _ in range(n-1):
  u,v=map(int,input().split())
  u-=1
  v-=1
  edge[u].append(v)
  edge[v].append(u)
ans=[-1]*n
dp=[10**10]*n

#オイラーツアー
#n=頂点数、s=始点、edge=隣接リスト
#木構造を投げると訪問順listが帰ってくる、|ans|=2*n-1
#適宜書き換えて実装を楽にしましょう
def EulerTour(n,s,e):
  EulerTour_list=[]
  def EulerTour_dfs(i,root):
    EulerTour_list.append(i)
    ind=bisect_left(dp,a[i])
    bef=dp[ind]
    dp[ind]=a[i]
    ans[i]=bisect_left(dp,10**10)
    for j in e[i]:
      if j!=root:
        EulerTour_dfs(j,i)
    if root!=-1:
      EulerTour_list.append(root)
      dp[ind]=bef
  EulerTour_dfs(s,-1)
  return EulerTour_list

EulerTour(n,0,edge)
print(*ans)
import sys
sys.setrecursionlimit(10**9)
Input = open('input.txt')
def input(): return Input.readline()
def mapint(): return map(int, input().split())

N, C = mapint()
xv = [list(mapint()) for _ in range(N)]
righthand = [0]*N
lefthand = [0]*N
nowv = 0
maxv = -10**18
for i, (x, v) in enumerate(xv):
    nowv += v
    maxv = max(maxv, nowv-x)
    righthand[i] = maxv
nowv = 0
maxv = -10**18
for i, (x, v) in enumerate(xv[::-1]):
    nowv += v
    maxv = max(maxv, nowv-(C-x))
    lefthand[i] = maxv

xv = [(0, 0)] + xv +[(C, 0)]
righthand = [0]+righthand
lefthand = [0]+lefthand
rmax = 0
for i in range(N+1):
    rmax = max(rmax, righthand[i]-xv[i][0]+lefthand[N-i])
lmax = 0
for i in range(N):
    lmax = max(lmax, lefthand[i]-(C-xv[-i-1][0])+righthand[N-i])
print(rmax, lmax)

### FIXED CODE ###

import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, C = mapint()
xv = [list(mapint()) for _ in range(N)]
righthand = [0]*N
lefthand = [0]*N
nowv = 0
maxv = -10**18
for i, (x, v) in enumerate(xv):
    nowv += v
    maxv = max(maxv, nowv-x)
    righthand[i] = maxv
nowv = 0
maxv = -10**18
for i, (x, v) in enumerate(xv[::-1]):
    nowv += v
    maxv = max(maxv, nowv-(C-x))
    lefthand[i] = maxv
 
xv = [(0, 0)] + xv +[(C, 0)]
righthand = [0]+righthand
lefthand = [0]+lefthand
rmax = 0
for i in range(N+1):
    rmax = max(rmax, righthand[i]-xv[i][0]+lefthand[N-i])
lmax = 0
for i in range(N):
    lmax = max(lmax, lefthand[i]-(C-xv[-i-1][0])+righthand[N-i])
print(max(rmax, lmax))
a,b,c,d,e,k=map(int,input())
if e-a>=k:
    print('Yay!')
else:
    print(':(')

### FIXED CODE ###

a,b,c,d,e,k=[int(input()) for _ in range(6)]
if e-a<=k:
    print('Yay!')
else:
    print(':(')
s = input()
n = int(s)

m = str(int(s[0]) - 1) + (len(s) - 1) * "9" 
ans1 = 0
for i in range(len(m)):
    ans1 += int(m[i])

if s[-1] != "9":
    n1 = n - (int(s[-1]) + 1)
    s = str(n1)

ans2 = 0
for i in range(len(s)):
    ans2 += int(s[i])

print(max(ans1, ans2))


### FIXED CODE ###

s = input()
n = int(s)

m = str(int(s[0]) - 1) + (len(s) - 1) * "9" 
ans1 = 0
for i in range(len(m)):
    ans1 += int(m[i])

if s[-1] != "9" and n >= 10:
    n1 = n - (int(s[-1]) + 1)
    s = str(n1)

ans2 = 0
for i in range(len(s)):
    ans2 += int(s[i])

print(max(ans1, ans2))
n, h = map(int, input().split())
a = list(map(int, input().split()))

sum = 0
for i in range(n):
	sum = sum + a[i]
if sum >= h :
	print("Yes")
else:
	print("No")


### FIXED CODE ###

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

sum = 0
for i in range(n):
	sum = sum + a[i]
if sum >= h :
	print("Yes")
else:
	print("No")
a, b, c = map(str, input().split().upper())
print(a[0] + b[0] + c[0])


### FIXED CODE ###

a, b, c = input().split()
print((a[0] + b[0] + c[0]).upper())
import sys
import math
N, K = map(int, input().split())
A = list(map(int, input().split()))

if N == K:
    print(1)
    sys.exit(0)

minimum = min(A)
count = 0
for i in range(N-K+1):
    if A[i+K] == [minimum] * K:
        count += 0

ans = math.ceil(N/K) - count
print(ans)

### FIXED CODE ###

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

t = 1
while True:
    if 1 + t * (K - 1) >= N:
        break
    t += 1

print(t)
n=int(input())
a=list(map(int,input().split()))
temp=[0]*n
for i in range(0,n):
  temp[i]=a[i]-(i+1)
temp.sort()
ave=temp/n
print(ave)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
temp=[0]*n
for i in range(0,n):
  temp[i]=a[i]-(i+1)
temp.sort()
ave=int(n/2)
ans=0
for i in range(0,n):
  ans=ans+abs(temp[i]-temp[ave])
print(ans)
N, W = map(int, input().split())

MAX_V = 10**5
dp = [[10**(18)]*(MAX_V+1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(1, N+1):
  w, v = map(int, input().split())
  for j in range(MAX_V+1):
    dp[i][j] = dp[i-1][j]
    if j >= v:
      dp[i][j] = min(dp[i][j], dp[i-1][j-v]+w)

ans = 0
for j in range():
  if dp[N][j] <= W and dp[N][j] != 10**(18):
    ans = max(ans, j)
print(ans)

### FIXED CODE ###

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

MAX_V = 10**5
dp = [[10**(18)]*(MAX_V+1) for _ in range(N+1)]
dp[0][0] = 0

for i in range(1, N+1):
  w, v = map(int, input().split())
  for j in range(MAX_V+1):
    dp[i][j] = dp[i-1][j]
    if j >= v:
      dp[i][j] = min(dp[i][j], dp[i-1][j-v]+w)

ans = 0
for j in range(MAX_V+1):
  if dp[N][j] <= W and dp[N][j] != 10**(18):
    ans = max(ans, j)
print(ans)
#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def attackSurvival(n, k, q, a):
    ans = []
    import collections
    c = collections.Counter(a)
    for i in range(n):
        if c[i+1] > q - k: ans.append('Yes')
        else: ans.append('No')
    return ans

def main():
    n, k, q = filter(int, input().split())
    a = []
    for _ in range(q):
        a.append(int(input()))

if __name__ == '__main__':
    main()


### FIXED CODE ###

#! /usr/bin/env python3
# -*- coding:utf-8 -*-

def attackSurvival(n, k, q, a):
    ans = []
    import collections
    c = collections.Counter(a)
    for i in range(n):
        if c[i+1] > q - k: ans.append('Yes')
        else: ans.append('No')
    return ans

def main():
    n, k, q = map(int, input().split())
    a = []
    for _ in range(q):
        a.append(int(input()))
    for ans in attackSurvival(n, k, q, a): print(ans)

if __name__ == '__main__':
    main()
x = input()
print x ** 3

### FIXED CODE ###

x = int(input())
print (x ** 3)
n, q = map(int, input().split())

edges = dict()
for _ in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges.setdefault(a, [])
    edges[a].append(b)
    edges.setdefault(b, [])
    edges[b].append(a)

counter = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    p -= 1
    counter[p] += x

ans = [0] * n


def f(par, node, count):
    count += counter[node]
    ans[node] = count
    for n in edges[node]:
        if n == par:
            continue
        f(node, n, count)


f(-1, 0, 0)
print(*ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)
input = sys.stdin.readline

n, q = map(int, input().split())

edges = [[] for _ in range(n)]
for _ in range(n - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    edges[a].append(b)
    edges[b].append(a)

counter = [0] * n
for _ in range(q):
    p, x = map(int, input().split())
    p -= 1
    counter[p] += x

ans = [0] * n


def f(par, node, count):
    count += counter[node]
    ans[node] = count
    for n in edges[node]:
        if n == par:
            continue
        f(node, n, count)


f(-1, 0, 0)
print(*ans)
N = int(input())
a = list(map(int,input().split()))
Alice=0
Bob=0
a.sort(reversed=True)
for i in range(N):
    if i % 2 == 0:
        Alice+=a[i]
    else:
        Bob+=a[i]
if Alice>Bob:
    print(Alice-Bob)
else:
    print(Bob-Alice)

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
Alice=0
Bob=0
a.sort(reverse=True)
for i in range(N):
    if i % 2 == 0:
        Alice+=a[i]
    else:
        Bob+=a[i]
if Alice>Bob:
    print(Alice-Bob)
else:
    print(Bob-Alice)
#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
D = 1000000007
n, m = map(int, input().split())
a = [0] * (10**6)
for i in range(m):
    a[int(input())] += 1

# 初期値
s0 = 1
if (a[1] == 1):
    s1 = 0
else:
    s1 = 1


def calc(l, acc1, acc2):
    # print("calc(l, acc1, acc2):" + str(l) + str(acc1) + str(acc2))
    if (l == 1):
        return acc2
    else:
        oldacc2 = acc2
        if (a[n - l + 2] == 1):
            acc2 = 0
        else:
            acc2 = (acc1 + acc2) % D
        acc1 = oldacc2
        return calc(l - 1, acc1, acc2)


print(calc(n, s0, s1))


### FIXED CODE ###

#! /Library/Frameworks/Python.framework/Versions/3.7/bin/python3
D = 1000000007
n, m = map(int, input().split())
a = [0] * (10**5 + 1)
for i in range(m):
    a[int(input())] += 1

# 初期値
s = [0] * (n + 1)
s[0] = 1
if (a[1] == 1):
    s[1] = 0
else:
    s[1] = 1

# 暫定結果を格納する配列


def calc(n):
    if(a[n] == 1):
        return 0
    else:
        return (s[n - 1] + s[n - 2]) % D


def solver(n):
    for i in range(2, n + 1):
        s[i] = calc(i)


solver(n)
print(s[n])
ref = [1.1,0.6,0.2,0.0]
rank = [[0,0] for i in range(4)]
while True:
    try:
        eye = map(float, raw_input().split())
        for i in range(2): 
            for j in range(4):
                if eye[i] >= ref[j]: rank[j][i] += 1
                break
    except:
        break

    print " ".join(map(str, rank[i])) for i in range(4)

### FIXED CODE ###

from bisect import bisect
ref = [0.2,0.6,1.1]
l,r = [0]*4,[0]*4
while 1:
    try:
        le,re = map(float, raw_input().split())
    except:
        break
    l[bisect(ref,le)] += 1
    r[bisect(ref,re)] += 1
for i in range(1,5):
	print l[-i],r[-i]
l = int(input().split())
print(l[0] * l[1] - (l[0] + l[1] -1))

### FIXED CODE ###

a, b = map(int, input().split())
 
print((a - 1) * (b - 1))
from math import gcd


def lcm(x, y):
    return int(x / gcd(x, y) * y)


def greatLCM(a):
    if len(a) < 2:
        return a[0]
    ans = lcm(a[0], a[1])
    p = 2
    while p < len(a):
        ans = lcm(ans, a[p])
        p += 1
    return ans


mod = 10 ** 9 + 7
n = int(input())
arr = list(map(int, input().split()))
g = greatLCM(arr)
answer = 0
for i in arr:
    answer += g / i

print(int(answer % mod))


### FIXED CODE ###

import fractions

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

def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

def solve():
    memo = A[0]
    for i in range(1, N):
        memo = lcm(memo, A[i])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())
import numpy as np
def knapsack(w,val,W,n,t):
    for i in range(1,n+1):
        for j in range(1,W+1):
            if w[i-1]<=j:
                t[i][j]=max(val[i-1]+t[i-1][j-w[i-1]],t[i-1][j])
            else:
                t[i][j]=t[i-1][j]
    return t[n][W]            
n,W=map(int,input().split())                
w=[]
val=[]
t=np.zeros([n+1,W+1],dtype=int)
for i in range(0,n):
    a,b=map(int,input().split())
    w.append(a)
    val.append(b)
ans=knapsack(w,val,W,n,t)
print(ans)
    

### FIXED CODE ###

def knapsack(w,val,W,n,t):
    for i in range(1,n+1):
        for j in range(1,W+1):
            if w[i-1]<=j:
                t[i][j]=max(val[i-1]+t[i-1][j-w[i-1]],t[i-1][j])
            else:
                t[i][j]=t[i-1][j]
    return t[n][W]            
n,W=map(int,input().split())                
w=[]
val=[]
t=[[0 for x in range(W+1)] for x in range(n+1)] 
for i in range(0,n):
    a,b=map(int,input().split())
    w.append(a)
    val.append(b)
ans=knapsack(w,val,W,n,t)
print(ans)
a = int,input()
print(a+(a**2)+(a**3))


### FIXED CODE ###

a = input()
b = int(a)
print(b+b**2+b**3)
a=int(input(""))
b=int(input(""))
c=int(input(""))
x=int(input(""))
def countcourse(r,t,y,u):
  cnt=0
  for h in range(r):
    for l in range(t):
      for y range(y):
        if 500*h+100*l+50*y==u:
          cnt+=1
  return cnt
print(countcourse(a,b,c,x))

### FIXED CODE ###

a=int(input(""))
b=int(input(""))
c=int(input(""))
x=int(input(""))
def countcourse(r,t,y,u):
    cnt=0
    n=0
    for h in range(r+1):
        for l in range(t+1):
            for o in range(y+1):
                if 500*h+100*l+50*o==u:
                    cnt+=1
    return cnt
print(countcourse(a,b,c,x))