Max combined stay in L1A + H1B

Hello,

I have been searching all over the Internet without a definitive answer. Redbus2US has been always been very informative, so seeking out to you as the last resort.

I have entered the country in Aug 2010 on L1A from company A.

In Oct 2011 I moved to H1B (cos) and started working for company B.

Now my question is, is my maximum stay in US the combined period I worked in L1A + H1B in which case my stay expires in Aug 2016?

Or is it from the time I moved from L1A to H1B (Oct 2011), in which case my stay extends until Oct 2017?

Seeking your kind guidance in this matter.

Thanks and Regards

Can someone please advise on this? Your inputs are much appreciated.