You're playing Fallout Van Buren, an unreleased post-apocalyptic RPG. In this version, character builds are simplified to two stats: Strength (S) and Armor (E). Strength determines your damage output, while Armor represents your Power Armor's integrity.
You're about to face N hostile creatures in the wasteland. Each enemy i has damage $$$A_i$$$ and armor $$$D_i$$$.
Combat Mechanics:
Find the minimum $$$X$$$ such that you can defeat all $$$N$$$ enemies.
The first line contains a single integer N $$$(1 \leq N \leq 1000)$$$.
Each of the next N lines contains two integers $$$A_i$$$ and $$$D_i$$$ $$$(1 \leq A_i, D_i \leq 1000)$$$.
Print a single integer, the minimum stat points $$$X$$$ needed.
23 105 6
10
17 15
16