package no1xxx; import java.io.PrintWriter; import java.util.Arrays; import java.util.Scanner; public class No1152 { static Scanner in; static PrintWriter out; static String INPUT = ""; static int[] dec(int x) { int mx = 0, my = 0; while(x % 2 == 0){ x /= 2; mx++; } while(x % 5 == 0){ x /= 5; my++; } return new int[]{mx, my}; } static int enc(int[] a) { int ret = 1; for(int i = 0;i < a[0];i++)ret *= 2; for(int i = 0;i < a[1];i++)ret *= 5; return ret; } static void solve() { int x1 = ni(); while(true){ int x2 = ni(); if(x1 == x2)break; int[] my = dec(x1); int[] en = dec(x2); if(Math.abs(my[0] - en[0]) >= Math.abs(my[1] - en[1])){ if(my[0] < en[0]){ my[0]++; }else{ my[0]--; } }else{ if(my[1] < en[1]){ my[1]++; }else{ my[1]--; } } int to = enc(my); out.println(to); out.flush(); if(to == x2)break; x1 = to; } } public static void main(String[] args) throws Exception { in = INPUT.isEmpty() ? new Scanner(System.in) : new Scanner(INPUT); out = new PrintWriter(System.out); solve(); out.flush(); } static int ni() { return Integer.parseInt(in.next()); } static long nl() { return Long.parseLong(in.next()); } static double nd() { return Double.parseDouble(in.next()); } static void tr(Object... o) { if(INPUT.length() != 0)System.out.println(Arrays.deepToString(o)); } }