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

l, r = map(int, input().split())
a= 2019
for i in range(r - l):
    for j in range(i + 1, r - l + 1):
        tmp = (l + i) * (l + j) % 2019
        if a > tmp:
            a = tmp

print(a)

### FIXED CODE ###

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

for i in range(r - l):
    t = 2019
    for j in range(i + 1, r - l + 1):
        tmp = (l + i) * (l + j) % 2019
        if a > tmp:
            a = tmp
        if a == 0:
            print(a)
            exit()
#        if tmp > t:
#            break
#        t = tmp
        

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

import sys
from bisect import bisect

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    B = list(map(int, input().split()))
    C = list(map(int, input().split()))

    ans = 0
    for a in A:
        for b in B:
            for c in C:
                if a < b < c:
                    ans += 1

    print(ans)



if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from bisect import bisect
from itertools import accumulate

def main():
    input = sys.stdin.readline
    N = int(input())
    A = sorted(list(map(int, input().split())))
    B = sorted(list(map(int, input().split())))
    C = sorted(list(map(int, input().split())))

    Bn = [0] * N
    for i in range(N):
        b = B[i]
        m = bisect(C, b)
        Bn[i] = (N - m)

    Bn = list(accumulate(Bn[::-1]))[::-1]
    Bn += [0]

    ans = 0
    for i in range(N):
        a = A[i]
        m = bisect(B, a)
        ans += Bn[m]

    print(ans)


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

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

### FIXED CODE ###

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

import queue
h,w = map(int,input().split())

#aij = [input() for i in range(h)]

moji = [[0 for i in range(w)] for j in range(h)]

for i in range(h):
    aij = input()
    #print(aij)
    for j in range(w):
        moji[i][j] = aij[j]

#moji = aij
#print(moji,aij)
#exit()

#print(aij)
vx = [0,1,0,-1]
vy = [1,0,-1,0]

ans = 0

for i in range(h*w):
    y = i//w
    x = i%w
    #print(i)
    if moji[y][x] == '#':
        continue
    else:
        q = queue.Queue()
        q.put([i,1])
        flag = False
        
        while flag == False:
            tmp,num = q.get()
            x = tmp//w
            y = tmp%w
            #print(tmp,num)
            for j in range(4):
                nx = x+vx[j]
                ny = y+vy[j]
                #print(ny,nx)
                if nx < 0 or nx >= w or ny < 0 or ny >= h:
                    continue
                if moji[ny][nx] == "#":
                    flag = True
                    break
                else:
                    q.put([ny*w+nx,num+1])
                    
        ans = max(ans,num)

print(ans)

### FIXED CODE ###

import queue
from collections import deque
h,w = map(int,input().split())

#aij = [input() for i in range(h)]

moji = [[0 for i in range(w)] for j in range(h)]

dist = [[-1]*w for _ in range(h)]

for i in range(h):
    aij = input()
    #print(aij)
    for j in range(w):
        moji[i][j] = aij[j]

#moji = aij
#print(moji,aij)
#exit()

#print(aij)
vx = [0,1,0,-1]
vy = [1,0,-1,0]

ans = 0
q = deque()

for i in range(h*w):
    y = i//w
    x = i%w
    #print(i)
    if moji[y][x] == '#':
        q.append(i)
        dist[y][x] = 0

#ans = -1

ans = 0

while q:
    #print(q.qsize())
    tmp = q.popleft()
    y = tmp//w
    x = tmp%w
    d = dist[y][x]
    #print(tmp,num)
    for j in range(4):
        nx = x+vx[j]
        ny = y+vy[j]
        #print(ny,nx)
        if nx < 0 or nx >= w or ny < 0 or ny >= h:
            continue
        if dist[ny][nx] == -1:
            dist[ny][nx] = d+1
            #moji[ny][nx] = '#'
            q.append(ny*w+nx)
    #ans += 1
    ans = max(d,ans)

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

import numpy as np

H, W = [int(item) for item in input().split()]
grid = [[item for item in input()] for _ in range(H)]

dp = np.zeros((H+1, W+1), dtype='int32')
max_num = 10**9 +7

def main():
    dp[0][1] = 1

    for i in range(H):
        for j in range(W):
            if grid[i][j] != '#':
                dp[i+1][j+1] = (dp[i][j+1] + dp[i+1][j]) % max_num
            

    # print(dp)
    print(dp[H][W])

if __name__ == "__main__":
    main()

### FIXED CODE ###

H, W = [int(item) for item in input().split()]
grid = [[item for item in input()] for _ in range(H)]

dp = [[0 for _ in range(W+1)] for _ in range(H+1)]
max_num = 10**9 +7

def main():
    dp[0][1] = 1

    for i in range(H):
        for j in range(W):
            if grid[i][j] != '#':
                dp[i+1][j+1] = (dp[i][j+1] + dp[i+1][j]) % max_num
            

    # print(dp)
    print(dp[H][W])

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

import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():

    S = input()
    S = S[::-1]
    MOD = 10 ** 9 + 7

    dp = [0] * 13
    dp[0] = 1

    mul = 1
    for i in range(len(S)):
        next_dp = [0] * 13
        if S[i] == '?':
            for k in range(10):
                for j in range(13):
                    jj = ((k * mul) + j) % 13
                    next_dp[jj] += dp[j]
                    next_dp[jj] %= MOD
        else:
            num = int(S[i])
            for j in range(13):
                jj = ((num * mul) + j) % 13
                next_dp[jj] += dp[j]
                next_dp[jj] %= MOD

        mul *= 10
        dp = next_dp

    print(dp[5])


if __name__ == '__main__':
    solve()


### FIXED CODE ###

mod = 10 ** 9 + 7

S = input()
dp = [[0] * 13 for _ in range(len(S) + 1)]
dp[0][0] = 1
mul = 1

for i in range(len(S)):
    x = S[-(i + 1)]
    if x == "?":
        for k in range(10):
            for j in range(13):
                dp[i + 1][(mul * k + j) % 13] += dp[i][j]
                dp[i + 1][(mul * k + j) % 13] %= mod
    else:
        k = int(x)
        for j in range(13):
            dp[i + 1][(mul * k + j) % 13] += dp[i][j]
            dp[i + 1][(mul * k + j) % 13] %= mod
    mul = mul * 10 % 13

print(dp[len(S)][5])
### BUGGY CODE ###

n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
tour=[0]
next_town = 0
for i in range(n*2):
    next_town=A[next_town]-1
    if next_town in tour:
        first_roop_idx = tour.index(next_town)
        break
    tour.append(next_town)
#print(tour)
if k<=len(tour):
    ans = tour[k]
else:
    k-=first_roop_idx
    #print(k)
    k=k%(len(tour)-first_roop_idx)
    #print(k)
    ans = tour[first_roop_idx+k]
print(ans+1)


### FIXED CODE ###

n,k = list(map(int,input().split()))
A = list(map(int,input().split()))
tour=[0]
visited=[0]*n
visited[0]=1
next_town = 0
flag=False
for i in range(n):
    next_town=A[next_town]-1
    if i+1==k:
        flag = True
        ans = next_town
        break
    if next_town==0:
        first_roop_idx = 0
        break
    if visited[next_town]>0:
        first_roop_idx = visited[next_town]
        break
    tour.append(next_town)
    visited[next_town]=i+1
#print(tour)
#print(visited)
#print(first_roop_idx)
if not flag:
    if k<=len(tour):
        ans = tour[k]
    else:
        k-=first_roop_idx
        #print("k=",k)
        if len(tour)-first_roop_idx==0:
            k=0
        else:k=k%(len(tour)-first_roop_idx)
        #print("k=",k)
        ans = tour[first_roop_idx+k]
print(ans+1)
#print(flag)
### BUGGY CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

fac = [1, 1]     # 元テーブル

def prepare(n, mod):
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)

def modcmb(n, r, mod):
    if n < 0 or r < 0:
        return 0
    if r > n:
        return 0

    return fac[n] * pow(fac[r], -1, MOD) * pow(fac[n-r], -1, MOD) % mod


def main():
    K = int(readline())
    S = readline().strip()
    N = len(S)

    prepare(N + K + 10, MOD)

    inv26 = pow(26, -1, MOD)
    exp = pow(26, K, MOD)
    ans = 0
    for i in range(K+1):
        tmp = exp * modcmb(N-1+i, i, MOD)
        tmp %= MOD
        ans += tmp
        ans %= MOD

        exp *= 25 * inv26
        exp %= MOD

    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

MOD = 10**9+7

fac = [1, 1]     # 元テーブル
f_inv = [1, 1]   # 逆元テーブル
inv = [0, 1]     # 逆元テーブル計算用テーブル

def prepare(n, mod):
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inv.append((-inv[mod % i] * (mod//i)) % mod)
        f_inv.append((f_inv[-1] * inv[-1]) % mod)

def modcmb(n, r, mod):
    if n < 0 or r < 0:
        return 0
    if r > n:
        return 0

    return fac[n] * f_inv[r] * f_inv[n-r] % mod


def main():
    K = int(readline())
    S = readline().strip()
    N = len(S)

    prepare(N + K + 10, MOD)

    ans = 0
    for i in range(K+1):
        ans += modcmb(N-1+i, i, MOD) * pow(25, i, MOD) * pow(26, K-i, MOD) % MOD
        ans %= MOD

    print(ans)


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

n = int(input())

A = [i for i in range(1, n+1)]
B = [i for i in range(2, n+1)]
B.append(1)

ans = 0
for a, b in zip(A, B):
    ans += a % b

print(ans)


### FIXED CODE ###

n = int(input())

if n % 2 == 0:
    print((n-1)*int(n/2))
else:
    print(n*int((n-1)/2))
### BUGGY CODE ###

n = int(input())

a = input().split()

for i in range(n):
    print(a.count(str(i+1)))

### FIXED CODE ###


n = int(input())

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

b = [0] * n

for i in range(n-1):
    b[a[i]-1] += 1

for i in range(n):
    print(b[i])
### BUGGY CODE ###

def solve():
  N, K = map(int, input().split())
  A = [int(i) for i in input().split()]
  F = [int(i) for i in input().split()]

  rest = sum(A) - K
  if rest <= 0: return 0

  _max = max(F)
  r = sum([_max // f for f in F])
  cost = _max // r

  while True:
    _sum = sum([cost // f for f in F])
    if _sum >= rest: return cost
    cost += 1

print(solve())


### FIXED CODE ###

import numpy as np

def solve():
  N, K = map(int,input().split())
  A = np.array(input().split(), np.int64)
  F = np.array(input().split(), np.int64)

  A.sort()
  F.sort()
  F=F[::-1]
  a_sum = A.sum()
  low, high = -1, 10**13

  while low + 1 < high:
      mid = (low + high) // 2
      if np.minimum(A, mid // F).sum() >= a_sum - K:
          high = mid
      else:
          low = mid
  return high

print(solve())
### BUGGY CODE ###

import sys
from collections import deque
H, W = map(int, input().split())
gridgraph = []
for line in sys.stdin.readlines():
    line = line.rstrip()
    gridgraph.append(list(line))

q = deque()
visited = [[False]*W for _ in range(H)]
ans = [[1e+9]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if gridgraph[i][j] == "#":
            q.append((i, j))
            visited[i][j] = True
            ans[i][j] = 0
# for a, b in q:
#     print(a, b)
# exit()
while len(q):
    cy, cx = q.popleft()
    # print(cy, cx)
    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        if not (cy+dy >= 0 and H-1 >= cy+dy and cx+dx >= 0 and W-1 >= cx+dx):
            continue
        if visited[cy+dy][cx+dx]:
            continue
        visited[cy+dy][cx+dx] = True
        ans[cy+dy][cx+dx] = min(ans[cy+dy][cx+dx], ans[cy][cx]+1)
        q.append((cy+dy, cx+dx))
    # print(ans)
    # exit()

min_value = 0
for a in ans:
    min_value = max(min_value, max(a))
print(min_value)


### FIXED CODE ###

import sys
from collections import deque
H, W = map(int, input().split())
gridgraph = []
for line in sys.stdin.readlines():
    line = line.rstrip()
    gridgraph.append(list(line))
q = deque()
visited = [[False]*W for _ in range(H)]
ans = [[1e+9]*W for _ in range(H)]
for i in range(H):
    for j in range(W):
        if gridgraph[i][j] == "#":
            q.append((i, j))
            visited[i][j] = True
            ans[i][j] = 0

while len(q):
    cy, cx = q.popleft()

    for dy, dx in ((1, 0), (0, 1), (-1, 0), (0, -1)):
        if not (cy+dy >= 0 and H-1 >= cy+dy and cx+dx >= 0 and W-1 >= cx+dx):
            continue
        if visited[cy+dy][cx+dx]:
            continue
        visited[cy+dy][cx+dx] = True
        ans[cy+dy][cx+dx] = min(ans[cy+dy][cx+dx], ans[cy][cx]+1)
        q.append((cy+dy, cx+dx))

min_value = 0
for a in ans:
    min_value = max(min_value, max(a))
print(min_value)
### BUGGY CODE ###

"""問題文
トキはモンスターと戦っています。
モンスターの体力は  H  です。
トキは  N  種類の魔法が使え、 i  番目の魔法を使うと、モンスターの体力を  A i  減らすことができますが、トキの魔力を  B i  消耗します。
同じ魔法は何度でも使うことができます。魔法以外の方法でモンスターの体力を減らすことはできません。
モンスターの体力を  0  以下にすればトキの勝ちです。  トキがモンスターに勝つまでに消耗する魔力の合計の最小値を求めてください。
"""
from functools import lru_cache
import sys


# @lru_cache(maxsize=1000)
# def attack(h, mp):
#     """
#     毎回Nパターン選択肢がある
#     最小値を返す
#     """
#     min_mp = 999999
#     for a, b in sorted_ab_list:
#         new_h = h - a
#         new_mp = mp + b
#
#         if new_mp >= min_mp:
#             # 既に最小値超えてたら中断
#             continue
#
#         if new_h > 0:
#             min_mp = min(min_mp, attack(new_h, new_mp))
#         else:
#             min_mp = min(min_mp, new_mp)
#
#     # 最小値をとる
#     return min_mp
#
#
# def attack2(h):
#     t_mp = 0
#     t_a = sorted_ab_list[0][0]
#     t_b = sorted_ab_list[0][1]
#     while h > 0:
#         h = h-a
#         t_mp += b
#
#     # やり直しが必要
#     if h < 0:
#         over_h = -h
#         mp = t_mp - t_b
#         # filter_list = [i for i in sorted_ab_list if i[0] > 1]
#     return mp


def use_dp():
    max_a = max([ab[0] for ab in AB])
    dp = [sys.maxsize for i in range(H+max_a)]
    dp[0] = 0

    # 各ダメージ段階の最小値を求める
    for i in range(H):
        if dp[i] == sys.maxsize:
            continue
        # 各魔法を使って最小値なら更新
        for j in range(N):
            a = i + AB[j][0]
            b = dp[i] + AB[j][1]
            if dp[a] > b:
                dp[a] = b

    # H < i < H+max(Ai)の範囲で最小値を求める
    min_mp = sys.maxsize
    for i in range(H, H+max_a):
        min_mp = min(dp[i], min_mp)

    print(min_mp)


if __name__ == '__main__':
    H, N = list(map(int, input().split()))
    AB = []
    for n in range(N):
        AB.append(list(map(int, input().split())))

    use_dp()

    # sorted_ab_list = sorted(AB_list, key=lambda x: x[0]/x[1], reverse=True)
    #
    # print(attack2(H))


### FIXED CODE ###

import sys

H, N = list(map(int, input().split()))
AB = [list(map(int, input().split())) for n in range(N)]

dp = [sys.maxsize for i in range(H+1)]
dp[0] = 0

# 各ダメージ段階の最小値を求める
for i in range(H):
    if dp[i] == sys.maxsize:
        continue
    # 各魔法を使って最小値なら更新
    for j in range(N):
        a = min(i + AB[j][0], H)
        b = dp[i] + AB[j][1]
        if dp[a] > b:
            dp[a] = b

print(dp[H])
### BUGGY CODE ###



from operator import mul
from functools import reduce

def nCr(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    # reduceは第一引数で与えた関数を第二引数のiterbleのそれぞれで実行した結果をもどす
    over = reduce(mul, range(n, n - r, -1), 1)
    under = reduce(mul, range(1,r + 1), 1)
    return over // under

N,K = map(int, input().split())
MOD = 10**9+7
A = list(map(int, input().split()))
A.sort()

if N == 1 or K == 1:
    print(0)
    exit()

# A_iがminに選ばれる回数と、maxに選ばれる回数それぞれをわけて考えて足していく
ans = 0
for i in range(N):
    # minになれるのは、iの右からK-1個選べる場合
    if N - (i+1) >= K-1:
        ans -= A[i] * nCr(N - (i+1), K-1) % MOD
    # maxになれるのは、iの左からK-1個選べる場合
    if i >= K-1:
        ans += A[i] * nCr(i, K-1) % MOD

    ans %= MOD

print(ans)

### FIXED CODE ###


N,K = map(int, input().split())
MOD = 10**9+7
A = list(map(int, input().split()))
A.sort()




if N == 1 or K == 1:
    print(0)
    exit()


def nCr(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    # nCr = n!  / (r! * (n-r)!)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = MOD
#N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    # (a * b * c) % MOD = (a * b % MOD) * c % MOD みたいなやつを利用して、大きな値にならないように一ステップごとにMODをとる
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

# A_iがminに選ばれる回数と、maxに選ばれる回数それぞれをわけて考えて足していく
ans = 0
for i in range(N):
    # minになれるのは、iの右からK-1個選べる場合
    if N - (i+1) >= K-1:
        ans -= A[i] * nCr(N - (i+1), K-1, MOD)
    # maxになれるのは、iの左からK-1個選べる場合
    if i >= K-1:
        ans += A[i] * nCr(i, K-1, MOD)

    ans %= MOD

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

S = str(input())
count = 0
T = ""
while S != T:
  S = S.replace("01","a").replace("10","a")
  T = S
  count += S.count("a") * 2
  S = S.replace("a","")
  
print(count)

### FIXED CODE ###

S = str(input())
count_0 = S.count("0")
count_1 = S.count("1")

print(min(count_0, count_1)*2)
### BUGGY CODE ###

from math import gcd

def get_loop(a, m):
  count = 1
  acc = a
  while acc % m != 1:
    count += 1
    acc *= a
  return count

while True:
  a1, m1, a2, m2, a3, m3 = map(int, input().split())
  if not a1:
    break
  loop_a = get_loop(a1, m1)
  loop_b = get_loop(a2, m2)
  loop_c = get_loop(a3, m3)
  loop_ab = loop_a * loop_b // gcd(loop_a, loop_b)
  loop_abc = loop_ab * loop_c // gcd(loop_ab, loop_c)
  print(loop_abc)


### FIXED CODE ###

from math import gcd

def get_loop(a, m):
  count = 1
  acc = a
  while acc != 1:
    count += 1
    acc *= a
    acc %= m
  return count

while True:
  a1, m1, a2, m2, a3, m3 = map(int, input().split())
  if not a1:
    break
  loop_a = get_loop(a1, m1)
  loop_b = get_loop(a2, m2)
  loop_c = get_loop(a3, m3)
  loop_ab = loop_a * loop_b // gcd(loop_a, loop_b)
  loop_abc = loop_ab * loop_c // gcd(loop_ab, loop_c)
  print(loop_abc)
### BUGGY CODE ###

s = str(input())
words = ["dreamer","eraser","dream","erase"]
t = ""
i = 0
while i<len(s):
    if i<=len(s)-7 and s[i:i+7] == words[0]:
        t = t+words[0]
        i += 7
    elif i<=len(s)-6 and s[i:i+6] == words[1]:
        t = t+words[1]
        i += 6
    elif i<=len(s)-5 and s[i:i+5] in words:
        t = t+words[2] if s[i:i+5] == words[2] else t+words[3]
        i += 5
    elif i>1 and s[i-2:i]=="er":
        if s[i:4]=="aser":
            t += "aser"
            i += 4
        elif s[i:3]=="ase":
            t += "ase"
            i += 3
    else:
        break
if s==t:
  print("YES")
else:
  print("NO")


### FIXED CODE ###

s = str(input())
words = ["dream","erase","eraser","dreamer"]
i = len(s)
while i>0:
    if s[-5:] in words:
        s = s[:-5]
        i -= 5
    elif s[-6:] in words:
        s = s[:-6]
        i -= 6
    elif s[-7:] in words:
        s = s[:-7]
        i -= 7
    else:
        break
if i==0:
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
flag=0
for i in range(N):
    for j in range(i+1,N):
        if(A[i]==A[j]):
            flag=1
            break
    if(flag==1):
        break

if(flag==1):
    print("NO")
if(flag==0):
    print("YES")

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
ans={}
flag=0

for i in A:
    if(ans.get(i)!=None):
        flag=1
        break
    else:
        ans[i]=1
        
if(flag==0):
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

i = int(input())
p = 1
for ii in range(1,i+1):
	p *= ii
ans = int(p % ((10 **9) +7))
print(ans)

### FIXED CODE ###

i = int(input())
p = 1
M = 10 **9+7 
for ii in range(1,i+1):
	ii %= M
	p *= ii
	p %= M
print(p)
### BUGGY CODE ###

from bisect import insort

S=input()
K=int(input())

T=[]
N=len(S)
for  i in range(N):
    V=""
    for j in range(i,N):
        V+=S[j]
        if V not in T:
            insort(T,S[i:j+1])
            T=T[:K]
print(T[-1])


### FIXED CODE ###

from bisect import insort

S=input()
K=int(input())

T=[]
N=len(S)
for  i in range(N):
    V=""
    for j in range(i,min(i+K,N)):
        V+=S[j]
        if V not in T:
            insort(T,S[i:j+1])
            T=T[:K]
print(T[-1])
### BUGGY CODE ###

s=input()
p=2019
ans=0
M=[0]*p
M[0]=1
tmp=0
for i in range(len(s)):
    tmp+=(int(s[-i-1])*pow(10,i,))
    tmp%=p
    ans+=M[tmp]
    M[tmp]+=1
print(ans)

### FIXED CODE ###

s=input()
p=2019
ans=0
M=[0]*p
M[0]=1
tmp=0
for i in range(len(s)):
    tmp+=(int(s[-i-1])*pow(10,i,p))
    tmp%=p
    ans+=M[tmp]
    M[tmp]+=1
print(ans)
### BUGGY CODE ###

n = int(input())

ans = 0
for c in range(1,n):
    for ab in range(1,int(1+(n-c+1)**(1/2))):
        if ((n-c)/(ab)).is_integer() and  ((n-c)/(ab))==(ab):
            ans+=1
        elif ((n-c)/(ab)).is_integer() and ((n-c)/(ab))!=(ab):
            ans+=2

print(ans)

### FIXED CODE ###

n = int(input())
ans = 0
for a in range(1, n):
  ans += (n - 1) // a
print(ans)
### BUGGY CODE ###

#D
from collections import deque
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ans = [0] * (n+1)
for i in range(m):
    ab.append([ab[i][1], ab[i][0]])
ab.sort(key=lambda x: x[0])
#BPS幅優先探索を行う -> 前の座標を記入
nque = deque([1])
while nque:
    now_cave = nque.popleft()
    for i in ab:
        next_cave = i[1]
        if i[0] == now_cave and ans[next_cave] == 0:
            ans[next_cave] = now_cave
            nque.append(next_cave)
print("Yes")
for i in range(2, n + 1):
    print(ans[i])


### FIXED CODE ###

#D
from collections import deque
n, m = map(int, input().split())
ans = [0] * (n+1)
g = [[] for _ in range(n + 1)]
for i in range(m):
    a, b = map(int, input().split())
    g[a].append(b)
    g[b].append(a)
#BPS幅優先探索を行う -> 前の座標を記入
nque = deque([1])
while nque:
    now_cave = nque.popleft()
    for next_cave in g[now_cave]:
        if ans[next_cave] == 0:
            ans[next_cave] = now_cave
            nque.append(next_cave)
#         print(nque)
# print(ans)
print("Yes")
for i in range(2, n + 1):
    print(ans[i])
### BUGGY CODE ###

def main():
	n = int(input())
	*t, = map(int, input().split())
	tot = sum(t)
	*v, = map(int, input().split())
	lim1 = []
	lim2 = [(1, 0, 0), (-1, tot, tot)]
	til = 0
	for t1, t2, v1 in zip([0] + t, t, v):
		lim1.append((til, til + t2, v1))
		lim2.append((-1, til, til + v1))
		lim2.append((1, til + t2, v1 - (til + t2)))
		til += t2

	def mi(time):
		ret = float("inf")
		for l, r, lim in lim1:
			if l <= time <= r:
				ret = min(ret, lim)
		for f, tt, y in lim2:
			if f == -1 and time <= tt:
				ret = min(ret, y - time)
			if f == 1 and time >= tt:
				ret = min(ret, time + y)
		return ret

	print(sum(mi(i / 2) for i in range(tot * 2 + 1)) / 2)

if __name__ == '__main__':
	main()

### FIXED CODE ###

def main():
	n = int(input())
	*t, = map(int, input().split())
	tot = sum(t)
	*v, = map(int, input().split())
	lim1 = []
	lim2 = [(1, 0, 0), (-1, tot, tot)]
	til = 0
	for t1, t2, v1 in zip([0] + t, t, v):
		lim1.append((til, til + t2, v1))
		lim2.append((-1, til, til + v1))
		lim2.append((1, til + t2, v1 - (til + t2)))
		til += t2

	def mi(time):
		ret = float("inf")
		for l, r, lim in lim1:
			if l <= time <= r:
				ret = min(ret, lim)
		for f, tt, y in lim2:
			if f == -1 and time <= tt:
				ret = min(ret, y - time)
			if f == 1 and time >= tt:
				ret = min(ret, time + y)
		return ret

	print(sum(mi(i / 2) for i in range(tot * 2 + 1)) / 2)

if __name__ == '__main__':
	main()