Ive also indented your code for you so you can read it easier and understand how the nesting works.
S, you can go ahead and format your output as you wish, since it looks like its going to be a jumble of numbers.