{"trustable":true,"prependHtml":"\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 async src\u003d\"https://mathjax.codeforces.org/MathJax.js?config\u003dTeX-AMS-MML_HTMLorMML\" type\u003d\"text/javascript\"\u003e\u003c/script\u003e","sections":[{"title":"","value":{"format":"HTML","content":"\u003cdiv class\u003d\"panel_content\"\u003ewls 有 n 个二次函数 $F_i$($x$) \u003d $a_i$$x^2$ + $b_i$$x$ + $c_i$ (1 ≤ $i$ ≤ $n$).\\\\现在他想在$\\sum_{i\u003d1}^n$$x_i$ \u003d $m$ 且 $x$ 为正整数的条件下求$\\sum_{i\u003d1}^n$$F_i$($x_i$)的最小值。\u003cbr\u003e请求出这个最小值。\u003c/div\u003e"}},{"title":"Input","value":{"format":"HTML","content":"第一行两个正整数 $n$, $m$。\u003cbr\u003e下面 $n$ 行,每行三个整数 $a$, $b$, $c$ 分别代表二次函数的二次项,\u0026#xc;一次项,常数项系数。\u003cbr\u003e1 ≤ $n$ ≤ $m$ ≤ 100, 000\u003cbr\u003e1 ≤ $a$ ≤ 1, 000\u003cbr\u003e$-$1, 000 ≤ $b$, $c$ ≤ 1, 000"}},{"title":"Output","value":{"format":"HTML","content":"一行一个整数表示答案。"}},{"title":"Sample","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 3\r\n1 1 1\r\n2 2 2\u003c/pre\u003e\u003c/td\u003e\n \u003ctd\u003e\u003cpre\u003e13\u003c/pre\u003e\u003c/td\u003e\n \u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n"}}]}