Evaluate 3(x^2-1)-(x^2-7x+10)