P005: improved solution
P037: greatly improved solution