CODEVS 1576 (easy dp)