------
## 最终结论
```python
def minimum_days_to_repair_highway(T, test_cases):
    results = []
    for case in test_cases:
        n, g, b = case
        # Calculate the minimum number of high-quality days needed
        min_high_quality_days = (n + 1) // 2

        # Calculate full cycles needed to achieve at least min_high_quality_days
        full_cycles_needed = min_high_quality_days // g
        remaining_good_days_needed = min_high_quality_days % g

        # Calculate the total days needed including bad days in full cycles
        total_days = full_cycles_needed * (g + b)
        
        # Add remaining good days if any are needed after full cycles
        if remaining_good_days_needed > 0:
            total_days += remaining_good_days_needed
        else:
            # If no additional good days are needed, subtract the last bad period added
            total_days -= b
        
        # Ensure the total days are at least n since we need to repair all units
        results.append(max(total_days, n))

    return results

# Example usage:
T = 3
test_cases = [
    (5, 1, 1),
    (8, 10, 10),
    (1000000, 1, 1000000)
]
print(minimum_days_to_repair_highway(T, test_cases))
```