people want to donate money to DMOJ. Each person has one person that they hate though, so they will not donate money if the person they hate donates to DMOJ.
Compute the maximum amount of money that DMOJ can receive.
The first line contains a single integer, .
The next lines contain two space-separated integers. The first is the amount of money person will donate, . The second is the index of the person they hate, which will be one-indexed.
Output the desired total.
3 10 2 20 3 30 1