Reshape with padding

How to reshape 2d array with size [(A+B+C+…n),M] to 3d array with shape [N,X,M]
where X is max(A, B, C, …n) which contains A or B or C elements with padding.

[[1, 2],
[3, 4],
[5, 6],
[7, 8]]

A = 2, B = C = 1

to

[[[1, 2],
[3, 4]],
[[5, 6],
[0, 0]],
[[7, 8],
[0, 0]]]

gradients should be keeped.