{"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":"MD","content":"唐哥和夕爷是很好的朋友,有一天唐哥准备去拜访夕爷。夕爷晚上要睡觉,其他时候[l1,r1]时间内是清醒的,但是在第K分钟夕爷会睡着(仅这一分钟)。\n现在唐哥准备在从[l2,r2]时间内拜访夕爷,请问在唐哥拜访夕爷的时候,夕爷清醒的时间是多少。\n"}},{"title":"Input","value":{"format":"MD","content":"输入五个数 l1,r1,l2,r2,k\n[l1,r1] 是夕爷清醒的时间\n[l2,r2] 是唐哥拜访夕爷的时间\nk 表示第k分钟夕爷会睡着\n(1 ≤ l1, r1, l2, r2, k ≤ 1e18, l1 ≤ r1, l2 ≤ r2)"}},{"title":"Output","value":{"format":"MD","content":"输出一行,唐哥在拜访夕爷的时候,夕爷清醒的总时间是多少。"}},{"title":"Examples","value":{"format":"MD","content":"输入:1 10 9 20 1\n输出:2\n\n输入:1 100 50 200 75\n输出:50\n"}},{"title":"Note","value":{"format":"MD","content":"在样例一中,夕爷清醒的时间是[1,10] 但第一分钟会睡着,所以是[2,10] ,唐哥拜访的时间是[9,20] 所以在拜访时间中只有[9,10]夕爷是清醒的\n样例二中,只有[50,74] ,[76,100] 这两段时间夕爷是清醒的,所以总的时间是(74 - 50 + 1) + (100 - 76 + 1) \u003d 50\n注意k不一定在区间[l1,r1]中"}}]}