Total number of periods given by variable

Thank you @jpfeifer. It solved my problem.
I was not aware of this -D switch. It will be of great help.

Best,
Felipe