recently Polycarp complete n successive tasksFor complete task time s_i know give task give time also give time f_i task complete for task unknown value d_i d_i0 duration task executionIt know task complete order come Polycarp perform task follow as soon task come Polycarp immediately begin carry if new task arrive Polycarp finish previous new task end queue when Polycarp finish execute task queue immediately take new task head queue queue wait task Find d_i duration task