reduce calculation