calculating quantities