EVALUATING FUNCTIONS why is this code failing?i am getting right output

import java.util.*;
import java.math.*;
import static java.lang.System.out;
public final class isc
{
	public static void main(String args[])
	{
        Scanner sc = new Scanner(System.in);
		String n = sc.next();

		// x
        BigInteger x = new BigInteger(n);
        
		BigInteger a = new BigInteger("4");
        
		BigInteger b = new BigInteger("5");
        
		BigInteger c = new BigInteger("6");
        
		BigInteger d = new BigInteger("14");

		// x^3
        BigInteger x3 = x.pow(3);

		// x^2
        BigInteger x2 = x.pow(2);

		// (4*x^3)
        a.multiply(x3);

		// (5*x^2)
        b.multiply(x2);

		// (6*x)
        c.multiply(x);

		// (4*x^3) + (5*x^2)
        BigInteger ans = a.add(b);

        // (4*x^3) + (5*x^2) - (6*x)
		ans = ans.subtract(c);

		// (4*x^3) + (5*x^2) - (6*x) + 14
        ans = ans.add(d);

        out.println(ans);
	}
}