import java.util.Scanner; 
import java.text.*;

public class savings{
	public static void main(String[] args){
		Scanner input = new Scanner(System.in);
		DecimalFormat df = new DecimalFormat("#.##");

		double leftOver = 0; // How much money are you short if you don't save enough
		double numWeeks = 0; // How many weeks did you save for over all

		// what is the users financial goal
		// how many years do you want to take to reach your goal
		System.out.println("Input the amount you want to save");
		double financialGoal = input.nextDouble();


		System.out.println("How many years will you save for");
		int goalYears = input.nextInt();

		// how much money do you have in savings
		// how much do you want to save each week
		System.out.println("How much money do you currently have in savings");
		double currentSavings = input.nextDouble();

		System.out.println("How much will you put away each week");
		double planToSave = input.nextDouble();

		// calculate the amount of savings
		// there are 52 weeks in a year, so 		
		// apply a 1.5 percent interest rate 
		for (int i = 0; i < goalYears; i++ ) {
			currentSavings = currentSavings + (planToSave * 52);
			currentSavings = currentSavings + (currentSavings * .015);		
		}

		
		// compare it to the requested goal 
		if (currentSavings >= financialGoal){
			System.out.println("Congratulations, you are well on your way to financial freedom!");
			System.out.println("At the end of " + goalYears + " years, you will have " + df.format(currentSavings) + " dollars.");
		}
      else{
      	numWeeks = goalYears * 52;
      	leftOver = (financialGoal - currentSavings)/numWeeks;
         System.out.println("You will never make it at this rate, you need to save " + df.format(leftOver) + " more each week in order to meet your goal");
		}

	}
}