#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1085
Task: \boxed{} 

</think>

Write a Python function that calculates the next financial milestone toward retirement based on current savings, monthly contributions, and expected annual return rate.
Generated: 2026-02-12T19:45:18.564006
"""

import math

def calculate_next_milestone(current_savings, monthly_contribution, annual_return_rate, target_milestone):
    monthly_return_rate = annual_return_rate / 12 / 100
    months = 0
    savings = current_savings

    while savings < target_milestone:
        savings += monthly_contribution
        savings *= (1 + monthly_return_rate)
        months += 1

    years = months / 12
    return years

if __name__ == '__main__':
    current_savings = 50000
    monthly_contribution = 2000
    annual_return_rate = 7
    target_milestone = 1000000

    years_to_milestone = calculate_next_milestone(current_savings, monthly_contribution, annual_return_rate, target_milestone)
    print(f"Years to reach the financial milestone: {years_to_milestone:.2f} years")