refactor euler 8