Stack life of 4 = 2 {Since it will be on the top of the stack and the first one to pop and thus it will acquire only the in between time o operation}
Stack life of 3= 16 {2 [All it include the time of Gap after it is pushed ] + 5 [Time of push(4)] + 2 [gap] + 5[pop(4)] + 2 [gap] }
Now at this point we can derive the pattern the stack life of an element is the summation of the stack life of its consecutive element + 14 (Because the push pop and two gaps are not counted in the stack life of consequetive element)
Thus Stack life of 2 = 30 [same logic]
Stack life of 1 = 44
Total =92
Average = 23.
You can check this timeline for better understanding