solution for euler 20 in ruby