Problem - 580D - Codeforces