You are given N tasks numbered from 1 to N and a single machine able to process the tasks. At any time, the machine can only process a single task.
For every integer i between 1 and N, you are given 2 integers - $T_i$, denoting when the $i^{th}$ task is created, that means you can only process the $i^{th}$ task not earlier than $T_i$, and $D_i$, denoting the period of time the machine takes to completely process the $i^{th}$ task.
All the tasks are individual, so you can assign tasks in any order. Also, if the machine starts to process a task, then it never stops working until the task is finished. The machine can immediately start the other task (obviously, this task should be available) after finishing a task.
The waiting time, for the $i^{th}$ task, is defined as the delay time of the task that is equal to the difference between the time when the machine starts to process the $i^{th}$ task and $T_i$. You want to minimize the maximum waiting time of the given tasks. Find the minimum value of maximum waiting time.