Appending character "0" in vi editor for all lines between 1 and 40.

I have to append character "0" for lines between 1 and 40 in a file.

I tried the following code.

:s/^0,1,40/g

Input:

Output:

:1,40s/^/0/

Thanks!!