let k, s = Scanf.scanf "%d %d" (fun x y -> x, y);;
let f s = if s + 1 <= 0 then 0
                        else (s+1)*(s+2)/2;;
print_int @@ f s - 3*(f (s-(k+1))) + 3*(f (s-(k+1)*2)) - f (s-(k+1)*3);;
print_newline ();;                                                           

