import java.util.Scanner; public class Main { @SuppressWarnings("resource") public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int n=scanner.nextInt(); int a=scanner.nextInt(); int b=scanner.nextInt(); int c=scanner.nextInt(); long ab=n/(a*b); long ac=n/(a*c); long bc=n/(b*c); long abc=n/(a*b*c); long na=n/a; long nb=n/b; long nc=n/c; if(b%a==0){ ab=0; bc=0; abc=0; nb=0; } if(c%a==0||c%b==0){ ac=0; bc=0; abc=0; nc=0; } System.out.println(na+nb+nc-(ab+ac+bc-abc)); } }