Modify calculating logic