least square method formula cost accounting