Problem - D - Codeforces