import java.io.*;
import java.util.Scanner;


public class powrof2 {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		// File to read
		Scanner sc = new Scanner(new FileReader("data2.txt"));
		PrintWriter pw = new PrintWriter(new FileWriter("out2.txt"));

		// Generate all the powers of 2 (less then 65536
		long pow2[] = new long[17];
		for (int i=0; i<pow2.length; i++)
		{
			pow2[i] = (long) Math.pow(2, i);
		}
		
		for (int k=0; k<5; k++)
		{
			int input = sc.nextInt();
			long closest = pow2[0];
			for (int i=1; i<pow2.length; i++)
			{
				if (Math.abs(input - pow2[i]) <= Math.abs(input-closest))
				{
					closest = pow2[i];
				}
			}
			//System.out.println(closest);
			pw.println(closest);
		}
		pw.close();
	}

}

