ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules

1666. Vasya Ferrari

Time limit: 0.5 second
Memory limit: 64 MB
Vasya, nicknamed Ferrari, has to solve an equation of fourth degree with integer coefficients x4+ax3+bx2+cx+d = 0. Vasya wants to factorize the polynomial in the left part of this equation to the maximal possible number of multipliers with integer coefficients to reduce the problem to solving several equations of lower degree.

Input

4 integers: a, b, c, d — the coefficients of the polynomial, with absolute values not exceeding 20000.

Output

If the polynomial can't be factorized to multipliers with integer coefficients, you should output a single line “Irreducible”. In the other case output the factorization of the polynomial as a product of several polynomials with integer coefficients, enclosed in parentheses. You shouldn't delimit the multipliers with spaces and output monomials with zero coefficients. Coefficients and degrees equal to 1 should be omitted, except the monomial “1”.

Samples

inputoutput
0 0 0 0
(x)(x)(x)(x)
-4 -3 24 45
(x2+3x+3)(x2-7x+15)
1 1 1 1
Irreducible
Problem Author: Igor Chevdar
Problem Source: Ural SU Contest. Petrozavodsk Winter Session, January 2008