{"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\n\u003cscript\u003e\n window.katexOptions \u003d {\n delimiters: [\n {left: \u0027$$$$$$\u0027, right: \u0027$$$$$$\u0027, display: true},\n {left: \u0027$$$\u0027, right: \u0027$$$\u0027, display: false},\n {left: \u0027$$\u0027, right: \u0027$$\u0027, display: true},\n {left: \u0027$\u0027, right: \u0027$\u0027, display: false}\n ]\n };\n\u003c/script\u003e\n","sections":[{"title":"","value":{"format":"HTML","content":"\u003cp\u003e \u003cspan\u003e\u003cem\u003eThere will be no more telegrams and love letters. Its the \u003cspan\u003e\u003cspan\u003eWhatsApp\u003c/span\u003e\u003c/span\u003e trend now. But there are definitely some serious issues with it. Lets find out:\u0026nbsp;\u003c/em\u003e\u003c/span\u003e\u003c/p\u003e \n\u003cp\u003e \u003cspan\u003eAll of us know about \u003cem\u003e\u003cstrong\u003e\u003cspan\u003e\u003cspan\u003ePaaru\u003c/span\u003e\u003c/span\u003e,\u0026nbsp;\u003cspan\u003e\u003cspan\u003eDevdas\u003c/span\u003e\u003c/span\u003e\u003c/strong\u003e\u003c/em\u003e\u0026nbsp;and their tragic \u003cimg alt\u003d\"heart\" src\u003d\"http://acm.hust.edu.cn/vjudge/ckeditor/plugins/smiley/images/heart.gif\" title\u003d\"heart\"\u003estory. But their tragedy continues even in this life. They always chat online. But both of them have schedules to follow.\u003c/span\u003e\u003c/p\u003e \n\u003cp\u003e \u003cspan\u003e\u003cspan\u003e\u003cspan\u003eDevdas\u003c/span\u003e\u003c/span\u003e has fixed schedule. He will be online at any moment of time between \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e \u003c/strong\u003eand \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003eb\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/strong\u003e, between \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e \u003c/strong\u003eand \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003eb\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/strong\u003e, ..., between \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003ep\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e \u003c/strong\u003eand \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003eb\u003c/i\u003e\u003csub\u003e\u003ci\u003ep\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e \u003c/strong\u003e(all borders inclusive). But the schedule of \u003cspan\u003e\u003cspan\u003ePaaru\u003c/span\u003e\u003c/span\u003e is quite strange, it depends on the time when she wakes up \u003cimg alt\u003d\"frown\" src\u003d\"http://acm.hust.edu.cn/vjudge/ckeditor/plugins/smiley/images/confused_smile.gif\" title\u003d\"frown\"\u003e. If she wakes up at time \u003cspan\u003e0\u003c/span\u003e, she will be online at any moment of time between \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ec\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e \u003c/strong\u003eand \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ed\u003c/i\u003e\u003csub\u003e1\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/strong\u003e, between \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ec\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e \u003c/strong\u003eand \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ed\u003c/i\u003e\u003csub\u003e2\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/strong\u003e, ..., between \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ec\u003c/i\u003e\u003csub\u003e\u003ci\u003eq\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e \u003c/strong\u003eand \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ed\u003c/i\u003e\u003csub\u003e\u003ci\u003eq\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e \u003c/strong\u003e(all borders inclusive). But if she gets up at time \u003cstrong\u003e\u003cspan\u003e\u003ci\u003et\u003c/i\u003e\u003c/span\u003e\u003c/strong\u003e, these segments will be shifted by \u003cstrong\u003e\u003cspan\u003e\u003ci\u003et\u003c/i\u003e\u003c/span\u003e\u003c/strong\u003e. They become \u003cstrong\u003e\u003cspan\u003e[\u003cspan\u003e\u003cspan\u003e\u003ci\u003ec\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e + \u003ci\u003et\u003c/i\u003e, \u003cspan\u003e\u003cspan\u003e\u003ci\u003ed\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e + \u003ci\u003et\u003c/i\u003e]\u003c/span\u003e\u003c/strong\u003e (for all \u003cstrong\u003e\u003cspan\u003e\u003ci\u003ei\u003c/i\u003e\u003c/span\u003e\u003c/strong\u003e).\u003c/span\u003e\u003c/p\u003e \n\u003cp\u003e \u003cspan\u003eIf at a moment of time, both \u003cspan\u003e\u003cspan\u003ePaaru\u003c/span\u003e\u003c/span\u003e and \u003cspan\u003e\u003cspan\u003eDevdas\u003c/span\u003e\u003c/span\u003e come online simultaneously, they can chat happily. You know that \u003cspan\u003e\u003cspan\u003ePaaru\u003c/span\u003e\u003c/span\u003e can wake up at an integer moment of time between \u003cstrong\u003e\u003cspan\u003e\u003ci\u003el\u003c/i\u003e\u003c/span\u003e \u003c/strong\u003eand \u003cstrong\u003e\u003cspan\u003e\u003ci\u003er\u003c/i\u003e\u003c/span\u003e \u003c/strong\u003e(both borders inclusive). How many integer moments of time from the segment \u003cstrong\u003e\u003cspan\u003e[\u003ci\u003el\u003c/i\u003e, \u003ci\u003er\u003c/i\u003e]\u003c/span\u003e\u003c/strong\u003e suit for their chat ?\u0026nbsp;(they must have at least one common moment of time in schedules)\u003c/span\u003e\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003e The first line contains four space-separated integers \u003cstrong\u003e\u003cspan\u003e\u003ci\u003ep\u003c/i\u003e, \u003ci\u003eq\u003c/i\u003e, \u003ci\u003el\u003c/i\u003e, \u003ci\u003er\u003c/i\u003e\u003c/span\u003e\u003c/strong\u003e \u003cstrong\u003e(\u003cspan\u003e1 ≤ \u003ci\u003ep\u003c/i\u003e, \u003ci\u003eq\u003c/i\u003e ≤ 50;\u0026nbsp;0 ≤ \u003ci\u003el\u003c/i\u003e ≤ \u003ci\u003er\u003c/i\u003e ≤ 1000\u003c/span\u003e).\u0026nbsp;\u003c/strong\u003eEach of the next \u003cstrong\u003e\u003cspan\u003e\u003ci\u003ep\u003c/i\u003e\u003c/span\u003e\u003c/strong\u003e lines contains two space-separated integers \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e, \u003ci\u003eb\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e (\u003cspan\u003e0 ≤ \u003cspan\u003e\u003cspan\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e \u0026lt; \u003ci\u003eb\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e ≤ 1000\u003c/span\u003e)\u003c/strong\u003e. Each of the next \u003cstrong\u003e\u003cspan\u003e\u003ci\u003eq\u003c/i\u003e\u003c/span\u003e\u003c/strong\u003e lines contains two space-separated integers \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ec\u003c/i\u003e\u003csub\u003e\u003ci\u003ej\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e, \u003cspan\u003e\u003cspan\u003e\u003ci\u003ed\u003c/i\u003e\u003csub\u003e\u003ci\u003ej\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e (\u003cspan\u003e0 ≤ \u003cspan\u003e\u003cspan\u003e\u003ci\u003ec\u003c/i\u003e\u003csub\u003e\u003ci\u003ej\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e \u0026lt; \u003cspan\u003e\u003cspan\u003e\u003ci\u003ed\u003c/i\u003e\u003csub\u003e\u003ci\u003ej\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e ≤ 1000\u003c/span\u003e).\u0026nbsp;\u003c/strong\u003eIt\u0027s guaranteed that\u003cstrong\u003e \u003cspan\u003e\u003ci\u003eb\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e \u0026lt; \u003cspan\u003e\u003cspan\u003e\u003ci\u003ea\u003c/i\u003e\u003csub\u003e\u003ci\u003ei\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003csub\u003e + 1\u003c/sub\u003e\u003c/span\u003e\u003c/strong\u003e and \u003cstrong\u003e\u003cspan\u003e\u003cspan\u003e\u003cspan\u003e\u003ci\u003ed\u003c/i\u003e\u003csub\u003e\u003ci\u003ej\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e \u0026lt; \u003cspan\u003e\u003cspan\u003e\u003ci\u003ec\u003c/i\u003e\u003csub\u003e\u003ci\u003ej\u003c/i\u003e\u003c/sub\u003e\u003c/span\u003e\u003c/span\u003e\u003csub\u003e + 1\u003c/sub\u003e\u003c/span\u003e\u003c/strong\u003e for all valid \u003cstrong\u003e\u003cspan\u003e\u003ci\u003ei\u003c/i\u003e\u003c/span\u003e \u003c/strong\u003eand \u003cstrong\u003e\u003cspan\u003e\u003ci\u003ej\u003c/i\u003e\u003c/span\u003e\u003c/strong\u003e.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003e Output a single integer — the number of moments of time from the segment \u003cstrong\u003e\u003cspan\u003e[\u003ci\u003el\u003c/i\u003e, \u003ci\u003er\u003c/i\u003e]\u003c/span\u003e\u003c/strong\u003e which suit for online conversation.\u003c/p\u003e"}},{"title":"Example","value":{"format":"HTML","content":"\u003cdiv\u003e \n \u003cdiv\u003e\n Input\n \u003c/div\u003e \n \u003cpre\u003e\r\n\t1 1 0 4\r\n 2 3\r\n 0 1\r\n\u003c/pre\u003e \n\u003c/div\u003e \n\u003cdiv\u003e \n \u003cdiv\u003e\n Output\n \u003c/div\u003e \n \u003cpre\u003e\r\n\t3\r\n\u003c/pre\u003e \n\u003c/div\u003e \n\u003cdiv\u003e \n \u003cdiv\u003e\n Input\n \u003c/div\u003e \n \u003cpre\u003e\r\n\t2 3 0 20\r\n 15 17\r\n 23 26\r\n 1 4\r\n 7 11\r\n 15 17\r\n\u003c/pre\u003e \n\u003c/div\u003e \n\u003cdiv\u003e \n \u003cdiv\u003e\n Output\n \u003c/div\u003e \n \u003cpre\u003e\r\n\t20\r\n\u003c/pre\u003e \n\u003c/div\u003e"}}]}