Solve problem 123 using Lua.