Problem 258 (very slow)