import java.util.Scanner;
import java.lang.*;

public class Main {
  public static int count = 0;

  public static void counter(int fh, int hd, int ft, int goal) {
    int maxFH = Math.min(goal / 500, fh);
    for (int i = 0; i <= maxFH; i++) {
        int postFH = goal - i * 500;
        int maxHD = 0;
        if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        }
        for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        }
    }
  }

  public static void main(String[] args) {
    Scanner dataScanner = new Scanner(System.in);
    int fiveHundred = Integer.parseInt(dataScanner.nextLine());
    int hundred = Integer.parseInt(dataScanner.nextLine());
    int fifty = Integer.parseInt(dataScanner.nextLine());
    int goal = Integer.parseInt(dataScanner.nextLine());
    counter(fiveHundred, hundred, fifty, goal);
    System.out.println(count);
  }
} import java.util.Scanner; Scanner java.util import java.lang.*; lang.* java public class Main {
  public static int count = 0;

  public static void counter(int fh, int hd, int ft, int goal) {
    int maxFH = Math.min(goal / 500, fh);
    for (int i = 0; i <= maxFH; i++) {
        int postFH = goal - i * 500;
        int maxHD = 0;
        if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        }
        for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        }
    }
  }

  public static void main(String[] args) {
    Scanner dataScanner = new Scanner(System.in);
    int fiveHundred = Integer.parseInt(dataScanner.nextLine());
    int hundred = Integer.parseInt(dataScanner.nextLine());
    int fifty = Integer.parseInt(dataScanner.nextLine());
    int goal = Integer.parseInt(dataScanner.nextLine());
    counter(fiveHundred, hundred, fifty, goal);
    System.out.println(count);
  }
} Main public static int count = 0; count 0 public static void counter(int fh, int hd, int ft, int goal) {
    int maxFH = Math.min(goal / 500, fh);
    for (int i = 0; i <= maxFH; i++) {
        int postFH = goal - i * 500;
        int maxHD = 0;
        if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        }
        for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        }
    }
  } counter {
    int maxFH = Math.min(goal / 500, fh);
    for (int i = 0; i <= maxFH; i++) {
        int postFH = goal - i * 500;
        int maxHD = 0;
        if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        }
        for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        }
    }
  } int maxFH = Math.min(goal / 500, fh); maxFH Math.min(goal / 500, fh) Math.min Math goal / 500 goal 500 fh for (int i = 0; i <= maxFH; i++) {
        int postFH = goal - i * 500;
        int maxHD = 0;
        if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        }
        for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        }
    } int i = 0; int i = 0; i 0 i <= maxFH i maxFH i++ i++ i {
        int postFH = goal - i * 500;
        int maxHD = 0;
        if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        }
        for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        }
    } {
        int postFH = goal - i * 500;
        int maxHD = 0;
        if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        }
        for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        }
    } int postFH = goal - i * 500; postFH goal - i * 500 goal i * 500 i 500 int maxHD = 0; maxHD 0 if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        } postFH > 0 postFH 0 {
            maxHD = Math.min(postFH / 100, hd);
        } maxHD = Math.min(postFH / 100, hd) maxHD Math.min(postFH / 100, hd) Math.min Math postFH / 100 postFH 100 hd for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        } int j = 0; int j = 0; j 0 j <= maxHD j maxHD j++ j++ j {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        } {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        } int postHD = postFH - j * 100; postHD postFH - j * 100 postFH j * 100 j 100 int maxFT = 0; maxFT 0 if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            } postHD > 0 postHD 0 {
                maxFT = Math.min(postHD / 50, ft);
            } maxFT = Math.min(postHD / 50, ft) maxFT Math.min(postHD / 50, ft) Math.min Math postHD / 50 postHD 50 ft for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            } int k = 0; int k = 0; k 0 k <= maxFT k maxFT k++ k++ k {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            } {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            } int remainder = postHD - k * 50; remainder postHD - k * 50 postHD k * 50 k 50 if (remainder == 0) count++; remainder == 0 remainder 0 count++ count int fh fh int hd hd int ft ft int goal goal public static void main(String[] args) {
    Scanner dataScanner = new Scanner(System.in);
    int fiveHundred = Integer.parseInt(dataScanner.nextLine());
    int hundred = Integer.parseInt(dataScanner.nextLine());
    int fifty = Integer.parseInt(dataScanner.nextLine());
    int goal = Integer.parseInt(dataScanner.nextLine());
    counter(fiveHundred, hundred, fifty, goal);
    System.out.println(count);
  } main {
    Scanner dataScanner = new Scanner(System.in);
    int fiveHundred = Integer.parseInt(dataScanner.nextLine());
    int hundred = Integer.parseInt(dataScanner.nextLine());
    int fifty = Integer.parseInt(dataScanner.nextLine());
    int goal = Integer.parseInt(dataScanner.nextLine());
    counter(fiveHundred, hundred, fifty, goal);
    System.out.println(count);
  } Scanner dataScanner = new Scanner(System.in); dataScanner new Scanner(System.in) int fiveHundred = Integer.parseInt(dataScanner.nextLine()); fiveHundred Integer.parseInt(dataScanner.nextLine()) Integer.parseInt Integer dataScanner.nextLine() dataScanner.nextLine dataScanner int hundred = Integer.parseInt(dataScanner.nextLine()); hundred Integer.parseInt(dataScanner.nextLine()) Integer.parseInt Integer dataScanner.nextLine() dataScanner.nextLine dataScanner int fifty = Integer.parseInt(dataScanner.nextLine()); fifty Integer.parseInt(dataScanner.nextLine()) Integer.parseInt Integer dataScanner.nextLine() dataScanner.nextLine dataScanner int goal = Integer.parseInt(dataScanner.nextLine()); goal Integer.parseInt(dataScanner.nextLine()) Integer.parseInt Integer dataScanner.nextLine() dataScanner.nextLine dataScanner counter(fiveHundred, hundred, fifty, goal) counter fiveHundred hundred fifty goal System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main {
  public static int count = 0;

  public static void counter(int fh, int hd, int ft, int goal) {
    int maxFH = Math.min(goal / 500, fh);
    for (int i = 0; i <= maxFH; i++) {
        int postFH = goal - i * 500;
        int maxHD = 0;
        if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        }
        for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        }
    }
  }

  public static void main(String[] args) {
    Scanner dataScanner = new Scanner(System.in);
    int fiveHundred = Integer.parseInt(dataScanner.nextLine());
    int hundred = Integer.parseInt(dataScanner.nextLine());
    int fifty = Integer.parseInt(dataScanner.nextLine());
    int goal = Integer.parseInt(dataScanner.nextLine());
    counter(fiveHundred, hundred, fifty, goal);
    System.out.println(count);
  }
} public class Main {
  public static int count = 0;

  public static void counter(int fh, int hd, int ft, int goal) {
    int maxFH = Math.min(goal / 500, fh);
    for (int i = 0; i <= maxFH; i++) {
        int postFH = goal - i * 500;
        int maxHD = 0;
        if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        }
        for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        }
    }
  }

  public static void main(String[] args) {
    Scanner dataScanner = new Scanner(System.in);
    int fiveHundred = Integer.parseInt(dataScanner.nextLine());
    int hundred = Integer.parseInt(dataScanner.nextLine());
    int fifty = Integer.parseInt(dataScanner.nextLine());
    int goal = Integer.parseInt(dataScanner.nextLine());
    counter(fiveHundred, hundred, fifty, goal);
    System.out.println(count);
  }
} Main
import java.util.Scanner;
import java.lang.*;

public class Main {
  public static int count = 0;

  public static void counter(int fh, int hd, int ft, int goal) {
    int maxFH = Math.min(goal / 500, fh);
    for (int i = 0; i <= maxFH; i++) {
        int postFH = goal - i * 500;
        int maxHD = 0;
        if (postFH > 0) {
            maxHD = Math.min(postFH / 100, hd);
        }
        for (int j = 0; j <= maxHD; j++) {
            int postHD = postFH - j * 100;
            int maxFT = 0;
            if (postHD > 0) {
                maxFT = Math.min(postHD / 50, ft);
            }
            for (int k = 0; k <= maxFT; k++) {
                int remainder = postHD - k * 50;
                if (remainder == 0) count++;
            }
        }
    }
  }

  public static void main(String[] args) {
    Scanner dataScanner = new Scanner(System.in);
    int fiveHundred = Integer.parseInt(dataScanner.nextLine());
    int hundred = Integer.parseInt(dataScanner.nextLine());
    int fifty = Integer.parseInt(dataScanner.nextLine());
    int goal = Integer.parseInt(dataScanner.nextLine());
    counter(fiveHundred, hundred, fifty, goal);
    System.out.println(count);
  }
}
