import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner koko = new Scanner(System.in); long[] x = new long[3]; long[] y = new long[3]; for(int i=0; i<3; i++){ x[i]=koko.nextInt(); y[i]=koko.nextInt(); } long koubai = y[0]*y[1]/gcd(y[0],y[1]); long kouho = 0; long kuri = koubai/y[0]; boolean ichi = false; for(long i=0; i