Is there any algorithm, or heuristic method to solve this problems?

Hello, today I have a problem that needs to be applied to life. Can you please share with me your ideas? Any valuable solutions are noted. Thank you in advance and have a nice day.

There are n problems and three students, the i-th problem can only assign to a student after first s[i] day and take d[i] days to solve. When a problem is assigned to a student, that student will just solve that problem continuously until it is finished. Each student can only do 1 problem at the same time, and a problem can only be assigned to only one student. Find the minimum time to solve all n problems.

Contraints:

  • n ≤ 1000
  • s[i], d[i] ≤ 2 * 10^4

Example:

Input:

4
0 5
1 4
2 3
3 2

Output:

7