package no280; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int d = sc.nextInt(); int[] h = new int[3]; for(int i=0;i<3;i++) { h[i] = sc.nextInt(); } int[] p = new int[3]; for(int i=0;i<3;i++) { p[i] = i; } int ans = 1 << 29; do { if (p[0] != 1 && p[2] != 1) { continue; } int count = 0; int x = h[p[0]]; for(int i=1;i<3;i++) { if (x == 0) { count = 1 << 29; break; } if (h[p[i]] >= x) { int magic = (h[p[i]] - x) / d + 1; count += magic; x = h[p[i]] - magic * d; }else{ x = h[p[i]]; } } // System.out.println(Arrays.toString(p) + ":" + count); ans = Math.min(ans,count); } while(nextPermutation(p)); if (ans >= 1 << 29) { System.out.println(-1); }else{ System.out.println(ans); } } static boolean nextPermutation(int[] p) { for(int a=p.length-2;a>=0;--a) { if(p[a]p[a]) { int t = p[a]; p[a] = p[b]; p[b] = t; for(++a, b=p.length-1;a