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

import re
  
bit_string = raw_input()

replaced_count = 0
replaced_string = bit_string
while re.search('01|10', replaced_string):
  replaced_string, tmp_count = re.subn('01|10', '', replaced_string)
  replaced_count += tmp_count
print(replaced_count * 2)

### FIXED CODE ###

bit_string = raw_input()
  
count_zero = bit_string.count('0')
count_one  = bit_string.count('1')
print((min(count_zero, count_one) * 2))
### BUGGY CODE ###

N, K = [int(i) for i in input().split()]
H = [int(i) for i in input().split()]
dp = [float('inf')] * N
dp[0] = 0

for i in range(1, N):
  dp[i] = min(dp[j] + abs(H[i] - H[j]) for j in range(max(i - K, 0), i))

print(dp[N - 1])


### FIXED CODE ###

n, k = [int(i) for i in input().split()]
h = [int(i) for i in input().split()]

def frog(n, k, h):
    d = [float('inf')] * n
    d[0] = 0

    for i in range(1, n):
        d[i] = min(
            d[j] + abs(h[i] - h[j]) for j in range(max(i - k, 0), i)
        )
    return d[n - 1]


print(frog(n, k, h))
### BUGGY CODE ###

import math
import copy

def secize(n, k):
    n2=bin(n)
    n3=n2[2:]
    for i in range(k-len(n2)+2):
        n3='0'+n3
    return n3


n=int(input())
alist = list(map(int,input().split()))
saidai=max(alist)
keta=math.ceil(math.log(saidai+1, 2))
blist=[]
for i in range(n):
    kaz=secize(alist[i], keta)
    blist.append(kaz)

now1=0
now2=0
nowarr=[]
for bl in blist[0]:
    nowarr.append(int(bl))
#nowarr=[0]*keta
answer=0
swit=0
"""
for bl in blist:
    print(bl)
"""
while now1<=n-2 and now2<=n-2:
    #print(now1, now2, nowarr, answer)
    maearr=copy.deepcopy(nowarr)
    for i in range(keta):
        if blist[now2+1][i]=='1':
            if nowarr[i]==1:
                swit=1
            else:
                nowarr[i]=1
    if swit==1:
        answer+=(now2-now1+1)
        nowarr=maearr
        for i in range(keta):
            if blist[now1][i]=='1':
                nowarr[i]=0
        if now1==now2:
            nowarr=[]
            for bl in blist[now1+1]:
                nowarr.append(int(bl))
            now1+=1
            now2+=1
            if now1==n-1:
                answer+=1
        else:
            now1+=1
        swit=0
    else:
        if now2!=n-2:
            now2+=1
        else:
            wa=now2-now1+2
            answer+=(wa*(wa+1)//2)
            now2+=1

#print(now1, now2)
if n!=1:
    print(answer)
else:
    print(1)

### FIXED CODE ###

import math
import copy

def secize(n, k):
    n2=bin(n)
    n3=n2[2:]
    for i in range(k-len(n2)+2):
        n3='0'+n3
    return n3


n=int(input())
alist = list(map(int,input().split()))
saidai=max(alist)
keta=math.ceil(math.log(saidai+1, 2))
blist=[]
for i in range(n):
    kaz=secize(alist[i], keta)
    blist.append(kaz)

now1=0
now2=0
nowarr=[]
for bl in blist[0]:
    nowarr.append(int(bl))
answer=0
swit=0
while now1<=n-2 and now2<=n-2:
    """
    maearr=copy.deepcopy(nowarr)
    for i in range(keta):
        if blist[now2+1][i]=='1':
            if nowarr[i]==1:
                swit=1
            else:
                nowarr[i]=1
    """
    for i in range(keta):
        if blist[now2+1][i]=='1':
            if nowarr[i]==1:
                swit=1
            else:
                nowarr[i]=2
    if swit==1:
        for i in range(keta):
            if nowarr[i]==2:
                nowarr[i]=0
        answer+=(now2-now1+1)
        #nowarr=maearr
        for i in range(keta):
            if blist[now1][i]=='1':
                nowarr[i]=0
        if now1==now2:
            nowarr=[]
            for bl in blist[now1+1]:
                nowarr.append(int(bl))
            now1+=1
            now2+=1
            if now1==n-1:
                answer+=1
        else:
            now1+=1
        swit=0
    else:
        for i in range(keta):
            if nowarr[i]==2:
                nowarr[i]=1
        if now2!=n-2:
            now2+=1
        else:
            wa=now2-now1+2
            answer+=(wa*(wa+1)//2)
            now2+=1

#print(now1, now2)
if n!=1:
    print(answer)
else:
    print(1)
### BUGGY CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

from functools import lru_cache

N,M = II()
A = III()
num = [0]*10
num[1],num[2],num[3],num[4],num[5] = 2,5,5,4,5
num[6],num[7],num[8],num[9] = 6,3,7,6

@lru_cache(maxsize=10**5)
def rec(n):
    val = []
    for i in range(M):
        if n-num[A[i]] < 0:
            continue
        elif n-num[A[i]] == 0:
            val.append(A[i])
        else:
            if rec(n-num[A[i]])>0:
                val.append(int(str(A[i]) + str(rec(n-num[A[i]]))))
    if val:
        return max(val)
    else:
        return -1

print(rec(N))

### FIXED CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N):
    read_all = [tuple(map(int, input().split())) for _ in range(N)]
    return map(list,zip(*read_all))

#################

from functools import lru_cache

N,M = II()
A = III()
num = [0]*10
num[1],num[2],num[3],num[4],num[5] = 2,5,5,4,5
num[6],num[7],num[8],num[9] = 6,3,7,6

@lru_cache(maxsize=10**5)
def rec(n):
    val = []
    for i in range(M):
        if n-num[A[i]] < 0:
            continue
        elif n-num[A[i]] == 0:
            val.append(A[i])
        else:
            if rec(n-num[A[i]])>0:
                val.append(10*rec(n-num[A[i]])+A[i])
    if val:
        return max(val)
    else:
        return -1

print(rec(N))
### BUGGY CODE ###

from collections import defaultdict

S=raw_input()
l=len(S)

mod=10**9+7

dp=defaultdict(lambda: 0)   #dp[ (i,j) ]	i: i-mojime,  j=0:None , 1:A, 2:AB, 3:ABC
dp[(0,0)]=1

n=1
for i, s in enumerate(S):
	if s in "ABC":
		dp[ (i+1,0) ]=n
	elif s=="?":
		n*=3
		dp[ (i+1,0) ]=n		

nashi=0
a=1
ab=2
abc=3

n=0
cnt=0	# count of "?"
for i,s in enumerate(S):
	if s =="A":
		dp[ (i+1,a) ]+=dp[ (i,nashi) ]
		dp[ (i+1,a) ]+=dp[ (i,a) ]
		dp[ (i+1,ab) ]+=dp[ (i,ab) ]
		dp[ (i+1,abc) ]+=dp[ (i,abc) ]
	elif s=="B":
		dp[ (i+1,ab) ]+=dp[ (i,ab) ]
		dp[ (i+1,ab) ]+=dp[ (i,a) ]
		dp[ (i+1,a) ]+=dp[ (i,a) ]
		dp[ (i+1,abc) ]+=dp[ (i,abc) ]
	elif s=="C":
		dp[ (i+1,abc) ]+=dp[ (i,abc) ]
		dp[ (i+1,abc) ]+=dp[ (i,ab) ]
		dp[ (i+1,a) ]+=dp[ (i,a) ]
		dp[ (i+1,ab) ]+=dp[ (i,ab) ]
	elif s=="?":
		dp[ (i+1,a) ]+=dp[ (i,a) ]*3
		dp[ (i+1,a) ]+=dp[ (i,nashi) ]
		dp[ (i+1,a) ]%=mod

		dp[ (i+1,ab) ]+=dp[ (i,ab) ]*3
		dp[ (i+1,ab) ]+=dp[ (i,a) ]	
		dp[ (i+1,ab) ]%=mod

		dp[ (i+1,abc) ]+=dp[ (i,abc) ]*3
		dp[ (i+1,abc) ]+=dp[ (i,ab) ]
		dp[ (i+1,abc) ]%=mod


print dp[(l,3)]%mod


### FIXED CODE ###

S=raw_input()

M=10**9+7

all=1
abc=0
ab=0
a=0

for x in S:
	if x=="A":
		a+=all
	if x=="B":
		ab+=a
	if x=="C":
		abc+=ab

	if x=="?":
		abc=abc*3+ab
		ab=ab*3+a
		a= a*3+all
		all*=3

	abc%=M
	ab%=M
	a%=M
	all%=M


print abc%M
### BUGGY CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, K = MAP()
x = LIST()


ans = INF
idx = bisect(x, 0)
for i in range(idx-K, idx+1):
	if 0 <= i <= N-K:
		l = x[i:i+K]
		if i == idx-K:
			ans = min(ans, abs(l[0]))
		elif i == idx:
			ans = min(ans, l[-1])
		else:
			ans = min(ans, 2*abs(l[0])+l[-1], abs(l[0])+2*l[-1])
print(ans)


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect

def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

N, K = MAP()
x = LIST()


ans = INF
idx = bisect(x, 0)
for i in range(idx-K, idx+1):
	if 0 <= i <= N-K:
		if i == idx-K:
			ans = min(ans, abs(x[i]))
		elif i == idx:
			ans = min(ans, x[i+K-1])
		else:
			ans = min(ans, 2*abs(x[i])+x[i+K-1], abs(x[i])+2*x[i+K-1])
print(ans)
### BUGGY CODE ###

A,B,C = map(int,input().split())
count = 0
for i in range(C):
    if B > 0:
        B -= 1
        count += 2
    elif A > 0:
        A -= 1
        count += 1
    else:
        if C > 0:
            count += 1
        break
count += B
print(count)

### FIXED CODE ###

A,B,C = map(int,input().split())
if C > (A + B):
    count = A + B + B + 1
elif C == (A + B):
    count = A + B + B
else:
    count = C + B
print(count)
### BUGGY CODE ###

N=int(input())
S_list = []
count = 0
for i in range(N):
  s = str(input())
  if not (s in S_list):
    count = count + 1
  S_list.append(s)
print(count)


### FIXED CODE ###

import numpy as np
N=int(input())
S_list = np.zeros(N)
#S_list = np.zeros(N,dtype=str)
e_list = "abcdefghijklmnopqrstuvwxyz"

for i in range(N):
  s = input()
  n = 0
  for k in range(len(s)):
    n = n + (e_list.index(s[k])+1)*(100**k)
  S_list[i] = n
print(len(np.unique(S_list)))
### BUGGY CODE ###

n = int(input())
num = input()
 
password_list = []
initial_list = []
 
for i in range(len(num)-2):
    if num[i] in initial_list:
        continue
    else:
        initial_list.append(num[i])
        for j in range(i+1,len(num)-1):
            for k in range(j+1,len(num)):
                target = num[i] + num[j] + num[k]
                if target not in password_list:
                    password_list.append(target)
print(len(password_list))

### FIXED CODE ###

n = int(input())
num = input()
 
password_list = []
initial_list = []
initial_list2 = []
initial_list3 = []
 
for i in range(len(num)-2):
    initial_list2 = []
    if num[i] in initial_list:
        continue
    elif len(initial_list) == 10:
        break
    else:
        initial_list.append(num[i])
        for j in range(i+1,len(num)-1):
            initial_list3 = []
            if num[j] in initial_list2:
                continue
            elif len(initial_list2) == 10:
                break
            else:
                initial_list2.append(num[j])
                for k in range(j+1,len(num)):
                    if num[k] in initial_list3:
                        continue
                    elif len(initial_list3) == 10:
                        break
                    else:
                        initial_list3.append(num[k])
                        target = num[i] + num[j] + num[k]
                        if target not in password_list:
                            password_list.append(target)
                            
print(len(password_list))
### BUGGY CODE ###

n = int(input())
l = list(map(int,input().split()))
ans = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if l[i] < l[j] + l[k]:
                if l[j] < l[i] + l[k]:
                    if l[k] < l[i] + l[j]:
                        ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
#print(l)
for i in range(n):
    for j in range(i+1,n):
        val = l[i]+l[j]
        ng = n
        ok = j
        while abs(ok - ng) > 1:
            mid = (ok+ng)//2
            if val > l[mid]:
                ok = mid
            else:
                ng = mid


        #print(i,j,ok,ng)

        ans += ok - j


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

def count(data):
    dic = {}
    for d in data:
        if d in dic:
            dic[d] += 1
        else:
            dic[d] = 1
    return dic

n = int(input())
data = []
for _ in range(n):
    s = input()
    data.append(count(s))
ans = 0
for i in range(n):
    for ii in range(i+1, n):
        if data[i] == data[ii]:
            ans += 1
print(ans)



### FIXED CODE ###

def count(data):
    dic = {}
    for d in data:
        if d in dic:
            dic[d] += 1
        else:
            dic[d] = 1
    return dic

n = int(input())
counts = {}
for _ in range(n):
    s = ''.join(sorted(input()))
    if s in counts:
        counts[s] += 1
    else:
        counts[s] = 1

ans = 0
for v in counts.values():
    ans += (v*(v-1))//2
print(ans)
### BUGGY CODE ###

N = int(input())
S = [input() for i in range(N)]

keihin  = []

for i in S:
  if i not in keihin:
    keihin.append(i)
    
print(len(keihin))

### FIXED CODE ###

N = int(input())
S = [input() for i in range(N)]
S.sort()

ans = N
for i in range(N-1):
  if S[i] == S[i+1]:
    ans -= 1
print(ans)
### BUGGY CODE ###

import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []
from functools import lru_cache

@lru_cache(maxsize=100000)
def len_make_divisors(n: int) -> list:
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return len(divisors)

def main():
    n = i_input()

    count = 0

    for i in range(1, n+1):
        count += i * len_make_divisors(i)

    print(count)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys, re
from math import ceil, floor, sqrt, pi, factorial, gcd
from copy import deepcopy
from collections import Counter, deque
from heapq import heapify, heappop, heappush
from itertools import accumulate, product, combinations, combinations_with_replacement
from bisect import bisect, bisect_left, bisect_right
from functools import reduce
from decimal import Decimal, getcontext
# input = sys.stdin.readline 
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_list(N): return [s_list() for _ in range(N)]
def lcm(a, b): return a * b // gcd(a, b)
sys.setrecursionlimit(10 ** 6)
INF = float('inf')
MOD = 10 ** 9 + 7
num_list = []
str_list = []

def main():
    n = i_input()

    ans_list = [1] * n

    for i in range(2,n+1):
        for j in range(i,n+1,i):
            ans_list[j-1] += 1

    count = 0
    for i, ans in enumerate(ans_list):
        count += (i+1) * ans

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

N,K = map(int,input().split())
T = list(map(int,input().split()))
Number = []
for j in range(N-K+1):
    Num=1
    for i in range(K):
        Num *=T[i+j]
    Number.append(Num)

for p in range(N-K):
    if Number[p+1] - Number[p] >0:
        print('Yes')
    else:
        print('No')

### FIXED CODE ###

N,K = map(int,input().split())
T = list(map(int,input().split()))
for p in range(N-K):
    if T[p] - T[p+K] <0:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

n, m, v, p = map(int, input().split())
# n:問題数 m:人数 v:投じる標数 p:選ばれるもの
prob_set = list(map(int, input().split()))
prob_set.sort(reverse=True)
ruiseki_prob = [0 for i in range(n)]
ruiseki_prob[0] = prob_set[0]
high = n - 1
low = 0
mid = (high + low) // 2
# 下げるときはhigh = mid-1
# 上げるときはlow = mid
for i in range(1, n):
    ruiseki_prob[i] = ruiseki_prob[i - 1] + prob_set[i]

# print(prob_set)
# print(ruiseki_prob)

while low <= high:
    mid = (low + high) // 2
    # print(mid)
    f = True
    # まず上からp個以内であれば問答無用でOK (つまりindexがp>i)
    if mid < p:
        # print("<p")
        f = True
    else:
        # i~nには全員が票を投じると考えてよい (ここまででn-i票)
        # 次に上からp-1個に全員が票をいれてもよい(ここまでn-i + p-1)
        # それでも無理ならp ~ i-1までに残りを入れる必要がある.これがp[i] + m以下であればいいことがわかる
        if prob_set[mid] + m < prob_set[p - 1]:
            # どうあがいても無理
            # print("too short")
            f = False
        else:
            # どうにかなる
            if p - 1 + n - mid >= v:
                # print("OK for voting")
                f = True
            else:
                # mid
                amari_hyou = m * (v - (p - 1) - (n - mid))
                if ruiseki_prob[mid - 1] - ruiseki_prob[p - 2] + amari_hyou <= (prob_set[mid] + m) * (
                        (mid - 1) - (p - 2)):
                    # print("OK for super-voting")
                    f = True
                else:
                    # print("cannot EVEN super-voting")
                    f = False
    if f:
        low = mid + 1
    else:
        high = mid


print(low)

# 昇順に並んでいるとき,a_i が選ばれる → i > jなるa_jも選ばれる
# 二分探索することで間に合いそう
# あるiについて評価するとき,以下の観点に注意する


### FIXED CODE ###

n, m, v, p = map(int, input().split())
# n:問題数 m:人数 v:投じる標数 p:選ばれるもの
prob_set = list(map(int, input().split()))
prob_set.sort(reverse=True)
ruiseki_prob = [0 for i in range(n)]
ruiseki_prob[0] = prob_set[0]
high = n
low = 0
mid = (high + low) // 2
f = True


for i in range(1, n):
    ruiseki_prob[i] = ruiseki_prob[i - 1] + prob_set[i]

while low < high:
    mid = (low + high) // 2
    if mid <= p-1:
        f = True
    elif prob_set[mid] + m < prob_set[p - 1]:
        f = False
    else:
        hyou = m * (p - 1) + m * (n - mid)
        for i in range(p-1,mid):
            hyou += prob_set[mid] + m - prob_set[i]
        # まず0 ~ p-2まで(1,2,,,p-1まで) :p-1
        # 次にmid,mid+1,,,n-1まで       :n-mid
        # 上限はp-1,p,,,mid-1は(mid)+mずつ
        # 和はmid-1 - p-2
        if hyou < m*v:
            f = False
        else:
            f = True
    if f:
        low = mid + 1
    else:
        high = mid

print(high)

# 昇順に並んでいるとき,a_i が選ばれる → i > jなるa_jも選ばれる
# 二分探索することで間に合いそう
# あるiについて評価するとき,以下の観点に注意する
### BUGGY CODE ###

N = int(input())
l = []
for i in range(1, N+1):
  l.append(int(input()))
for i, Ai in enumerate(l):
  del l[i]
  print(max(l))
  l.insert(i, Ai)

### FIXED CODE ###

N = int(input())
l = [int(input()) for i in range(N)]
l_ = sorted(l)
for Ai in l:
  if l_[-1] == Ai:
    print(l_[-2])
  else:
    print(l_[-1])
### BUGGY CODE ###

s=input()
ans=10000
i=0
while i+3<=len(s):
  x = int(s[i:i+3])
  if ans>abs(753-x):
    ans=abs(753-x)
print(ans)

### FIXED CODE ###

s=input()
ans=10000
i=0
while i+3<=len(s):
  x = int(s[i:i+3])
  if ans>abs(753-x):
    ans=abs(753-x)
  i+=1
print(ans)
### BUGGY CODE ###

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

paths = set()
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    paths.add((a, b))

rooms = [-1] * N
rooms[0] = 0
marks = [-1] * (N-1)
step = 1
for step in range(1, N):
    key_rooms = []
    for i, room in enumerate(rooms):
        if room == step-1:
            key_rooms.append(i)
    kick_list = []
    for key_room in key_rooms:
        for path in paths:
            if key_room in path:
                else_room = path[0]
                if else_room == key_room:
                    else_room = path[1]
                kick_list.append(path)
                if rooms[else_room] == -1:
                    rooms[else_room] = step
                    marks[else_room-1] = key_room
    for kick in kick_list:
        if kick in paths:
            paths.remove(kick)

flag = True
for room in rooms[1:]:
    if room == 0:
        flag = False
        print('No')
        break

if flag:
    print('Yes')
    for i in marks:
        print(i+1)

### FIXED CODE ###

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

paths = [set() for _ in range(N)]
for _ in range(M):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    paths[a].add(b)
    paths[b].add(a)

rooms = [-1] * N
rooms[0] = 0
marks = [-1] * (N-1)
key_rooms = [[0]]
for step in range(1, N):
    next_key_rooms = set()
    for key_room in key_rooms[-1]:
        for else_room in paths[key_room]:
            if rooms[else_room] == -1:
                rooms[else_room] = step
                next_key_rooms.add(else_room)
                marks[else_room-1] = key_room
    key_rooms.append(next_key_rooms)

print('Yes')
for i in marks:
    print(i+1)
### BUGGY CODE ###

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

count= 0

Z1 = [i for i in range(K+1)]

for i in range(K+1):# X
  for j in range(K+1):#Y
    Z = S - i - j
    if Z in Z1:
      count += 1

print(count)

### FIXED CODE ###

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

count= 0

for i in range(K+1):# X
  for j in range(K+1):#Y
    Z = S - i - j
    if 0 <= Z <= K:
      count += 1
      #print(i,j,Z)
print(count)
### BUGGY CODE ###

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

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

ans_x = 0
c = combinations_count(N*M-2, K-2)
#for i in range(1, N+1):
#    ans_x += N*(N+1)//2-i*(i+1)//2-i*(N-i)
    #for j in range(i+1, N+1):
    #    ans_x += j-i
ans_x = (N*N*(N+1) + N*(N+1)*(2*N+1)//6 - (2*N+1)*N*(N+1)//2)//2
ans_x = M*M*ans_x*c

ans_y = 0
c = combinations_count(N*M-2, K-2)
#for i in range(1, M+1):
#    ans_y += M*(M+1)//2-i*(i+1)//2-i*(M-i)
    #for j in range(i+1, M+1):
    #    ans_y += j-i
ans_y = (M*M*(M+1) + M*(M+1)*(2*M+1)//6 - (2*M+1)*M*(M+1)//2)//2
ans_y = N*N*ans_y*c
ans = (ans_x+ans_y)%(10**9+7)
print(ans)

### FIXED CODE ###

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

import math

from operator import mul
from functools import reduce
def combinations_count(n, r):
    if n - r < r: r = n - r
    if r == 0: return 1
    if r == 1: return n

    numerator = [n - r + k + 1 for k in range(r)]
    denominator = [k + 1 for k in range(r)]

    for p in range(2,r+1):
        pivot = denominator[p - 1]
        if pivot > 1:
            offset = (n - r) % p
            for k in range(p-1,r,p):
                numerator[k - offset] /= pivot
                denominator[k] /= pivot

    result = 1
    for k in range(r):
        if numerator[k] > 1:
            result *= int(numerator[k])

    return result

ans_x = 0
c = combinations_count(N*M-2, K-2)
#for i in range(1, N+1):
#    ans_x += N*(N+1)//2-i*(i+1)//2-i*(N-i)
    #for j in range(i+1, N+1):
    #    ans_x += j-i
ans_x = (N*N*(N+1) + N*(N+1)*(2*N+1)//6 - (2*N+1)*N*(N+1)//2)//2
ans_x = M*M*ans_x*c

ans_y = 0
c = combinations_count(N*M-2, K-2)
#for i in range(1, M+1):
#    ans_y += M*(M+1)//2-i*(i+1)//2-i*(M-i)
    #for j in range(i+1, M+1):
    #    ans_y += j-i
ans_y = (M*M*(M+1) + M*(M+1)*(2*M+1)//6 - (2*M+1)*M*(M+1)//2)//2
ans_y = N*N*ans_y*c
ans = (ans_x+ans_y)%(10**9+7)
print(ans)