https://blog.firedrake.org/archive/2019/12/Perl_Weekly_Challenge_36__VINs_and_Knapsacks.html