{"trustable":true,"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\u003eThere are $$$n$$$ TV shows you want to watch. Suppose the whole time is split into equal parts called \"minutes\". The $$$i$$$-th of the shows is going from $$$l_i$$$-th to $$$r_i$$$-th minute, both ends inclusive.\u003c/p\u003e\u003cp\u003eYou need a TV to watch a TV show and you can\u0027t watch two TV shows which air at the same time on the same TV, so it is possible you will need multiple TVs in some minutes. For example, if segments $$$[l_i, r_i]$$$ and $$$[l_j, r_j]$$$ intersect, then shows $$$i$$$ and $$$j$$$ can\u0027t be watched simultaneously on one TV.\u003c/p\u003e\u003cp\u003eOnce you start watching a show on some TV it is not possible to \"move\" it to another TV (since it would be too distracting), or to watch another show on the same TV until this show ends.\u003c/p\u003e\u003cp\u003eThere is a TV Rental shop near you. It rents a TV for $$$x$$$ rupees, and charges $$$y$$$ ($$$y \u0026lt; x$$$) rupees for every extra minute you keep the TV. So in order to rent a TV for minutes $$$[a; b]$$$ you will need to pay $$$x + y \\cdot (b - a)$$$. \u003c/p\u003e\u003cp\u003eYou can assume, that taking and returning of the TV doesn\u0027t take any time and doesn\u0027t distract from watching other TV shows. Find the minimum possible cost to view all shows. Since this value could be too large, print it modulo $$$10^9 + 7$$$.\u003c/p\u003e"}},{"title":"Input","value":{"format":"HTML","content":"\u003cp\u003eThe first line contains integers $$$n$$$, $$$x$$$ and $$$y$$$ ($$$1 \\le n \\le 10^5$$$, $$$1 \\le y \u0026lt; x \\le 10^9$$$)\u0026nbsp;— the number of TV shows, the cost to rent a TV for the first minute and the cost to rent a TV for every subsequent minute.\u003c/p\u003e\u003cp\u003eEach of the next $$$n$$$ lines contains two integers $$$l_i$$$ and $$$r_i$$$ ($$$1 \\le l_i \\le r_i \\le 10^9$$$) denoting the start and the end minute of the $$$i$$$-th TV show.\u003c/p\u003e"}},{"title":"Output","value":{"format":"HTML","content":"\u003cp\u003ePrint exactly one integer\u0026nbsp;— the minimum cost to view all the shows taken modulo $$$10^9 + 7$$$.\u003c/p\u003e"}},{"title":"Examples","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\u003e5 4 3\n1 2\n4 10\n2 4\n10 11\n5 9\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e60\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","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\u003e6 3 2\n8 20\n6 22\n4 15\n20 28\n17 25\n20 27\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e142\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}},{"title":"","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\u003e2 1000000000 2\n1 2\n2 3\n\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e999999997\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\u003eIn the first example, the optimal strategy would be to rent $$$3$$$ TVs to watch:\u003c/p\u003e\u003cul\u003e \u003cli\u003e Show $$$[1, 2]$$$ on the first TV,\u003c/li\u003e\u003cli\u003e Show $$$[4, 10]$$$ on the second TV,\u003c/li\u003e\u003cli\u003e Shows $$$[2, 4], [5, 9], [10, 11]$$$ on the third TV. \u003c/li\u003e\u003c/ul\u003e\u003cp\u003eThis way the cost for the first TV is $$$4 + 3 \\cdot (2 - 1) \u003d 7$$$, for the second is $$$4 + 3 \\cdot (10 - 4) \u003d 22$$$ and for the third is $$$4 + 3 \\cdot (11 - 2) \u003d 31$$$, which gives $$$60$$$ int total.\u003c/p\u003e\u003cp\u003eIn the second example, it is optimal watch each show on a new TV.\u003c/p\u003e\u003cp\u003eIn third example, it is optimal to watch both shows on a new TV. Note that the answer is to be printed modulo $$$10^9 + 7$$$.\u003c/p\u003e"}}]}