solved Problem010 by Ruby, but too slow