f=lambda m,x:m and(m.pop(0)[::-1],m.pop(0))[x&1]+f(m,x+1)print(f([[4, 3, 2, 1], [5, 6, 7, 8], [12, 11, 10, 9], [13, 14, 15, 16]],0))
Standard input is empty
[1, 2, 3, 4, 13, 14, 15, 16]
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!