Math for rating system.