AT_abc384_b [ABC384B] ARC Division
Description
AtCoder Regular Contest (ARC) is divided into two divisions.
- In ARC Div. $ 1 $ , participants whose rating at the start of the contest is between $ 1600 $ and $ 2799 $ , inclusive, are subject to rating updates.
- In ARC Div. $ 2 $ , participants whose rating at the start of the contest is between $ 1200 $ and $ 2399 $ , inclusive, are subject to rating updates.
Takahashi decided to participate in $ N $ ARCs.
Initially, his rating is $ R $ .
The $ i $ -th $ (1\leq i\leq N) $ ARC is Div. $ D _ i $ , and his performance in that contest is represented by an integer $ A _ i $ .
If he is subject to a rating update in the $ i $ -th ARC, let $ T $ be his rating at the start of that contest. Then, after the contest, his rating becomes $ T+A _ i $ .
If his is not subject to a rating update, his rating does not change.
Rating updates for ARCs are performed immediately after the contest ends, and whether he is subject to rating updates in the next contest is determined based on his rating after the update.
Find his rating after finishing the $ N $ ARCs.
He does not participate in any contests other than these $ N $ ARCs, and his rating does not change in other ways.
Input Format
The input is given in the following format from Standard Input:
> $ N $ $ R $ $ D _ 1 $ $ A _ 1 $ $ D _ 2 $ $ A _ 2 $ $ \vdots $ $ D _ N $ $ A _ N $
Output Format
Print Takahashi's rating after finishing the $ N $ ARCs.
Explanation/Hint
### Sample Explanation 1
Initially, Takahashi's rating is $ 1255 $ .
For each contest, Takahashi's rating changes as follows:
- The 1st ARC is Div. $ 2 $ . He is subject to rating updates, so his rating becomes $ 1255+900=2155 $ .
- The 2nd ARC is Div. $ 1 $ . He is subject to rating updates, so his rating becomes $ 2155+521=2676 $ .
- The 3rd ARC is Div. $ 2 $ . He is not subject to rating updates, so his rating does not change.
- The 4th ARC is Div. $ 1 $ . He is subject to rating updates, so his rating becomes $ 2676+52=2728 $ .
After the four ARCs, his rating is $ 2728 $ , so print `2728`.
### Sample Explanation 2
He is a Red coder, so his rating does not change upon his performance in ARC.
### Constraints
- $ 1\leq N\leq 100 $
- $ 0\leq R\leq 4229 $
- $ 1\leq D _ i\leq 2\ (1\leq i\leq N) $
- $ -1000\leq A _ i\leq 1000\ (1\leq i\leq N) $
- All input values are integers.