{"trustable":false,"prependHtml":"\u003cstyle type\u003d\u0027text/css\u0027\u003e\n .input, .output {\n border: 1px solid #888888;\n }\n .output {\n margin-bottom: 1em;\n position: relative;\n top: -1px;\n }\n .output pre, .input pre {\n background-color: #EFEFEF;\n line-height: 1.25em;\n margin: 0;\n padding: 0.25em;\n }\n \u003c/style\u003e\n \u003clink rel\u003d\"stylesheet\" href\u003d\"//codeforces.org/s/96598/css/problem-statement.css\" type\u003d\"text/css\" /\u003e\u003cscript\u003e window.katexOptions \u003d { disable: true }; \u003c/script\u003e\n\u003cscript type\u003d\"text/x-mathjax-config\"\u003e\n MathJax.Hub.Config({\n tex2jax: {\n inlineMath: [[\u0027$$$\u0027,\u0027$$$\u0027], [\u0027$\u0027,\u0027$\u0027]],\n displayMath: [[\u0027$$$$$$\u0027,\u0027$$$$$$\u0027], [\u0027$$\u0027,\u0027$$\u0027]]\n }\n });\n\u003c/script\u003e\n\u003cscript type\u003d\"text/javascript\" async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS_HTML-full\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003eBullet Train in Japan is known to be the fastest train ever. There\u0027s N stations for the bullet train to stop. At every \u003ci\u003ei\u003c/i\u003e-th station, there will be \u003ci\u003eA\u003c/i\u003e passengers leaves the train, and \u003ci\u003eB\u003c/i\u003e passengers enters the train. Your job is to memorize the maximum amount of passengers that has rode the train for N stations.\u003c/p\u003e\n\u003cimg src\u003d\"https://c4.wallpaperflare.com/wallpaper/881/137/121/persona-5-takamaki-anne-train-station-raining-wallpaper-preview.jpg\" alt\u003d\"\" width\u003d\"600\"\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains a single number \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e2 ≤ \u003ci\u003en\u003c/i\u003e ≤ 1000\u003c/span\u003e) — the number of the train\u0027s stops.\u003c/p\u003e\n\u003cp\u003eThen \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/span\u003e lines follow, each contains two integers \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ea\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e and \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eb\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e (\u003cspan class\u003d\"tex-span\"\u003e0 ≤ \u003ci\u003ea\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e, \u003ci\u003eb\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e ≤ 1000\u003c/span\u003e) — the number of passengers that exits the tram at the \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/span\u003e-th stop, and the number of passengers that enter the tram at the \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ei\u003c/i\u003e\u003c/span\u003e-th stop. The stops are given from the first to the last stop in the order of tram\u0027s movement.\u003c/p\u003e\n\u003cul\u003e\n \u003cli\u003eThe number of people who exit at a given stop does not exceed the total number of people in the train immediately before it arrives at the stop. More formally, \u003cimg align\u003d\"middle\" class\u003d\"tex-formula\" src\u003d\"CDN_BASE_URL/aead497f2448600b9267912569ad9af4?v\u003d1671439283\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e. This particularly means that \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003ea\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e1\u003c/sub\u003e \u003d 0\u003c/span\u003e.\u003c/li\u003e\n \u003cli\u003eAt the last stop, \u003cspan class\u003d\"tex-font-style-bf\"\u003eall\u003c/span\u003e the passengers exit the tram and it becomes empty. More formally, \u003cimg align\u003d\"middle\" class\u003d\"tex-formula\" src\u003d\"CDN_BASE_URL/46eb3ba33adfcd9827db1146a2107f22?v\u003d1671439283\" style\u003d\"max-width: 100.0%;max-height: 100.0%;\"\u003e.\u003c/li\u003e\n \u003cli\u003eNo passenger will enter the train at the last stop. That is, \u003cspan class\u003d\"tex-span\"\u003e\u003ci\u003eb\u003c/i\u003e\u003csub class\u003d\"lower-index\"\u003e\u003ci\u003en\u003c/i\u003e\u003c/sub\u003e \u003d 0\u003c/span\u003e.\u003c/li\u003e\n\u003c/ul\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint a single integer denoting the maximum passengers that has rode the train.\u003c/p\u003e"}},{"title":"Sample 1","value":{"format":"HTML","content":"\u003ctable class\u003d\u0027vjudge_sample\u0027\u003e\n\u003cthead\u003e\n \u003ctr\u003e\n \u003cth\u003eInput\u003c/th\u003e\n \u003cth\u003eOutput\u003c/th\u003e\n \u003c/tr\u003e\n\u003c/thead\u003e\n\u003ctbody\u003e\n \u003ctr\u003e\n \u003ctd\u003e\u003cpre\u003e4\n0 3\n2 5\n4 2\n4 0\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e6\n\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"Note","value":{"format":"HTML","content":"\u003cp\u003eFor the first example, a capacity of 6 is sufficient:\u003c/p\u003e\n\u003cul\u003e\n \u003cli\u003eAt the first stop, the number of passengers inside the train before arriving is 0. Then, 3 passengers enter the tram, and the number of passengers inside the tram becomes 3.\u003c/li\u003e\n \u003cli\u003eAt the second stop, 2 passengers exit the train (1 passenger remains inside). Then, 5 passengers enter the train. There are 6 passengers inside the train now.\u003c/li\u003e\n \u003cli\u003eAt the third stop, 4 passengers exit the train (2 passengers remain inside). Then, 2 passengers enter the train. There are 4 passengers inside the train now.\u003c/li\u003e\n \u003cli\u003eFinally, all the remaining passengers inside the train exit the train at the last stop. There are no passenger inside the train now, which is in line with the constraints.\u003c/li\u003e\n\u003c/ul\u003e\n\u003cp\u003eSince the number of passengers inside the train never exceeds 6, a capacity of 6 is sufficient. Furthermore it is not possible for the train to have a capacity less than 6. Hence, 6 is the correct answer.\u003c/p\u003e"}}]}