Combinational Methods help

Hey everyone,

I just started my statistics course and I'm having trouble with one of the questions. I was hoping that somebody could give me some insight into completing one of the first ones, because every question after it references back to it.

Here's the question:

"An operation consists of two steps, of which the first can be made in $\displaystyle n_{1}$ ways. If the first step is made in the $\displaystyle i$th way, the step step can be made in the $\displaystyle n_{2i}$ ways.

A) Use a tree diagram to find a formula for the total number of ways in which the total operation can be made.

B) A student can study 0, 1, 2, or 3 hours for a history test on any given day. Use the formula obtained in part A to verify that there are 13 ways in which the student can study at most 4 hours for the test on two consecutive days."

The formula in the back of the book is

$\displaystyle \sum_{i=1}^n{n_{2i}}$ (that n on top should be $\displaystyle n_{i}$ but I can't seem to get it to show up that way, hope it still makes sense)

which I sort of understand, but if somebody could give me a more thorough explanation I certainly would appreciate it.

For the tree diagram, I believe I drew it correct, but I don't know how to apply the formula to this question. I'm just stuck overall.

Any bits of help are greatly appreciated, thanks!