solved euler 10, c++