// The "Prob1" class.
// Aditya Bansal - Aditya
import java.awt.*;
import java.io.*;

public class Prob1
{
    static double profit = 0.693;
    public static void main (String[] args) throws IOException
    {
	BufferedReader in = new BufferedReader (new FileReader ("DATA1.txt"));
	PrintWriter out = new PrintWriter (new FileWriter ("OUT1.txt"));
	String str = "";
	int retain = 0, output = 0;
	double num = 0;
	for (int i = 0 ; i < 5 ; i++)
	{
	    str = in.readLine ();
	    retain = Integer.parseInt (str);
	    if (retain == 0)
	    {
		out.println (0);
	    }
	    else if ((retain % 693) == 0)
	    {
		int x = (int) ((retain / 693) * 1000);
		out.println (x);
	    }
	    else
	    {
		num = retain / profit;
		int x = (int) Math.round (num);
		out.println (x + (1000 - x % 1000));
	    }
	}
	out.close ();
	// Place your program here.  'c' is the output console
    } // main method
} // Prob1 class

