A firm with initial inventory as zero made following sale and purchases

Period Purchase Sale

Q1 40 units at $30 13 units at $35

Q2 20 units at $40 35 units at $45

Q3 90 units at $50 60 units at $60

Calculate firm’s inventory at the end of the period using LIFO

In schweser it is given that all sold pieces will be sold starting from end which means when all 108 pieces are sold

inventory that is left is 40 units X $30 (from Q1) and 2 units X $40 (From Q 2)= $1280

My point is that when inventory is sold during Q1 it is from Q1 purchases (Q2 & Q3 purchases not available now)

During Q2 sale inventory is sold first from Q2 purchases and the remaining from Q1

Similarly Q3 sale is from Q3 purchases

what is left is 30 units from Q3 and 12 units from Q1. total inventory value at 30 X $50 + 12 X $30= $1860

Is there anything wrong in my logic

Please explain.

THanks for your time