def hd(t,j): c=2*j b=c-1 g=(b+1)//2+1 return t+j+c+b+g def s(n): return 2*n def bc(t,j,n): return s(n)*0.5+hd(t,j)*0.75