calculate_each method