least square method formula cost accounting calculator