fedor and essay problem is a dp problem