total calculation