Mary has just graduated from one well-known University and is now attending celebration party. Students like to dream of a beautiful life, so they used champagne glasses to construct a small pyramid. The height of the pyramid is n. The top level consists of only 1 glass, that stands on 2 glasses on the second level (counting from the top), then 3 glasses on the third level and so on.The bottom level consists of n glasses.

Vlad has seen in the movies many times how the champagne beautifully flows from top levels to bottom ones, filling all the glasses simultaneously. So he took a bottle and started to pour it in the glass located at the top of the pyramid.

Each second, Vlad pours to the top glass the amount of champagne equal to the size of exactly one glass. If the glass is already full, but there is some champagne flowing in it, then it pours over the edge of the glass and is equally distributed over two glasses standing under. If the overflowed glass is at the bottom level, then the champagne pours on the table. For the purpose of this problem we consider that champagne is distributed among pyramid glasses immediately. Vlad is interested in the number of completely full glasses if he stops pouring champagne in t seconds.

Pictures below illustrate the pyramid consisting of three levels. [Image] [Image] 


-----Input-----

The only line of the input contains two integers n and t (1 ≤ n ≤ 10, 0 ≤ t ≤ 10 000) — the height of the pyramid and the number of seconds Vlad will be pouring champagne from the bottle.


-----Output-----

Print the single integer — the number of completely full glasses after t seconds.


-----Examples-----
Input
3 5

Output
4

Input
4 8

Output
6



-----Note-----

In the first sample, the glasses full after 5 seconds are: the top glass, both glasses on the second level and the middle glass at the bottom level. Left and right glasses of the bottom level will be half-empty.

Difficulty: interview

Starter code:

Solutions:
n, t = list(map(int,input().split()))
g = [[0.0] * i for i in range(1,n+1)]


for _ in range(t):
    g[0][0] += 1.0
    for i in range(n):
        for j in range(i+1):
            spill = max(0, g[i][j] - 1.0)
            g[i][j] -= spill
            if i < n - 1:
                g[i + 1][j] += spill / 2
                g[i + 1][j + 1] += spill / 2
    if g[n-1][0] == 1.0:
        break

cnt = 0
for i in range(n):
    for j in range(i + 1):
        if g[i][j] == 1.0:
            cnt += 1
print(cnt)


n, T = list(map(int, input().split()))
a = [[0 for _ in range(n)] for __ in range(n)]
for t in range(T):
    i, j = 0, 0
    a[i][j] += 1024
    for i in range(n - 1):
        for j in range(i + 1):
            if a[i][j] > 1024:
                diff = a[i][j] - 1024
                a[i][j] = 1024
                a[i + 1][j] += diff//2
                a[i + 1][j + 1] += diff//2
                if (diff % 2 != 0):
                    raise RuntimeError('whut')
ans = 0
for i in range(n):
    for j in range(i + 1):
        if a[i][j] >= 1024:
            ans += 1
print(ans)


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

t = min(2000, t)
L = [ [0.0]*n for i in range(n) ]
for _ in range(t) :
    L[0][0] += 1.0
    for i in range(n-1) :
        for j in range(i+1) :
            if L[i][j] > 1.0 :
                x = (L[i][j] - 1.0) / 2
                L[i+1][j] += x
                L[i+1][j+1] += x
                L[i][j] = 1.0

ans = 0
for i in range(n) :
    for j in range(i+1) :
        if L[i][j] > 0.9999999999 :
            ans += 1

print(ans)

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

a = [[None]] + [[0] * i for i in range(1, n + 1)]

c = 2 ** (n + 1)

for _ in range(t):
	a[1][0] += c
	for i in range(1, n + 1):
		for j in range(i):
			if a[i][j] > c:
				diff = a[i][j] - c
				a[i][j] = c
				if i < n:
					a[i + 1][j] += diff // 2
					a[i + 1][j + 1] += diff // 2

full = 0
for i in range(1, n + 1):
	for j in range(i):
		full += (a[i][j] == c)

print(full)

n,t = [int(x) for x in input().split()]
curr = [t]
fill = 0

while sum(curr)>0 and len(curr)<=n:
    nex = [0]*(len(curr)+1)
    for i in range(len(curr)):
        if curr[i]>=1:
            fill+=1
            flow = curr[i]-1
            nex[i]+=flow/2
            nex[i+1]+=flow/2
    curr = nex

print(fill)


n,t = list(map(int,input().split()))
matrix = [ [0]*i for i in range(1,n+1)]
norma = 2**n
for time in range(t):
    matrix[0][0] += norma
    for i in range(n):
        for j in range(i+1):
            if matrix[i][j]>norma:
                many = matrix[i][j] - norma
                if i+1!=n:
                    matrix[i+1][j]+=many//2
                    matrix[i+1][j+1]+=many//2
                matrix[i][j] = norma
counter = 0
for i in range(n):
    for j in range(i+1):
        if matrix[i][j] == norma:
            counter+=1
print(counter)
#print(matrix)


import sys,math


res=[0]
n,m=map(int,input().split())
z=[]
need=0
for i in range(1,n+1):
    need+=i
for i in range(1,n+1):
    z.append([0]*i)
for i in range(1,m+1):
    z[0][0]+=2
    for i in range(n-1):
        for j in range(i+1):
            if z[i][j]>=2:
                h=z[i][j]-2
                z[i+1][j]+=h/2
                z[i+1][j+1]+=h/2
                z[i][j]=2
    for j in range(n):
        if z[-1][j]>=2:
            z[-1][j]=2
        
s=0
for i in range(n):
    s+=z[i].count(2)
print(s)


def __starting_point():
    #n, m = list(map(int, input().split()))
    n, t = map(int, input().split())
    A = [[0] * 11 for _ in range(11)]
    ans = 0
    A[0][0] = t
    for i in range(n):
        for j in range(i + 1):
            if A[i][j] >= 1:
                A[i + 1][j] += (A[i][j] - 1) / 2
                A[i + 1][j + 1] += (A[i][j] - 1) / 2
                A[i][j] = 1
                ans += 1
    print(ans)
__starting_point()

n,t = list(map(int, input().split()))
"""t = 10000
for n in range(10,11):
    T = [[-1 for _ in range(i)] for i in range(1,n+1)]
    G = [[0 for _ in range(i)] for i in range(1,n+2)]
    for i in range(t):
        G[0][0] += 1000000000000
        for j in range(n):
            for l in range(j+1):
                if G[j][l] >= 1000000000000:
                    G[j+1][l] += (G[j][l]-1000000000000)//2
                    G[j+1][l+1] += (G[j][l]-1000000000000)//2
                    G[j][l] = 1000000000000
                    if T[j][l] == -1:
                        T[j][l] = i
    print(T)
int(input())"""
R = [[0], [2, 2], [6, 4, 6], [14, 8, 8, 14], [30, 13, 10, 13, 30], [62, 21, 15, 15, 21, 62], [126, 36, 21, 18, 21, 36, 126], [254, 62, 30, 23, 23, 30, 62, 254], [510, 104, 45, 31, 27, 31, 45, 104, 510], [1022, 181, 68, 40, 33, 33, 40, 68, 181, 1022]]



C = [0 for _ in range(10001)]
for i in range(n):
    for j in range(i+1):
        C[R[i][j]] += 1
for i in range(1,10001):
    C[i] += C[i-1]
if t:
    print(C[t-1])
else:
    print(0)


read = lambda: list(map(int, input().split()))
n, t = read()
a = [[0] * 20 for i in range(20)]
b = [[0] * 20 for i in range(20)]
for k in range(t):
    for i in range(n):
        for j in range(n):
            b[i][j] = 0
    b[0][0] = 1
    for s in range(n):
        for i in range(s + 1):
            j = s - i
            a[i][j] += b[i][j]
            if a[i][j] > 1:
                r = a[i][j] - 1
                a[i][j] = 1
                b[i + 1][j] += r / 2
                b[i][j + 1] += r / 2
cnt = 0
for i in range(n):
    for j in range(n):
        cnt += int(a[i][j] == 1)
print(cnt)


n, t = list(map(int,input().split()))
bo = [[0.0]*(n+1) for i in range(n+1)]
while t > 0:
    bo[0][0] += 1
    for i in range(n):
        for j in range(0,i+1):
            if bo[i][j] > 1.0:
                temp = (bo[i][j] - 1)/ 2
                bo[i][j] = 1.0
                bo[i+1][j] += temp
                bo[i+1][j+1] += temp
    t -= 1

num = 0
for i in range(n):
    for j in range(0,i+1):
        if bo[i][j] >= 1.0:
            num += 1
print(num)


n, t = list(map(int, input().split()))

m = [[0]*11 for i in range(11)]

eps = 1e-6

for l in range(t):
    m[0][0] += 1.0
    for i in range(n):
        for j in range(i+1):
            if m[i][j] - eps > 1.0:
                should_end = False
                delta = m[i][j] - 1.0
                m[i][j] = 1.0
                m[i+1][j] += delta / 2.0
                m[i+1][j+1] += delta / 2.0
    # print(l)
    # for k in m:
    #     print(k)

answ = 0
for i in range(n):
    for j in range(n):
        if abs(m[i][j] - 1.0) <= eps:
            answ += 1

print(answ)


from decimal import Decimal

RESULT = 0


class Glass:
    def __init__(self):
        self.left = None
        self.right = None
        self.amount = Decimal(0)
        self.is_calculated = False

    def add_wine(self, amount):
        extra_amount = self.amount + amount - Decimal(1)
        if extra_amount > 0:
            self.amount = Decimal(1)
            if self.left is not None:
                self.left.add_wine(extra_amount / Decimal(2))
            if self.right is not None:
                self.right.add_wine(extra_amount / Decimal(2))
        else:
            self.amount += amount


def calculate(glass: Glass):
    if glass.is_calculated:
        return

    nonlocal RESULT
    if glass.amount == Decimal(1):
        RESULT += 1
    glass.is_calculated = True

    if glass.left is not None:
        calculate(glass.left)
    if glass.right is not None:
        calculate(glass.right)

n, t = list(map(int, input().split()))

a = []

for _ in range(n):
    a.append([])

for i in range(n, 0, -1):
    # a[i-1].extend([Glass()] * i)
    for _ in range(i):
        a[i-1].append(Glass())
    if i != n:
        for j, g in enumerate(a[i-1]):
            g.left = a[i][j]
            g.right = a[i][j+1]

a[0][0].add_wine(t)

calculate(a[0][0])

print(RESULT)


n, t = map(int,input().split())
m = (n+1)*n//2
a = [0]*((n+1)*n//2)
next = [-1]*((n+1)*n//2)
now = 1
layer = 1
for i in range(m-n):
    next[i] = (now, now+1)
    if layer*(layer+1)//2 == i+1:
        layer += 1
        now = layer*(layer+1)//2-1
    now += 1
for i in range(t):
    a[0]+=1024
    for j in range(0, m):
        if a[j] > 1024:
            if next[j] == -1:
                a[j] = 1024
            else:
                a[next[j][0]] += (a[j]-1024)//2
                a[next[j][1]] += (a[j]-1024)//2
                a[j] = 1024
res = 0
for i in range(m):
    if a[i] >= 1024:
        res += 1
print(res)

s = input().split()
n, t = int(s[0]), int(s[1])
a = [0 for i in range(110)]


def balance(x, d):
	if a[x] <= 1.0 or d == n:
		return
	else:
		p = (a[x] - 1.0) / 2
		a[x] = 1
		a[x+n] += p
		a[x+1] += p
		balance(x+n, d+1)
		balance(x+1, d+1)
	

a[0] += t
balance(0, 1)
	
ans = 0
for i in range(100):
	if a[i] >= 1:
		ans += 1
		
print(ans)

n,t=list(map(int,input().split()))
ans=0
z=[[0 for i in range(n+1)] for i in range(n+1)]
e=[[0 for i in range(n+1)] for i in range(n+1)]
b=[[0 for i in range(n+1)] for i in range(n+1)]
for it in range(t):
    z[0][0]+=1
    if (ans>=n*(n+1)//2):
        break
    for i in range(n):
        for j in range(i+1):
           if z[i][j]>=1:
               if (b[i][j]==0):
                   ans+=1
               b[i][j]=1
               e[i][j]=z[i][j]-1
               z[i][j]=1
               z[i+1][j]+=e[i][j]/2
               z[i+1][j+1]+=e[i][j]/2
               e[i][j]=0
print(ans)


n,t=list(map(int,input().split()))
ot=0
a=[];b=[];c=[]
for i in range(n+1):
    a.append([])
    b.append([])
    c.append([])
    for j in range(n+1):
        a[i].append(0)
        b[i].append(0)
        c[i].append(0)    
for ii in range(1,t+1):
    a[0][0]+=1
    if (ot>=(n*n+n)//2):
        break
    for i in range(n):
        for j in range(i+1):
           if a[i][j]>=1:
               if not(c[i][j]):
                   ot+=1
               c[i][j]=1
               b[i][j]=a[i][j]-1
               a[i][j]=1
               a[i+1][j]+=b[i][j]/2
               b[i][j]=b[i][j]/2*2
               a[i+1][j+1]+=b[i][j]/2
               b[i][j]=0
print(ot)


def cuenta_uno(va):
    resp = 0
    for f in range(n):
        resp += va[f].count(1)
    return resp
#------------------------------------------
# Programa principal
#------------------------------------------
n, t = input().split(' ')
n, t = [int(n), int(t)]
#n, t = [3, 5]
#print(n, t)
va = [[0 for i in range(n + 1)] for i in range(n)]
ch = [0 for i in range(n + 1)]
#escribe_matriz(va)

max = 0
for i in range(n + 1):
    max += i

# ciclo de segundos virtiendo vino
c1 = 1
while c1 <= t and cuenta_uno(va) < max:
#for c1 in range(t):
    # poner la champaña
    ch = [0 for i in range(n + 1)]
    ch[0] = 1
    i_va = 0
    while sum(ch) > 0 and i_va < n and cuenta_uno(va) <= 55:
        #poner el vino en la i_va fila de vasos
        for ct in range(n):
            va[i_va][ct] += ch[ct]
        #el vino que sobre divide en 2 y pasa a los dos vasos inmediatamente inferiores
        ch = [0 for i in range(n + 1)]
        for ct in range(n):
            if va[i_va][ct] > 1:
                ch[ct] += (va[i_va][ct] - 1) / 2
                ch[ct + 1] += (va[i_va][ct] - 1) / 2
                va[i_va][ct] = 1
        i_va += 1
    #escribe_matriz(va)
    #print ("c1 = ", c1, " i_va=", i_va, "cuenta_uno", cuenta_uno(va), " ch=", ch)
    c1 += 1
#escribe_matriz(va)
print(cuenta_uno(va))


inin=input().split(' ')
n=int(inin[0])
t=int(inin[1])

mat=[]
for i in range(n+2):
	mat.append([0.0]*(n+2))

# def add(i,j,amt):
# 	if i>=n or j<0 or j>=n:
# 		return
# 	mat[i][j]+=amt
# 	if mat[i][j]>1:
# 		over=mat[i][j]-1
# 		mat[i][j]-=over
# 		add(i+1,j,over/2)
# 		add(i+1,j+1,over/2)

for time in range(t):
	# add(0,0,1)
	mat[1][1]+=1.0
	for i in range(1,n+1):
		for j in range(1,i+1):
			if mat[i][j]>1.0:
				over=mat[i][j]-1.0
				mat[i+1][j]+=over/2
				mat[i+1][j+1]+=over/2
				mat[i][j]=1.0

result=0
for i in range(1,n+1):
		for j in range(1,i+1):
			if mat[i][j]>=1.0:
				result+=1
print(result)

# for line in mat:
# 	# print(line)
# 	for b in line:
# 		print(str(b),end='\t')
# 	print()


from copy import deepcopy
def main():
    n, k = list(map(int, input().split()))
    arr = [
        [1],
        [0.5, 0.5],
        [0.25, 0.5, 0.25],
        [0.125, 0.375, 0.375, 0.125],
        [0.0625, 0.25, 0.375, 0.25, 0.0625],
        [0.03125, 0.15625, 0.3125, 0.3125, 0.15625, 0.03125],
        [0.015625, 0.09375, 0.234375, 0.3125, 0.234375, 0.09375, 0.015625],
        [0.0078125, 0.0546875, 0.1640625, 0.2734375, 0.2734375, 0.1640625, 0.0546875, 0.0078125],
        [0.00390625, 0.03125, 0.109375, 0.21875, 0.2734375, 0.21875, 0.109375, 0.03125, 0.00390625],
        [0.001953125, 0.017578125, 0.0703125, 0.1640625, 0.24609375, 0.24609375, 0.1640625, 0.0703125, 0.017578125, 0.001953125]
    ]
    opyramid = [
        [1],
        [0, 0],
        [0, 0, 0],
        [0, 0, 0, 0],
        [0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ]
    finish_times = [
        [1],
        [0, 0],
        [0, 0, 0],
        [0, 0, 0, 0],
        [0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    ]
    opyramid[0][0] = 1
    countarr = [0, 1]
    for x in range(2, 10001):
        opyramid[0][0] += 1
        for y in range(1, len(opyramid)):
            opyramid[y][0] += max(opyramid[y - 1][0] - 1, 0) * 0.5
            opyramid[y - 1][0] -= max(opyramid[y - 1][0] - 1, 0) * 0.5
            for z in range(1, y):
                opyramid[y][z] += max(opyramid[y - 1][z - 1] - 1, 0) + \
                    max(opyramid[y - 1][z] - 1, 0) * 0.5
                opyramid[y - 1][z - 1] -= max(opyramid[y - 1][z - 1] - 1, 0)
                opyramid[y - 1][z] -= max(opyramid[y - 1][z] - 1, 0) * 0.5
            opyramid[y][y] += max(opyramid[y - 1][y - 1] - 1, 0)
            opyramid[y - 1][y - 1] -= max(opyramid[y - 1][y - 1] - 1, 0)
        # print(opyramid)
        count = 0
        for x in range(n):
            for y in opyramid[x]:
                if y >= 1:
                    count += 1
        countarr.append(count)
    print(countarr[k])

    # arr = [
    #     [1],
    #     [0.5, 0.5],]
    # for x in range(3, 11):
    #     na = []
    #     for y in range(x - 2):
    #         na.append(arr[-1][y]*0.5 + arr[-1][y + 1]*0.5)
    #     arr.append([arr[-1][0] * 0.5] + na + [arr[-1][-1] * 0.5])
    # print(arr)
    # #     [1, 2, 1],
    # #     [1, 3, 3, 1],
    # #     [1, 4, 6, 4, 1],
    # #     [1, 5, 10, 10, 5, 1],
    # #     [1, 6, 15, 20, 15, 6, 1],
    # #     [1, 7, 21, 35, 35, 21, 7, 1],
    # #     [1, 8, 28, 56, 70, 56, 28, 8, 1]]

    # # arr = [
    # #     [1],
    # #     [1, 1],
    # #     [1, 2, 1],
    # #     [1, 3, 3, 1],
    # #     [1, 4, 6, 4, 1],
    # #     [1, 5, 10, 10, 5, 1],
    # #     [1, 6, 15, 20, 15, 6, 1],
    # #     [1, 7, 21, 35, 35, 21, 7, 1],
    # #     [1, 8, 28, 56, 70, 56, 28, 8, 1]]

    # # print(arr)

main()


def push(graph, pos, level):
    if graph[pos] > 1:
        over = graph[pos] - 1
        graph[pos] = 1
        if level + pos < numberofglasses:
            graph[level + pos] += over / 2
        if level + pos + 1 < numberofglasses:
            graph[level + pos + 1] += over / 2
        if level + pos < numberofglasses:
            push(graph, level + pos, level + 1)
        if level + pos + 1 < numberofglasses:
            push(graph, level + pos + 1, level + 1)


n, t = map(int, input().split())
table = dict()
current = 0
for i in range(1, 11):
    current += i
    table[i] = current
graph = [0] * table[n]
numberofglasses = table[n]
graph[0] = t
push(graph, 0, 1)
counter = 0
for elem in graph:
    if elem == 1:
        counter += 1
print(counter)

from fractions import Fraction

inp = input().split()
N, T = int(inp[0]), int(inp[1])

if T is 0:
    print(0)
    return

dp = []
for r in range(N + 1):
    dp.append([Fraction(0) for _ in range(N + 1)])

dp[0][0] = Fraction(T)
for r in range(N):
    for c in range(r + 1):
        if dp[r][c] >= Fraction(1):
            dp[r + 1][c + 0] += (dp[r][c] - Fraction(1)) / Fraction(2);
            dp[r + 1][c + 1] += (dp[r][c] - Fraction(1)) / Fraction(2);

cnt = 0
for r in range(N):
    for c in range(r + 1):
        if dp[r][c] >= Fraction(1):
            cnt += 1

print(cnt)


def push(graph, pos, level):
    if graph[pos] > 1:
        over = graph[pos] - 1
        graph[pos] = 1
        if level + pos < numberofglasses:
            graph[level + pos] += over / 2
        if level + pos + 1 < numberofglasses:
            graph[level + pos + 1] += over / 2
        if level + pos < numberofglasses:
            push(graph, level + pos, level + 1)
        if level + pos + 1 < numberofglasses:
            push(graph, level + pos + 1, level + 1)


n, t = map(int, input().split())
table = dict()
current = 0
for i in range(1, 11):
    current += i
    table[i] = current
graph = [0] * table[n]
numberofglasses = table[n]

graph[0] += t
push(graph, 0, 1)
counter = 0
for elem in graph:
    if elem == 1:
        counter += 1
print(counter)

n, t = list(map(int, input().split()))
total = sum(range(1, n+1))
l = [[0] * i for i in range(1, n+1)]
max_d = sum(range(1, n+1))
d = 0

def f(l, lvl, i, inc):
    if lvl >= len(l) or i >= len(l[lvl]):
        return
    if l[lvl][i] < 1:
        tmp = l[lvl][i] + inc
        if tmp > 1:
            inc = tmp - 1
            l[lvl][i] = 1
        else:
            l[lvl][i] += inc
            inc = 0
    if inc == 0:
        return
    inc /= 2
    lvl += 1
    f(l, lvl, i, inc)
    f(l, lvl, i+1, inc)
        
def count(l):
    ans = 0
    for i in range(len(l)):
        for j in range(len(l[i])):
            if l[i][j] >= 1:
                ans += 1
    return ans

f(l, 0, 0, t)

print(count(l))

    



n, t = map(int, input().split())
a = [0] * (n + 1)
for i in range(n + 1):
    a[i] = [0] * (i + 1)
for i in range(t):
    a[0][0] += 1
    for j in range(n):
        for k in range(j + 1):
            if a[j][k] > 1:
                a[j + 1][k] += (a[j][k] - 1) / 2
                a[j + 1][k + 1] += (a[j][k] - 1) / 2
                a[j][k] = 1
res = 0

for j in range(n):
    for k in range(j + 1):
        if a[j][k] == 1:
            res += 1

print(res)