At the time that I ran out of melatonin and had my period so heavily again, I was taking a couple of them a night...
Now I take the smallest amount available as I understand that too much can trigger our bodies to think we don't need to sleep.
I think that melatonin is something like CoEnzymeQ10 -- that is, it is a part of the B complex, but not a B vitamin.