peterverebics/CodeNet_Python_118 huggingface dataset:
import numpy as np

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

matrix = list(range(0,N+1))
cum_sum = np.cumsum(matrix)
matrix.reverse()
rev_cum_sum = np.cumsum(matrix)

ans = [0]*(N+1)

for i in range(K-1,N+1):
  ans[i-1] = rev_cum_sum[i] - cum_sum[i] +1 

print(ans)
print(sum(ans))
import numpy as np


mod = 10 ** 9 + 7

n, k = map(int, input().split())
k_np = np.arange(k, n + 2, dtype=np.int64)
low = ((k - 1) * k) // 2
high = n * k_np - low
cnt = high - low + 1
print(cnt.sum() % mod)
n, k = map(int,input().split())
mod = 10**9+7
ans = 0

for i in range(k,n+1):
    num = (((n+1)*(n+2)-(n-i+1)*(n-i)-i*(i+1))//2)%mod
    ans = (ans+num)%mod

print(ans)
import itertools
n, k = map(int, input().split())
ans = 0
if n <= k :
    ans +=1
else:
    for i in range(k, n+1):
        j = list(itertools.combinations(range(n+1), i))
        ans += len(j)

print(ans)
N, K = map(int, input().split())

Z = 10**9 + 7
X = 0

# for i in range(K, N+1):
#     a = list(range(i))
#     b = list(range(N + 1 - i, N + 1))
#     X = X + (sum(b) - sum(a) + 1)

for i in range(K, N+1):
    a = (0 + (i - 1)) * i / 2
    b = (N + (N - i + 1)) * i / 2
    X = X + (b - a + 1)

print((X + 1)%Z)
N,K = map(int,input().split())
M = 10**9 + 7
T = pow(10,100,M)
ans = 0
for k in range(K, N+2):
    ans += (2*N-k+1)*k//2 - k*(k-1)//2 + 1
print(ans)
N, K = map(int, input().split())
cnt = []
minimum = sum([i for i in range(K-1)])
maximum = sum([i for i in range(N-(K-2), N+1)])

for n in range(K-1, N+1):
    minimum += n
    maximum += (N-n)
    diff = maximum - minimum +1
    cnt.append(diff)
print(sum(cnt))
n,k=map(int,input().split())
ans=0
for i in range(k,n+2):
    a=0
    b=0
    for j in range(i): a+=j
    for k in range(n,n-i,-1): b+=j
    ans+=b-a
print(ans)
N,K = map(int,input().split())
number = N+1-K+1
W = 0
for i in range(number):
    min = (K+i)*(K+i-1)/2
    max = (K+i)*(2*N-K-i+1)/2
    W += (max-min+1)
print(int(W))
n,k = map(int,input().split())
n += 1

s = n+1-k
sm = 0
for i in range(s+1):
  sm += ((i+1)*(s+1-i))%1000000007
print(sm)
n,k =map(int,input().split())
SUM = 0
a = 0
for i in range(n-k+2):
    for j in range(k+i):
        for k in range(j):
            a += k
        SUM +=n-j
    SUM -= a+1
print(SUM)
n,k=map(int,input().split())
ans=0
aaa=0
for i in range(k,n+2):
	miin=i*(i-1)/2
	maax=i*(2*n-i+1)/2
	aaa=maax-miin+1
	ans+=aaa
print(int(ans))
a,b=map(int,input().split())

print(2**(a+1) - 2**(a-b+2))
import math
nk = list(map(int,input().split()))
n, k = nk[0], nk[1]
def wa(a,b):
    return (b*(b+1)//2)-(a*(a-1)//2)
s = [0] * (n+1)
for i in range(n):
    s[i+1] = s[i] + n*(i+2) - 2*wa(0,i+1) + 1
if k == 1:
    ans = s[n] + 1
else:
    ans = s[n] - s[k-2]
while ans >= 10**9 + 7:
    ans -= (10**9 + 7)
print(ans)
import math

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

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

s = 0

for i in range(K,N+2):
    c = int(combinations_count(N+1,i))
    for j in range(0,N):
        if j != 0:
            c -= int(math.floor((j+1)/2)) - 1
            t = j - N
            if t >= 0:
                c += t
    s += c

print(s-1)
from itertools import permutations, combinations

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

ans = 0
_list = list(range(N+1))
_list.sort(reverse = True)
h = _list[0]
l = 0
cnt = 0

for i in range(1, N+1):
    h += _list[i]
    cnt += 1
    l += cnt
    if i >= K-1:
        ans += h - l + 1

    
print(ans%(10**9 + 7))
n, k = map(int, input().split())

sum = 0
for i in range(k, n+2):
    min_sum = i * (i-1) / 2
    max_sum = i * (2 * n - i + 1) / 2
    sum += max_sum - min_sum + 1
print(sum % (10**9 + 7))
N, K = map(int, input().split())
 
m = 10 ** 9 + 7
  
ans = 1
x = 1
for a in range(1,K+1):
  x *= (N + 2 - a) * a
  x //= a
  ans += x
  ans %= m
 
print(ans)
N, K = map(int, input().split())

mod = 10 ** 9 + 7
ans = 0

for i in range(K, N+2):
  ans += ((N + 1) * i - i ** 2 + 1) % mod
  
print(ans)
n, k = map(int, input().split())

mod = 10**9 + 7
n_list = [0]*(n+1)
for i in range(n+1):
    n_list[i] = (10**100 + i) % mod

s = [0]*(n+1)
s[0] = n_list[0]

for i in range(1, n+1):
    s[i] = (s[i-1] + n_list[i]) % mod

count = 0
for i in range(k, n+1):
    min_sum = s[i-1] % mod
    max_sum = (s[n] - s[n - (i-1)]) % mod
    m = (max_sum - min_sum) + 1 % mod
    count += m
count += 1  # k=n+1の分
print(count % mod)
n,k = map(int, input().split())
m = 1000000007
ans = []
for i in range(1,n+2):
    ans_min = (0+(i-1))*i*0.5
    ans_max = ((n+1-i)+n)*i*0.5
    ans.append(ans_max-ans_min+1)

ans_wa = [ans[0]]
for i in range(1,n+1):
    ans_wa.append(ans_wa[i-1]+ans[i])

if (k>=2):
    print(int((ans_wa[n]-ans_wa[k-2])%m))
else:
    print(int(ans_wa[n]))
def main():
  n, k = map(int, input().split(' '))
  A = list(range(n+1))
  A_rev = A[::-1]
  cumsum_A = [0]
  cumsum_A_rev = [0]
  for i in range(len(A)):
    cumsum_A.append(A[i]+cumsum_A[i])
    cumsum_A_rev.append(A_rev[i]+cumsum_A_rev[i])
  ans = 0
  
  for i in range(k, n+2):
    tmp_min = cumsum_A[i]
    tmp_max = cumsum_A_rev[i]
    ans += tmp_max - tmp_min + 1
  print(ans)
    

if __name__ == '__main__':
  main()
n, k = map(int,input().split())
if k == n + k:
    print(1)
else:
    mi_n = ((k-1)*k)//2#０からKこ選んだ和。k個選ぶ時の最小。0~k-1。
    ma_x = ((n+n-k+1)*k)//2#NからKこ選んだ和。ｋ個選んだ時の最大。n~n-k+1。
    ans = ma_x - mi_n + 1
    for i in range(k,n,1):
        mi_n += i
        ma_x += n - i
        ans += ma_x - mi_n + 1

    ans += 1

    print(ans%(10**9 + 7))
#!/usr/bin/env python3
# -*- coding: utf-8 -*-*-

from sys import stdin
import itertools


def main():
    N, K = map(int, stdin.readline().split())
    a = list(range(0, N + 1))
    pattern = []
    for i in range(K, N + 1):
        pattern.extend(list(itertools.combinations(a, i)))
    b = []
    for p in pattern:
        val = (10 ^ 100) * len(p) + sum(p)
        b.append(val % (10 ^ 9 + 7))

    set(b)
    print(len(b))


if __name__ == "__main__":
    main()
N, K = map(int, input().split())

A = []
for i in range(0, N+1):
    A.append(i)

ans = 0
saisyo = sum(A[:K-1])
saidai = sum(A[-(K-1):])
for i in range(K, N+2):
    saisyo += A[i-1]
    saidai += A[-i]
    ans += saidai - saisyo + 1
    
print(ans%(10**9+7))
a = list(map(int,input().split()))
ans=0


min=0
max=0
for i in range(a[1]):
    min +=i
    max +=a[0]-i
    
    minx=i-1
    maxx=a[0]-i-1
    ans=max-min+1
for i in range(a[1]+1,a[0]+2):
    minx+=1
    min += minx
    maxx -=1
    max +=maxx
    if min<=max:
        ans=ans+max-min+1
print(ans)
N,K=map(int,input().split())
ans=0
kari=[i for i in range(N+1)]
for i in range(K,N+2):
    saidai=(N+N-i+1)*i//2
    saisyou=(i-1)*i//2
    ans+=saidai-saisyou+1

ans%=10**+7
print(ans)
n, k = map(int, input().split())
cnt = 0
MOD = 1000000007
for i in range(k, n+2):
    left = i*(i-1)//2
    right = i*(2*n-i+1)//2
    add = right - left + 1
    cnt += add%MOD
print(cnt)
n,k = map(int,input().split())
mod = 10**9+7
answer = 0

for i in range(k,n+2):
  max_value = sum(range(n-i,n))
  lowest_value = sum(range(0,i))
  answer = answer + max_value - lowest_value + 1

print(answer % mod)
from math import factorial

n,k = map(int,input().split())
s = 0
mod = 10**9+7

for i in range (k,n+1):
    c1 = factorial(n+1) % mod
    c2 = 1 / factorial(i)
    c3 = 1 / factorial(n+1 - i)
    c = c1 * c2 * c3
    d = n+1 - (i + 1)
    s = s + (c-d) % mod

s = int((s+1) % mod)

print (s)
N, K = map(int, input().split())
N += 1

res = 1
s = [i for i in range(N)]

minimum, maximum = 0, 0
if K != 1:
    minimum = sum(s[:K - 1])
    maximum = sum(s[-K + 1:])

for i in range(K, N):
    minimum += s[i]
    maximum += s[-i + 1]
    res = (res + (maximum - minimum + 1)) % (10 ** 9 + 7)

print(res)
def touSum(a,l):
    return int(((l-a+1)*(a+l))/2)

N,K = map(int,input().split())
maxSum = touSum(1,N)
print(maxSum)
con = 0
for i in range(K,N+1+1):
    #print(str(i)+":"+str(touSum(1,i-1))+":"+str(touSum((1+N)-i,N)))
    if touSum(1,i-1)>maxSum:
        print(con)
        break
    else:
        con += touSum((1+N)-i,N) -touSum(1,i-1)+1
print(con%(10**9+7))
n, k = map(int, input().split())
ans = 0

for i in range(k, n+2):
  l = (i*(i-1))*0.5
  h = (i*(2*n-i+1))*0.5
  ans += (h-l+1)

print(int(ans))
N, K = map(int, input().split())

ans = 0


for i in range(K, N+2):
    mi = ((i-1)*i)//2
    ma = N*i-mi
    ans += ma-mi+1
    # print(mi, ma)

print(ans)
def factorial( n) : 
    M = 1000000007
    f = 1
  
    for i in range(1, n + 1):  
        f = f * i  # WRONG APPROACH as  
                  # f may exceed (2^64 - 1)  
  
    return f % M
import numpy
N, K  = map(int, input().split(' '))
right = 0
s = 0
for i in range(K, N+2):
    mi = (i-1)*i/2
    ma = (2*N-i+1)*i/2
    s += (ma - mi) + 1
print(int(s%(1e7+7)))
N, K = map(int, input().split())
x = 100000007
 
A = N * (N * (N + 1) - K * (K - 1)) // 2
B = (N * (N + 1) * (2 * N + 1) - K * (K - 1) * (2 * K - 1)) // 6
C = N - K + 1

Ans = (A - B + C) % x
 
print(Ans)
n, k = [int(i) for i in input().split()]
mod = 10**9 + 7
ans = 0

for i in range(k, n + 2):
    first = i * (i - 1) / 2
    final = (n * 2 - i + 1) * i / 2
    add = final - first + 1
    ans = (ans + add) % mod

print(ans)
n, k = map(int, input().split())

a = 0

for i in range(k, n+2):
    a += n*k + k - k**2 + 1

ans = a % (10**9+7)
print(ans)
# -*- coding: utf-8 -*-

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

def check(n,k):
    sum_min = (k-1)*k/2
    sum_max = n*(n+1)/2 - (n-k)*(n-k+1)/2
    
    sum_pattern = sum_max - sum_min + 1
    return sum_pattern


cnt = 0
for i in range(K,N+1):
    c = check(N,i)
    cnt = (cnt + c) % (10**9+7)
    
print(cnt+1)
n, k = map(int, input().split())

ans = 0
for i in range(k, n+1):
    ans += i * (n - i + 1) + 1
    ans %= 1000000007

print(ans)
import sys
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)

MOD = 10 ** 9 + 7

N, K = map(int, readline().split())
N = N + 1

lower = None
upper = None
answer = 0
for k in range(K, N+1):
    if lower is None:
        lower = sum(range(k))
        upper = sum(range(N-k, N))
    else:
        lower += k - 1
        upper += N - k
    answer += (upper - lower + 1) % MOD
print(answer)
import math
a,b=map(int,(input().split()))

if(b>a):print(1)
else:
    A=a+1     
    def nck(n,k):
        if(k==n):return 1
        elif(k==0):return 1
        else:
            return math.factorial(n)//( math.factorial(k)*math.factorial(n-k) )
    
    sum=0    
    k=0   
    for i in range(b,A):
        sum = sum+ nck(A,b+k)               
        k+=1        
    print(sum)
n,k = map(int,input().split())
mod = 10**9+7
answer = 0

for i in range(k,n+1):
  max_value = sum(range(n-i+1,n+1))
  lowest_value = sum(range(0,i))
  answer = answer + max_value - lowest_value + 1

print(answer % mod)
INF = 10 ** 9 + 7
N, K = map(int, input().split())

l = []
ans = 0

for i in range(N+1):
  l.append(i)

mx = l[N]
mn = 0
for i in range(K, N+2):
  s = 0
  mx += l[N-i+1]
  mn += l[i-1]
  ans += (mx - mn + 1) % INF

print(ans % INF)
a, b = map(int, input().split())
mod = pow(10,9) + 7

def cal(a,i):
  min = i*(i-1)/2
  max = a*(a+1)/2 - (a-i)*(a-i+1)/2
  return max - min + 1

count = 0
for i in range(a-b+2):
  if(a < i+b):
  	count += cal(a,i+b)
  else:
    count += 1
print(count % mod)
print(1)
N, K  = map(int, input().split())


print(N)
print(K)
n,k=map(int,input().split())
ans=0
x=list(range(n+1))
for i in range(k,n+1):
  A=sum(x[n-i+1:n+1])
  B=sum(x[0:i])
  ans+=A-B+1
print(ans)
a = list(map(int, input().split()))
n = a[0]
k = a[1]
Sum = 0

for i in range(n-k+2):
  Sum += int((2*n-k-i+1)*(k+i)/2-(k+i-1)*(k+i)/2+1)
print(Sum)
N, K = map(int, input().split())
N += 1

res = 1
s = [i for i in range(N)]

minimum = sum(s[:K-1])
maximum = sum(s[-K+1:])
for i in range(K, N):
    minimum += s[i]
    maximum += s[-i+1]
    res = (res + (maximum - minimum + 1)) % (10**9 + 7)

print(res)
import itertools
 
n, m = list(map(int, input().split(" ")))
l = [ i for i in range(n + 1) ]
 
ans = 0
for i in range(m, n + 2):
    ans = ans + len(list(itertools.combinations(l, i)))
print(ans)
n, k = map(int,input().split())
A = list(range(n+1))
ans = 0
for i in range(k,n+1):
  ans += sum(A[-k:]) - (k-1)*k//2
print(ans)
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]

n,k=n1()

down=[0]*(n+1)
up=[0]*(n+1)
up[0]=n
ans=0
for i in range(1,n+1):
    down[i]=down[i-1]+i
    up[i]=up[i-1]+(n-i)
    if i>=k-1:
        ans+=up[i]-down[i]+1
print(ans%(10**9+7))
N, K = map(int, input().split())

MAX = (N+1)*(N+2)//2
MIN = (K-1)*(K)//2

print((MAX-MIN)/10**9+7)
n,k = map(int,input().split())
ans=[]
small=range(k)
big=[n-i for i in range(k)]
s=sum(small)
b=sum(big)
while s!=b:
  ans.append((b-s+1)%((10**9)+7))
  s+=(small[-1]+1)
  b-=(big[-1]-1)
print(ans)
n,k=map(int,input().split())
count=0
for i in range(n+1):
    if i<k:
        continue
    elif i>=k-1:
        mini=k*(k-1)//2
        a=n*(n+1)//2
        b=(n-k)*(n-k+1)//2
        maxi=a-b
        total=maxi-mini+1
        count+=total
print(count)
n, k = [int(i) for i in input().split()]

m, M, L = 0, 0, 0
for i in range(k,n+2):
    m = i *(i-1)//2
    M = (2*n-i+1)*i//2
    L = L+(M - m+1)
print(L)
N,K = map(int,input().split())
a =0
for i in range(K,N+2):
    a = a + ((N+N-i+1)*i/2-(i-1)*(i)/2+1)
print(a)
n,k=map(int,input().split())
L=list(range(n+1))

cnt=0
ans=0

def calc(i):
    smallest=(i-1)*i//2
    largest=(2*n-i+1)*i//2
    return largest-smallest+1


for i in range(k,n+2):
    print(i,calc(i))
    cnt+=calc(i)
    

print(cnt)
n,k=map(int,input().split())
sum=0
M=1000000007
print(((2*n-k+1)*k)/2,(k*(k-1))/2)
for i in range(k,n+2):
    sum=(2*n-i+1)*i/2-(i*(i-1))/2+1+sum
    sum=sum%M
print(int(sum)%M)
n,k = map(int,input().split())

mod = 10**9 + 7

ans = 0
for i in range(k,n+2):
  min = i*(i-1)//2
  max = (n+1)*n//2 - (n+1-i)*(n-i)//2
  ans += (max - min + 1)%mod
  print(ans%mod)
mod=1000000007
import math
def f(n,k):
    return math.factorial(n)//(math.factorial(n-k)*math.factorial(k))

def sigma(func, frm, to):
    result = 0; #答えの受け皿
    for i in range(frm, to+1):
        result = (result+func(i,frm))%mod
        #ここで関数を呼び出す。ちなみにここではi = x
    print(result)

n,k=list(map(int,input().split()))
n=n+1
sigma(f,k,n)
M, K = map(int, input().split()) 

sum = 0

for j in range(K,M+2):
    temp = j*(M-j+1) + 1
    if temp > (10^9 + 7):
        temp = temp%(10^9 + 7)
    sum += temp


print(sum)
N, K = map(int, input().split())
MOD = 10**9 + 7
nac = [0] * (N + 1)
ninv = [0] * (N + 1)
inv = [0] * (N + 1)
nac[0],nac[1] = 1,1
inv[0] = 1
ninv[0],ninv[1] = 1,1

for i in range(2, N + 1):
    nac.append(nac[i-1] * i % MOD)
    inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD
    ninv[i] = ninv[i - 1] * inv[i] % MOD

ret = 0
for i in range(K,N+1):
    ret += nac[N] * (ninv[i] * ninv[N-i] % MOD) % MOD
print(ret)
N,K=map(int,input().split())
def wa(N,K):
    return (N+1)*K-K**2
d=0
for i in range(K,N+1):
  d=d+wa(N,i)
print((d+1)%(10**9+7))
def resolve():
    '''
    code here
    '''
    N, K = [int(item) for item in input().split()]

    res = 0
    if K <= N:
        for i in range(K, N+1):
            a = (i-1)*i//2
            c = N-i
            b = N*(N+1)//2 - c*(c+1)//2
            print(a, b)
            res += b - a +1
    res += 1
    print(res)

if __name__ == "__main__":
    resolve()
n,k=map(int,input().split())
ans=((2+n-k)*(6+n+n**2+2*k+k*n-k**2*2))//6
print(ans)
N, K = map(int, input().split())
ans = 0
for i in range(K, N+2):
    ans += i * (N-i+1) + 1
print(ans%(10**7+7))
N,K = list(map(int,input().split()))
mod = 10**9+7


lst = [0]*(N+2)
mi = [0]*(N+2)
ma = [0]*(N+2)
ma[1] = N
for i in range(2,N+2):
    mi[i] = mi[i-1]+i-1
    ma[i] = ma[i-1]+N+1-i
    lst[i] = (ma[i]-mi[i]+1)

print(sum(lst[K::])%mod)
N,K=map(int,input().split())
num_list=[x for x in range(3+1)]
answer=0
count=N-K+2
for y in range(K,N+2):
    min=sum(num_list[:y])
    max=sum(num_list[-y:])
    answer+=max-min+1

print(answer)
N, K = map(int, input().split())

count = 0
for n in range(K, N+2):
  maxSum = (n*(N + N-n+1))//2
  minSum = (n*(n-1))//2
  count += maxSum - minSum + 1

print(count)
N,K=map(int,input().split())
#N+1この数が与えられ、ここからk個を選んだ合計値の整数種類
#異なる個数を選べば、それが一致することはない
#N+1個の整数0ーNから、k個(k=KーN+１)選ぶ場合の数
ans=0
for k in range(K,N+2):
  first = k * (k-1) / 2
  final = (N*2-k+1) * k / 2
  ans += final - first + 1
print(int(ans))
N, K = map(int, input().split())

A = []
for i in range(0, N+1):
    A.append(i)

ans = 0
saisyo = sum(A[:K-1])
saidai = sum(A[-(K-1):])
for i in range(K, N+2):
    saisyo += A[i-1]
    saidai += A[-i]
    ans += (saidai - saisyo + 1)
    
print(ans%(10**9+7))
n,k = map(int,input().split())
mod = 10**9+7
answer = 0

for i in range(k,n+2):
  max_value = sum(range(n-i,n+1))
  lowest_value = sum(range(0,i+1))
  answer = answer + max_value - lowest_value + 1

print(answer % mod)
n, k = map(int, input().split())
lis = [n+1]
l = n+1
mod = 10**9+7
for i in range(2, n+2):
    new_l = (l + n -2*i + 2) %mod
    lis.append(new_l)
    l = new_l
s = 0
for i in lis:
    s += i
    s %= mod
s_2 = 0
for i in range(k-1):
    s_2 += lis[i]
    s_2 %= mod
print(s- s_2)
n, k = map(int, input().split())
MOD = 1e9+7

def s(i,n):
    s1 = (2 * i * i)
    s2 = (3 * n * (i+1)) 
    s3 = 8

    d = (s2 + s3 - s1)

    ans = ( int((i * d)/6 + 0.5) ) % MOD
    
    return ans

ans = int(s(n+1,n) - s(k-1,n))
if ans < 0:
    ans += MOD

print(ans)
N,K=map(int,input().split())
N = N+1
a = N - K
ans = 0

MM = 10**9 +7

for i in range(K,K+a):
  start = int( ( (K)*(K-1)/2 ) % MM )
  fin = int( ( (K)*(N+N-K)/2 ) % MM )
  ans = int( ( ans + (fin - start) ) % MM )
  
if N == K:
  ans = 1
print(ans)
n, k  = map(int, input().split())
x = 0
for j in range(k, n+2):
  a =j * (j-1)//2
  b = j * (2*n+1-j)//2

  x += b- a +1
  
  
y = 10^9+7
print(x%y)
import math
N, K = map(int, input().split())

total = 1
for k in range(N+2-K):
   for j  in range(k):
      total += N - j

K_list = range(-1, K-1)
K_sum = sum(K_list)

print(total - K_sum)
n,k=map(int,input().split())

def num_sum(i):
  return ((n+(n-i+1))*i//2)-((i-1)*i//2)+1

ans=0
for i in range(k,n+2):
  ans+=num_sum(i)
print(ans)
import math
nk = list(map(int,input().split()))
n, k = nk[0], nk[1]
def wa(a,b):
    return (b*(b+1)//2)-(a*(a-1)//2)
s = [0] * (n+1)
s[0] = 0
for i in range(n):
    s[i+1] = s[i] + n*(i+2) - 2*wa(0,i+1) + 1
ans = s[n] - s[k-2]
while ans >= 10**9 + 7:
    ans -= 10**9 + 7
print(ans)
n, k = map(int, input().split())

MOD = 1e9+7

def a(m):
    s0 = 1
    s1 = m * (n+1)
    s2 = m * m
    
    return (s1 - s2 + s0) % MOD

s = [0] * (n+2)
for i in range(1,n+2):
    #print(i,a(i))
    s[i] = (s[i-1] + a(i)) % MOD

print(int(s[n+1] - s[k-1]))
N,K = map(int,input().split())

ans = 0
for i in range(K,N+2):
  mi = (i-1)*((i-1)+1)/2
  ma = N*i-(i-1)*((i-1)+1)/2
  ans += ma - mi + 1
  print(i, mi, ma)

print(int(ans))
n,k = (int(x) for x in input().split())
M = 10**9+7
s = 0

for i in range(n+2-k):
    ad = 1 + (n+1-k-i)*(k+i)
    s += ad
    if s >= M:
        s -= M
        
print(s)
import itertools
x =(input()).split(" ")
N = int(x[0])+1
K = int(x[1])
l = []
p =0
for i in range(N):
	l.append(p)
	p+=1
p = 0
while K<=N:
	c_list = list(itertools.combinations(l, K))
	print(c_list)
	K+=1
	p+=len(c_list)
print(p)
# D - Sum of Large Numbers
from itertools import accumulate


def main():
    N, K = map(int, input().split())
    MOD = 10 ** 9 + 7
    cumsum_left = tuple(accumulate(range(N + 1)))
    cumsum_right = tuple(accumulate(reversed(range(N + 1))))
    total = sum(r - 1 + 1 for l, r in zip(cumsum_left[K - 1 :], cumsum_right[K - 1 :]))
    total %= MOD
    print(total)


if __name__ == "__main__":
    main()
a, b = map(int, input().split())
mod = pow(10,9) + 7

def cal(a,i):
  min = i*(i-1)/2
  max = a*(a-1)/2 - (a-i)*(a-i+1)/2
  return max - min + 1

count = 0
for i in range(a-b+2):
  if(a < i+b):
  	count += cal(a+1,i+b)
  else:
    count += 1
print(count % mod)
n, k = map(int, input().split())
a = [i for i in range(n+1)]
mod = 10**9+7
ans = 0
for i in range(k, n+1):
  L = i * (i - 1) / 2
  R = n * i - i * (i - 1) / 2
  ans += R - L + 1
print(ans)
n,k= list(map(int, input().split()))
mod=10**9+7
ans=0
for i in range(k,n+2):
    min=(i-1)*i//2
    max=((n+1)+(n-i+1))*i//2
    ans+=max-min+1
print(ans % mod)
N, K = map(int, input().split())
x = 100000007
 
A = (N - 1) * N * (N + 1) // 2
B = N * (N + 1) * (2 * N + 1) // 6
C = N * K * (K + 1) // 2
D = (K - 1) * K * (K + 1) // 3
E = N - K + 1 
Ans = (A - B - C + D + E) % x
 
print(Ans)
import sys
input = sys.stdin.readline


def log(v):
    print(v, file=sys.stderr)


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

mod = 10**9 + 7
log(mod)
ans = 0
for i in range(K, N + 2):
    max = (N - i + 1 + N) * i / 2
    min = (i - 1) * i / 2
    ans += max - min + 1
    ans %= mod
print(ans)
N = input()

if '7' in N:
    print('Yes')
else:
    print('No')
n = str(input().split())

ans = 0
for i in range(len(n)):
    if n[i] == "7":
        ans = 1
        
if ans == 1:
    print("Yes")
else:
    print("No")
val= list(input())
flag=0
for i in range(0,len(val)):
    if val[i]=="7":
        flag=1
if flag == 1:
    print("Yes")
else:
    print("No")
N = int(input().count('7'))
print("No" if N == 0 else "Yes")
#A
h =list(input() )
z = False
for x in h:
    if x =="7":
        z =True
        break
if z ==True:
    print("Yes")
else:
    print("No")
n = input()
if "7" in n:
    print("Yes")
else:
    print("No")
if input().count('7')>0:
  print('Yes')
else:
  print('No')
N=input()
if '7' in N:
  print('Yes')
else:
  print('No')
n = int(input())

for i in range(3):
	if "7" in str(n):
		print("Yes")
		break
	else:
		print("No")
		break
N = input()
if '7' in N:
    print('Yes')
else:
    print('No')
n = input()
if '7' in n:
    print("Yes")
else :
    print("No")
N = int(input())
N = str(N)
if "7" in N:
    print("Yes")
else:
    print("No")
n=input()
a=n.count("7")
if a==0:
    print("No")
else:
    print("Yes")
# -*- coding: utf-8 -*-

input_line = input()
N = list(input_line)

for i in N:
    if i=='7':
        print('Yes')
        quit()
print('No')
a,b,c=input()
if a=='7' or b=='7' or c=='7':
    print('Yes')
else:
    print('No')
n = input()

for i in n:
    if i=="7":
        print("Yes")
        exit()
print("No")
# coding: utf-8
# Your code here!

n = input()

ans = "No"
for i in n:
    if i == "7":
        ans = "Yes"
        
print(ans)
n=input()
if "7" in n:
    print("Yes")
else:
    print("No")
n = input()

if '7' in n:
  print("Yes")
else:
  print("No")
A = input()
Alist = list(A)
j=0
for i in range(3):
    if Alist[i] == '7':
        j+=1
if j>=1:
    print('Yes')
else:
    print('No')
N = str(input())

for x in N:
    if x == "7":
        print("Yes")
        exit()

print("No")
S = input()
s = set(S)
if "7" in s:
    print("Yes")
else:
    print("No")
N = str(input())

if '7' in N:
  print('Yes')
else:
  print('No')
n = input()
if '7' in n:
    print('Yes')
else:
    print('No')
N = input()
a = list(N)
for i in range(len(a)):
    a[i] = int(a[i])
p = 1
for i in range(len(a)):
    if a[i] == 7:
        p = p*0
if p == 0:
    print('Yes')
else:
    print('No')
N=input()

if '7' in N:
    print('Yes')
else:
    print('No')
s=input()
if('7' in s):
    print("Yes")
else:
    print("No")
def main():
  n = input()
  
  if n[0] == '7' or n[1] == '7' or n[2] == '7':
      print('Yes')
  else:
      print('No')
main()
N = list(input())
flag = False

for i in range(3):
    if N[i] == '7':
        flag = True

if flag:
    print('Yes')
else:
    print('No')
N=int(input())

a=N//100
b=(N%100)//10
c=(N%100)%10

if a==7 or b==7 or c==7:
  print('Yes')
else:
  print('No')
# 2つの入力を空白で分割し、数値化
s = input()

for c in s:
    if c == "7":
        print("Yes")
        exit(0)
    else:
        pass

print("No")
N = input()
flag=0
for i in N:
    if i=="7":
        flag=1

if flag == 1:
    print("Yes")
else:
    print("No")
N = input()
for n in N:
    if n == '7':
        print('Yes')
        exit(0)
print('No')
#!/usr/bin/env python3
import sys, math, itertools, collections, bisect
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
inf = float('inf') ;mod = 10**9+7
mans = inf ;ans = 0 ;count = 0 ;pro = 1

n = input()
for ni in n:
  if ni == "7":
    print("Yes")
    exit()
print("No")