Let us call x the score on Lena's next test, then we have

The above says that the average of six tests should be 77 and we just need to solve for x.
Simplifying the equation above gives

multiplying both sides by 6 gives

Finally, subtracting 367 from both sides gives

Hence, Lena needs to score 95 in order that her average be 77.