import java.io.*; //must import file package
public class moblie
{
    public static void main (String[] args) throws IOException  //must have throws IOException to make files works
    {
	BufferedReader in = new BufferedReader (new FileReader ("DATA1.txt")); 
	PrintWriter out = new PrintWriter (new FileWriter ("OUT1.txt")); 
	String str;
	for (int i = 0 ; i < 5 ; i++)
	{
	    str = in.readLine ();

	    double num = Integer.parseInt (str);
	    int answer = (int)(num / (0.99 * 0.7));
	    double temp=answer*0.99*0.7;
	    if (temp<num)
	    answer++;
	int x;
	int q;
	q=answer/1000;
	x=answer%1000;
	if (x>0) q++;
	q=q*1000;
	out.println(q);
	}
	out.close ();
    }
}

