CodeEff/ECCO huggingface dataset:
# Original solution
# 解説と下記を参考に作成
# https://atcoder.jp/contests/abc113/submissions/15821617
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
# 
# 
# @stop_watch
def solve(H, W, K):
    mod = 10 ** 9 + 7
    dp = [[0] * W for _ in range(H + 1)]
    dp[0][0] = 1
    for h in range(H):
        for w in range(W):
            if dp[h][w] == 0:
                continue
            for i in range(3):
                new_w = w - 1 + i
                if not 0 <= new_w < W:
                    continue

                def cnt_tmp(n, r, l, flg):
                    re = 0
                    if n >= W - 2:
                        if r <= n <= l:
                            return 1
                        if flg:
                            return 1
                        else:
                            return 2
                    if r <= n <= l:
                        return cnt_tmp(n + 1, r, l, False)
                    re += cnt_tmp(n + 1, r, l, False)
                    re += cnt_tmp(n + 1, r, l, True) if not flg else 0
                    return re

                tmp = cnt_tmp(0, min(w, new_w) - 1, max(w, new_w), False)
                dp[h + 1][new_w] += dp[h][w] * tmp
                dp[h + 1][new_w] %= mod
    # for dpi in dp:
    #     print(dpi)
    print((dp[-1][K - 1]))


if __name__ == '__main__':
    H, W, K = list(map(int, input().split()))
    solve(H, W, K)

    # # test
    # from random import randint
    # from func import random_str
    # solve()


# Optimized solution
# 解説と下記を参考に作成
# https://atcoder.jp/contests/abc113/submissions/15821617
# import sys
# sys.setrecursionlimit(10 ** 6)
# import bisect
# from collections import deque
# from decorator import stop_watch
#
#
# @stop_watch
def solve(H, W, K):
    mod = 10 ** 9 + 7
    dp = [[0] * W for _ in range(H + 1)]
    dp[0][0] = 1
    fibo = [1, 2, 3, 5, 8, 13, 21]
    for h in range(H):
        for w in range(W):
            if dp[h][w] == 0:
                continue
            for i in range(3):
                new_w = w - 1 + i
                if not 0 <= new_w < W:
                    continue
                l, r = min(w, new_w), max(w, new_w)
                tmp = fibo[max(l - 1, 0)] * fibo[max(W - 1 - (r + 1), 0)]
                dp[h + 1][new_w] += dp[h][w] * tmp
                dp[h + 1][new_w] %= mod
    print((dp[-1][K - 1]))


if __name__ == '__main__':
    H, W, K = list(map(int, input().split()))
    solve(H, W, K)

    # # test
    # from random import randint
    # from func import random_str
    # solve()
# Original solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    H, W, K = list(map(int, readline().split()))

    dp = [0] * W
    dp[0] = 1

    for _ in range(H):
        dp, dp_prev = [0] * W, dp
        for mask in range(1 << (W - 1)):
            ok = True
            for i in range(W - 2):
                if mask & (1 << i) and mask & (1 << (i + 1)):
                    ok = False
            if not ok:
                continue
            for i in range(W):
                if i > 0 and mask & (1 << (i - 1)):
                    dp[i - 1] = (dp[i - 1] + dp_prev[i]) % MOD
                elif i < W - 1 and mask & (1 << i):
                    dp[i + 1] = (dp[i + 1] + dp_prev[i]) % MOD
                else:
                    dp[i] = (dp[i] + dp_prev[i]) % MOD

    print((dp[K - 1]))

    return


if __name__ == '__main__':
    main()


# Optimized solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    H, W, K = list(map(int, readline().split()))

    dp = [0] * W
    dp[0] = 1

    for _ in range(H):
        dp, dp_prev = [0] * W, dp
        for mask in range(1 << (W - 1)):
            ok = True
            for i in range(W - 2):
                if mask & (1 << i) and mask & (1 << (i + 1)):
                    ok = False
                    break
            if not ok:
                continue
            for i in range(W):
                if i > 0 and mask & (1 << (i - 1)):
                    dp[i - 1] = (dp[i - 1] + dp_prev[i]) % MOD
                elif i < W - 1 and mask & (1 << i):
                    dp[i + 1] = (dp[i + 1] + dp_prev[i]) % MOD
                else:
                    dp[i] = (dp[i] + dp_prev[i]) % MOD

    print((dp[K - 1]))

    return


if __name__ == '__main__':
    main()
# Original solution
K, S = list(map(int, input().split()))

ans = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if z >= 0 and z <= K:
            ans += 1

print(ans)


# Optimized solution
K, S = list(map(int, input().split()))

cnt = 0
for i in range(K+1):
    for j in range(K+1):
        x = S - i - j
        if 0 <= x <= K:
            cnt += 1
print(cnt)
# Original solution
K, S = list(map(int, input().split()))
count = 0
for X in range(K + 1):
    if X > S:
        break
    for Y in range(min(K, S - X) + 1):
        if Y < 0:
            continue
        if X + Y > S:
            break
        Z = S - X - Y
        if X <= K and Y <= K and Z <= K:
            count += 1
print(count)



# Optimized solution
K, S = list(map(int, input().split()))
count = 0
for X in range(min(S + 1, K + 1)):
    for Y in range(min(S - X + 1, K + 1)):
        if S - X - Y <= K:
            count += 1
print(count)
# Original solution
K,S = list(map(int,input().split()))
g = 0
for x in range(0,K+1):
    for y in range(x,K+1):
        for z in range(y,K+1):
            if x+y+z == S:
                if x == y == z:g += 1
                elif x == y or y == z:g += 3
                else:g += 6
print(g)

# Optimized solution
K,S = list(map(int,input().split()))
t = 0
#c = 0
for x in range(max(0,S-2*K),min(S//3+1,K+1)):
    if S-x > 2 * K:
        pass
    else:
        for y in range(max(x,S-x-K),min((S-x)//2+1,K+1)):
            #c += 1
            z = S - x - y
            if z < y:
                #print('pass')
                pass
            else:
                #print(x,y,z)
                if x == y == z:
                    t += 1
                elif x == y or y == z:
                    t += 3
                else:
                    t += 6
print(t)
# Original solution
k, s = list(map(int, input().split()))
count = 0
sz_list = []
for i in range(k+1):
    sz_list.append(s-i)

for x in range(k+1):
    for y in range(k+1):
        s = x +y
        if s in sz_list:
            count+=1

print(count)

# Optimized solution
k, s = list(map(int, input().split()))
count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if z >= 0 and z <= k:
            count+=1

print(count)
# Original solution
#入力
K, S = list(map(int, input().split()))

#問題文よりX, Y, Zの最大値はKである
X = list(range(K+1))
Y = list(range(K+1))
Z = list(range(K+1))

#フラグ設定
flag = 0

#全探索
for x in X:
    for y in Y:
        for z in Z:
            
            #条件
            if x+y+z==S:
                flag += 1

#出力
print(flag)

# Optimized solution
#入力
K, S = list(map(int, input().split()))

#問題文よりX, Y, Zの最大値はKであるため、各値の最大値はKである
X = list(range(K+1))
Y = list(range(K+1))

#フラグ設定
flag = 0

#全探索
for x in X:
    for y in Y:
        #条件に合うzの値を算出
        z = S - x - y
        if z<=K and z>=0:  #上で求めたzの値に問題文からFilterを掛ける
            flag += 1

#出力
print(flag)
# Original solution
k, s = list(map(int, input().split()))
ans = 0

for i in range(k+1):
    for j in range(k+1):
        for m in range(k+1):

            if i + j + m == s:
                ans += 1

print(ans)


# Optimized solution
k, s = list(map(int, input().split()))
ans = 0

for i in range(k+1):
    for j in range(k+1):
        if (i + j <= s) and (s - i - j <= k):
            ans += 1

print(ans)
# Original solution
count=0
k,s=list(map(int,input().split()))
for i in range(k+1):
  for j in range(k+1):
    for m in range(k+1):
      if i+j+m==s:
        count+=1
print(count)

# Optimized solution
count=0
k,s=list(map(int,input().split()))
for i in range(k+1):
  for j in range(k+1):
    if s-k<=i+j<=s:
      count+=1
print(count)
# Original solution
K,S=list(map(int,input().split()))
count=0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z == S:
                count+=1
print(count)

# Optimized solution
K,S=list(map(int,input().split()))
count=0
for x in range(K+1):
    for y in range(K+1):
        z=S-x-y
        if z>=0 and z<=K:
            count+=1
print(count)
# Original solution
import sys
def input(): return sys.stdin.readline().strip()
k,s=list(map(int,input().split()))
c=0
for x in range(k+1):
    if x + 2 * k < s:
        continue
    for y in range(k+1):
        if x + y > s:
            continue
        if x + y + k < s:
            continue
        c += 1
print(c)

# Optimized solution
import sys
def input(): return sys.stdin.readline().strip()
k,s=list(map(int,input().split()))
c=0
for x in range(max(0,s-2*k),k+1):
    for y in range(max(0,s-x-k),min(k,s-x)+1):
        c += 1
print(c)
# Original solution
k, s = list(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)


# Optimized solution
k, s = list(map(int, input().split()))
ans = 0
for x in range(k + 1):
  for y in range(k + 1):
    if (x + y <= s and s - (x + y) <= k):
      ans += 1


print(ans)
# Original solution
K,S=list(map(int,input().split()))
count=0
for i in range(K+1):
  for j in range(K+1):
    for m in range(K+1):
      if i+j+m==S:
        count+=1
print(count)

# Optimized solution
K,S=list(map(int,input().split()))
count=0
for i in range(K+1):
  for j in range(K+1):
    if 0 <= S-i-j <= K:
      count += 1
print(count)
# Original solution
K,S=list(map(int,input().split()))
count=0
for i in range(K+1):
  for j in range(K+1):
    if 0 <= S-i-j <= K:
      count += 1
print(count)

# Optimized solution
k,s=list(map(int,input().split()));count=0
for i in range(0,k+1):
  for j in range(0,k+1):
    if 0<=s-(i+j)<=k: count+=1
print(count)
# Original solution
n,k=list(map(int,input().split()))
ans=0
for i in range(n+1):
  for j in range(n+1):
    for l in range(n+1):
      if i+j+l==k:
        ans+=1
print(ans)


# Optimized solution
n,k=list(map(int,input().split()))
ans=0
for i in range(n+1):
  for j in range(n+1):
    if 0<=k-i-j<=n:
      ans+=1
print(ans)
# Original solution
K , S = list(map(int, input().split()))
x , y , z , cnt = 0 , 0 , 0 , 0
A = K + 1
if K * 3 == S:
    cnt = 1
else :
    for i in range(A):
        x = i
        for j in range(A):
            y = j
            for k2 in range(A) :
                z = k2
                if x + y + z == S:
                    cnt += 1

print(cnt)


# Optimized solution
K , S = list(map(int, input().split()))
x , y , z , cnt = 0 , 0 , 0 , 0
A = K + 1
if K * 3 == S:
    cnt = 1
else :
    for i in range(A):
        for j in range(A):
            if  S - (i + j) <= K :
                if 0 <= S - (i + j): 
                    cnt += 1
print(cnt)
# Original solution
K,S=list(map(int,input().split()))
count=0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x+y+z==S:
                count+=1
print(count)

# Optimized solution
K,S=list(map(int,input().split()))
count=0
for x in range(K+1):
    for y in range(K+1):
        if 0<=S-x-y<=K:
            count+=1
print(count)
# Original solution
[K,S] = list(map(int,input().split()))

count=0
for X in range(K+1):
    for Y in range(K+1):
        for Z in range(K+1):
            if X+Y+Z==S:
                count+=1
print(count)

# Optimized solution
[K,S] = list(map(int,input().split()))

count=0
for X in range(K+1):
    for Y in range(K+1):
        Z = S - X - Y
        if Z in range(K+1):
            count+=1

print(count)
# Original solution
from sys import stdin
n = input().split(' ')
c = 0
K = int(n[0])
S = int(n[1])
for i in range(int(K)+1):
    for j in range(int(K)+1):
        if(S-(i+j) <= K and S>=i+j):
            c+=1
                
print(c)

# Optimized solution
k, s = list(map(int, input().split()))
ans = 0
for i in range(k + 1):
	for j in range(k + 1):
		if 0 <= s - i - j <= k:
			ans +=1
print(ans)
# Original solution
# -*- coding: utf-8 -*-
                   
K, S = list(map(int, input().split()))
cnt = 0

for X in range(0, K+1):
     for Y in range(0, K+1):
         if 0<=S-X-Y and S-X-Y<=K:
             cnt += 1
print(cnt)

# Optimized solution
# -*- coding: utf-8 -*-
k, s  = list(map(int,input().split()))
cnt = 0
for x in range(k + 1):
    for y in range(k + 1):
        z = s - x - y
        if (0 <= z <= k):
            cnt += 1
print(cnt)
# Original solution
K, S = list(map(int, input().rstrip().split()))

n = 0
for x in range(K + 1):
    for y in range(K + 1):
        if x + y > S:
            break

        for z in range(K + 1):
            if x + y + z > S:
                break

            if (x + y + z) == S:
                n += 1

print(n)


# Optimized solution
K, S = list(map(int, input().rstrip().split()))

n = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - x - y
        if 0 <= z and z <= K:
            n += 1

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


# Optimized solution
k, s = list(map(int, input().split()))
r = 0
for x in range(k + 1):
    for y in range(0, min(s - x + 1, k + 1)):
        z = s - x - y
        if 0 <= z <= k and z + x + y == s:
            r += 1
print(r)
# Original solution
k,s=list(map(int,input().split()))
ans=0
if s<=k:
  print(((s+1)*(s+2)//2))
  exit()
for i in range(k+1):
  for j in range(i,k+1):
    for l in range(j,k+1):
      if i+j+l==s:
        if i==j and j==l:
          ans+=1
        elif i==j or j==l or l==i:
          ans+=3
        else:
          ans+=6
print(ans)


# Optimized solution
k,s=list(map(int,input().split()))
ans=0
if s<=k:
  print(((s+1)*(s+2)//2))
  exit()
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-i-j<=k:
      ans+=1
print(ans)
# Original solution
k,s=list(map(int,input().split()))
t=0

for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i+j+l==s:
                t+=1
print(t)


# Optimized solution
k,s=list(map(int,input().split()))
t=0

for i in range(k+1):
    for j in range(k+1):
        l=s-i-j
        if 0<=l<=k:
            t+=1
print(t)
# Original solution
k,s = list(map(int,input().split()))
cnt = 0
for x in range(s + 1):
	for y in range(s + 1 - x):
		if x <= k and y <= k and s - x - y <= k:
			cnt += 1
print(cnt)


# Optimized solution
k,s = list(map(int,input().split()))
cnt = 0
M = min(s + 1,k + 1)
for x in range(M):
	for y in range(min(s + 1 - x,k + 1)):
		if s - x - y <= k:
			cnt += 1
print(cnt)
# Original solution
k,s = list(map(int, input().split()))
cnt = 0
for x in range(k+1):
  for y in range(k+1):
    for z in range(k+1):
      if x+y+z == s:
        cnt += 1

print(cnt)

# Optimized solution
k,s = list(map(int, input().split()))
cnt = 0
for x in range(k+1):
  for y in range(k+1):
    z = s - x -y
    if 0 <= z <= k:
      cnt += 1

print(cnt)
# Original solution
K, S = list(map(int, input().strip().split(' ')))
cnt = 0
for X in range(0, K+1):
	for Y in range(0, K+1):
		for Z in range(0, K+1):
			if X+Y+Z == S:
				cnt += 1
print(cnt)

# Optimized solution
K, S = list(map(int, input().strip().split(' ')))
cnt = 0
if S < K:
	for X in range(0, S+1):
		cnt += (S-X+1)
else:
	for X in range(0, K+1):
		if (S-X) <= (2*K):
			if (S-X) < K:
				cnt += (S-X+1)
			elif (S-X) > K:
				Z = S-X-K
				cnt += (K-Z+1)
			else:
				cnt += (K+1)
 
print(cnt)
# Original solution
#全探索(多分TLE)
K, S = list(map(int, input().split()))

ans = 0

for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k == S:
                ans += 1
print(ans)

# Optimized solution
K, S = list(map(int, input().split()))
ans = 0
for x in range(K+1):
    for y in range(K+1):
        if S >= x+y and S-(x+y) <= K:
            ans += 1
print(ans)
# Original solution
k, s = list(map(int, input().split()))
count = 0
for y in range(k+1):
    for x in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            count += 1
print(count)

# Optimized solution
k, s = list(map(int, input().split()))
count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z <= k:
            count += 1
print(count)
# Original solution
# Me
def resolve(k, s):
    c = 0
    for x in range(0, k+1):
        for y in range(0, k+1):
            for z in range(0, k+1):
                if x + y + z == s:
                    c += 1
    return c


k, s = list(map(int, input().split()))
print((resolve(k, s)))


# Optimized solution
# Me
def resolve(k, s):
    c = 0
    for x in range(0, k+1):
        for y in range(0, k+1):
            if 0 <= s - (x + y) <= k:
                c += 1
    return c


k, s = list(map(int, input().split()))
print((resolve(k, s)))
# Original solution
import sys
from pprint import pprint

k, s = list(map(int, sys.stdin.readline().strip().split(" ")))

ans = 0
for x in range(k+1):
    for y in range(k+1):
        if 0 <= s - x - y <= k:
            ans += 1
            # print(x, y, s - x - y)
print(ans)

# Optimized solution
import sys

K, S = list(map(int, sys.stdin.readline().strip().split()))

N_MAX = min(K, S)

ans = 0
for i in range(N_MAX+1):
    for j in range(N_MAX+1):
        if 0 <= S - (i + j) <= K:
            ans += 1

print(ans)
# Original solution
k,s=list(map(int,input().split()))
a=0
for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i+j+l==s:
                a+=1
print(a)

# Optimized solution
k,s=list(map(int,input().split()))
a=0
for i in range(k+1):
    for j in range(k+1):
        if 0<=s-i-j<k+1:
            a+=1
print(a)
# Original solution
k, s = list(map(int,input().split(' ')))
count = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                count += 1
print(count)

# Optimized solution
k, s = list(map(int,input().split(' ')))
count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - (x+y)
        if 0 <= z and z <= k:
            count += 1

print(count)
# Original solution
K, S = list(map(int, input().split()))
count = 0
for x in range(K+1):
    for y in range(K+1):
        for z in range(K+1):
            if x + y + z == S:
                count += 1
print(count)

# Optimized solution
K, S = list(map(int, input().split()))
count = 0
for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if 0<=z and z<=K:
            count += 1
print(count)
# Original solution
k,s=list(map(int,input().split()))
counter=0

for x in range(k+1):
	for y in range(k+1):
		for z in range(k+1):
			if x+y+z==s:
				counter+=1

print(counter)


# Optimized solution
k,s=list(map(int,input().split()))
counter=0

for x in range(k+1):
	for y in range(k+1):
		if 0<=s-x-y<=k:
			counter+=1

print(counter)
# Original solution
k, s = list(map(int, input().split()))
cnt = 0
for x in range(k + 1):
  for y in range(k + 1):
    z = s - x - y
    if 0 <= z and z <= k:
      cnt += 1
print(cnt)

# Optimized solution
k, s = list(map(int, input().split()))
cnt = 0
for x in range(k + 1):
  for y in range(min(k + 1, s + 1 - x)):
    z = s - x - y
    if 0 <= z and z <= k:
      cnt += 1
print(cnt)
# Original solution
K, S = [int(x) for x in input().split()]

dic = {}
for i in range(K + 1):
    for j in range (K + 1):
        r = S - i - j
        if r in list(dic.keys()):
            dic[r].append((i, j))
        else:
            dic[r] = [(i, j)]

ans = 0
for k in range(K + 1):
    if k in list(dic.keys()):
        ans += len(dic[k]) 

print(ans)

# Optimized solution
K, S = [int(x) for x in input().split()]

ans = 0
for i in range(K + 1):
    for j in range (K + 1):
        r = S - i - j
        if r <= K and r >= 0:
            ans += 1
        
print(ans)
# Original solution
K, S = list(map(int, input().split(" ")))
count = 0

for x in range(K + 1):
  for y in range(K + 1):
    for z in range(K + 1):
      ans = x + y + z
      if S == ans:
        count += 1
print(count)

# Optimized solution
K, S = list(map(int, input().split(" ")))
count = 0

for x in range(K + 1):
  for y in range(K + 1):
    if S - x - y >= 0 and S - x - y <= K:
      count += 1
     
print(count)
# Original solution
#https://atcoder.jp/contests/abc051/tasks/abc051_b
# -*- coding: utf-8 -*-
K,S = list(map(int,input().split()))
ans = 0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i+j+k == S: ans +=1 
print(ans)

# Optimized solution
#https://atcoder.jp/contests/abc051/tasks/abc051_b
# -*- coding: utf-8 -*-
K,S = list(map(int,input().split()))
ans = 0
for i in range(0,K+1):
  for j in range(0,K+1):
    z = S-i-j
    if 0 <= z <= K: ans +=1
print(ans)
# Original solution
K, S = list(map(int, input().split()))
count = 0
K += 1
for x in range(K):
    for y in range(K):
        for z in range(K):
            if S == x + y + z:
                count += 1
print(count)

# Optimized solution
K, S = list(map(int, input().split()))
count = 0
for x in range(K+1):
    for y in range(K+1):
        z = S - x - y
        if 0 <= z <= K:
            count += 1
print(count)
# Original solution
k,s = list(map(int,input().split()))
c = 0

for i in range(k+1):
    for j in range(k+1):
        for l in range(k+1):
            if i+j+l == s:
                c += 1
print(c)

# Optimized solution
k,s = list(map(int,input().split()))
c = 0

for y in range(k+1):
    for z in range(k+1):
        if 0 <= s-(y+z) <= k:
            c += 1
print(c)
# Original solution
k, s = list(map(int, input().split()))

ans = 0
for x in range(s + 1):
  for y in range(s - x + 1):
    z = s - x - y
    
    if x <= k and y <= k and z <= k:
      ans += 1

print(ans)

# Optimized solution
k, s = list(map(int, input().split()))

ans = 0
for x in range(k+1):
    for y in range(k+1):
        z = (s-(x+y))
        if 0 <= z and z <= k:
            ans += 1 

print(ans)
# Original solution
# -*- coding utf-8 -*-
k,s=list(map(int,input().split()))
ans=0
for x in range(k+1):
    for y in range(k+1):
        if 0<=s-x-y<=k:
            ans+=1

print(ans)


# Optimized solution
k,s=list(map(int,input().split()))
ans=0

for x in range(k+1):
    for y in range(k+1):
        if 0<=s-x-y<=k:
            ans+=1
print(ans)
# Original solution
n,s=list(map(int,input().split()))
ans=0
for i in range(n+1):
  for j in range(n+1):
    if s-i-j>-1 and s-i-j<n+1:
      ans+=1
print(ans)


# Optimized solution
n,s=list(map(int,input().split()))
ans=0
for i in range(n+1):
  if s-i>n*2 or s-i<0:
    continue
  for j in range(n+1):
    if -1<s-i-j<n+1:
      ans+=1
print(ans)
# Original solution
K, S = list(map(int, input().split()))

count = 0
for i in range(K+1):
  for j in range(K+1):
    for k in range(K+1):
      if i + j + k == S:
        count += 1
      else:
        pass
      
print(count)

# Optimized solution
K, S = list(map(int, input().split()))

count = 0
for i in range(K+1):
  for j in range(K+1):
    if 0<= S - i - j <= K:
        count += 1
      
print(count)
# Original solution
K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
    for y in range(K + 1):
        z = S - (x + y)
        if 0 <= z <= K:
            if x <= S or y <= S:
                count += 1
print(count)

# Optimized solution
K, S = list(map(int, input().split()))
count = 0
for x in range(K + 1):
    yz = S - x
    if yz < 0:
        break
    elif yz <= K:
        count += yz + 1
    elif yz <= 2*K:
        count += K - (yz-K) + 1
print(count)