{"raw_statement":[{"iden":"statement","content":"Home Computer\n\nYou are programming your home computer. You want your computer to learn Calculus, so today you decide to write a computer program to calculate the derivative of a polynomial function.\n\nThe derivative of a \"power function\" $x^n$ is defined as $n x^(n -1)$. For example, the derivative of $x^5$ would be $5 x^4$. \n\nThe derivative of a constant multiple of a power function $k x^n$ is defined as $k n x^(n -1)$. For example, the derivative of $3 x^4$ would be $12 x^3$.\n\nWhen taking the derivative of several terms added or subtracted to each other, you take the derivative of each term individually. For example, the derivative of $3 x^5 -5 x^4$ would be $15 x^4 -20 x^3$.\n\nThe \"power rule\" described above works intuitively if all terms have at least a degree of two (the number that $x$ is taken to the power of). For terms with a degree of one, such as $7 x$, the derivative is just the constant multiple in front of $x$, which is $7$ for this example. For constant terms (with a degree of zero), the derivative is zero, and can be cancelled out.\n\nUsing this knowledge, your task is to write a program to determine the derivative of a given polynomial function.\n\nThe only line of input contains a polynomial function. Each term in the polynomial function will be separated either by \" + \" or \" - \" (with a space on either side). See the example inputs to further understand the formatting. Additionally, you are guaranteed that the first term in the polynomial is not a constant.\n\nOutput a single line, consisting of a polynomial, in the format described above: the derivative of the given polynomial function.\n\nIf you're using Java, take in the line of input, and use the .split(\" \") command to separate it by spaces, rather than using scn.nextInt() or something similar.\n\n"},{"iden":"input","content":"The only line of input contains a polynomial function. Each term in the polynomial function will be separated either by \" + \" or \" - \" (with a space on either side). See the example inputs to further understand the formatting. Additionally, you are guaranteed that the first term in the polynomial is not a constant."},{"iden":"output","content":"Output a single line, consisting of a polynomial, in the format described above: the derivative of the given polynomial function."},{"iden":"examples","content":"Input5x^5 + 3x^4 + 2x^3 + 8x^2 + 9x + 10\nOutput25x^4 + 12x^3 + 6x^2 + 16x + 9\nInputx + 10 + 3x + 5 + 8x + 16x^7 + 8x^30 + 300x^200\nOutput1 + 3 + 8 + 112x^6 + 240x^29 + 60000x^199\n"},{"iden":"note","content":"If you're using Java, take in the line of input, and use the .split(\" \") command to separate it by spaces, rather than using scn.nextInt() or something similar."}],"translated_statement":null,"sample_group":[],"show_order":[],"formal_statement":"**Definitions**  \nLet $ P(x) = \\sum_{i=1}^{m} c_i x^{d_i} $ be a polynomial, where each term $ c_i x^{d_i} $ is separated by \" + \" or \" - \", with $ c_i \\in \\mathbb{R} \\setminus \\{0\\} $, $ d_i \\in \\mathbb{Z}_{\\geq 0} $, and $ d_1 > d_2 > \\dots > d_m \\geq 0 $. The sign of each term is determined by the preceding operator (\" + \" for positive, \" - \" for negative).\n\n**Constraints**  \n1. The input is a single line representing $ P(x) $ in standard form with terms separated by \" + \" or \" - \".  \n2. The first term is non-constant: $ d_1 \\geq 1 $.  \n3. Coefficients $ c_i $ and exponents $ d_i $ are integers.  \n4. Exponents are non-increasing: $ d_i \\geq d_{i+1} $.  \n5. No term has exponent less than 0.  \n\n**Objective**  \nCompute the derivative $ P'(x) = \\sum_{i=1}^{m} \\frac{d}{dx}(c_i x^{d_i}) $.  \nFor each term:  \n- If $ d_i = 0 $, derivative is 0 (omit).  \n- If $ d_i = 1 $, derivative is $ c_i $.  \n- If $ d_i \\geq 2 $, derivative is $ c_i \\cdot d_i \\cdot x^{d_i - 1} $.  \n\nOutput $ P'(x) $ as a string with terms separated by \" + \" or \" - \", omitting zero terms, and formatting coefficients and exponents as integers without unnecessary symbols (e.g., no $ x^0 $, no coefficient 1 unless constant).","simple_statement":"Given a polynomial, compute and print its derivative using the power rule.","has_page_source":false}