import java.io.*;
import java.util.*;
public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int fihundred = x / 500;
		while(fihundred > a) {
			fihundred--;
		}
		int largest = b * 100 + c * 50;
	    int count = 0;
	    for(int i = fihundred; i >= 0; i--) {
	    		int money = x - i * 500;
	    		if(money > largest) {
	    			System.out.println(count);
	    			return;
	    		}
	    		int hundred1 = money / 100;
	    		int fifty1 = money % 100 / 50;
	    		while(hundred1 > b) {
	    			hundred1--;
	    			fifty1 += 2;
	    		}
	    		if(fifty1 > c) {
	    			System.out.println(count);
	    			return;
	    		}
	    		count++;
	    		while(hundred1 > 0) {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		}
	    }
	    System.out.println(count);
	}
} import java.io.*; io.* java import java.util.*; util.* java public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int fihundred = x / 500;
		while(fihundred > a) {
			fihundred--;
		}
		int largest = b * 100 + c * 50;
	    int count = 0;
	    for(int i = fihundred; i >= 0; i--) {
	    		int money = x - i * 500;
	    		if(money > largest) {
	    			System.out.println(count);
	    			return;
	    		}
	    		int hundred1 = money / 100;
	    		int fifty1 = money % 100 / 50;
	    		while(hundred1 > b) {
	    			hundred1--;
	    			fifty1 += 2;
	    		}
	    		if(fifty1 > c) {
	    			System.out.println(count);
	    			return;
	    		}
	    		count++;
	    		while(hundred1 > 0) {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		}
	    }
	    System.out.println(count);
	}
} Main public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int fihundred = x / 500;
		while(fihundred > a) {
			fihundred--;
		}
		int largest = b * 100 + c * 50;
	    int count = 0;
	    for(int i = fihundred; i >= 0; i--) {
	    		int money = x - i * 500;
	    		if(money > largest) {
	    			System.out.println(count);
	    			return;
	    		}
	    		int hundred1 = money / 100;
	    		int fifty1 = money % 100 / 50;
	    		while(hundred1 > b) {
	    			hundred1--;
	    			fifty1 += 2;
	    		}
	    		if(fifty1 > c) {
	    			System.out.println(count);
	    			return;
	    		}
	    		count++;
	    		while(hundred1 > 0) {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		}
	    }
	    System.out.println(count);
	} main {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int fihundred = x / 500;
		while(fihundred > a) {
			fihundred--;
		}
		int largest = b * 100 + c * 50;
	    int count = 0;
	    for(int i = fihundred; i >= 0; i--) {
	    		int money = x - i * 500;
	    		if(money > largest) {
	    			System.out.println(count);
	    			return;
	    		}
	    		int hundred1 = money / 100;
	    		int fifty1 = money % 100 / 50;
	    		while(hundred1 > b) {
	    			hundred1--;
	    			fifty1 += 2;
	    		}
	    		if(fifty1 > c) {
	    			System.out.println(count);
	    			return;
	    		}
	    		count++;
	    		while(hundred1 > 0) {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		}
	    }
	    System.out.println(count);
	} Scanner sc = new Scanner(System.in); sc new Scanner(System.in) int a = sc.nextInt(); a sc.nextInt() sc.nextInt sc int b = sc.nextInt(); b sc.nextInt() sc.nextInt sc int c = sc.nextInt(); c sc.nextInt() sc.nextInt sc int x = sc.nextInt(); x sc.nextInt() sc.nextInt sc int fihundred = x / 500; fihundred x / 500 x 500 while(fihundred > a) {
			fihundred--;
		} fihundred > a fihundred a {
			fihundred--;
		} fihundred-- fihundred int largest = b * 100 + c * 50; largest b * 100 + c * 50 b * 100 b 100 c * 50 c 50 int count = 0; count 0 for(int i = fihundred; i >= 0; i--) {
	    		int money = x - i * 500;
	    		if(money > largest) {
	    			System.out.println(count);
	    			return;
	    		}
	    		int hundred1 = money / 100;
	    		int fifty1 = money % 100 / 50;
	    		while(hundred1 > b) {
	    			hundred1--;
	    			fifty1 += 2;
	    		}
	    		if(fifty1 > c) {
	    			System.out.println(count);
	    			return;
	    		}
	    		count++;
	    		while(hundred1 > 0) {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		}
	    } int i = fihundred; int i = fihundred; i fihundred i >= 0 i 0 i-- i-- i {
	    		int money = x - i * 500;
	    		if(money > largest) {
	    			System.out.println(count);
	    			return;
	    		}
	    		int hundred1 = money / 100;
	    		int fifty1 = money % 100 / 50;
	    		while(hundred1 > b) {
	    			hundred1--;
	    			fifty1 += 2;
	    		}
	    		if(fifty1 > c) {
	    			System.out.println(count);
	    			return;
	    		}
	    		count++;
	    		while(hundred1 > 0) {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		}
	    } {
	    		int money = x - i * 500;
	    		if(money > largest) {
	    			System.out.println(count);
	    			return;
	    		}
	    		int hundred1 = money / 100;
	    		int fifty1 = money % 100 / 50;
	    		while(hundred1 > b) {
	    			hundred1--;
	    			fifty1 += 2;
	    		}
	    		if(fifty1 > c) {
	    			System.out.println(count);
	    			return;
	    		}
	    		count++;
	    		while(hundred1 > 0) {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		}
	    } int money = x - i * 500; money x - i * 500 x i * 500 i 500 if(money > largest) {
	    			System.out.println(count);
	    			return;
	    		} money > largest money largest {
	    			System.out.println(count);
	    			return;
	    		} System.out.println(count) System.out.println System.out System System.out count return; int hundred1 = money / 100; hundred1 money / 100 money 100 int fifty1 = money % 100 / 50; fifty1 money % 100 / 50 money % 100 money 100 50 while(hundred1 > b) {
	    			hundred1--;
	    			fifty1 += 2;
	    		} hundred1 > b hundred1 b {
	    			hundred1--;
	    			fifty1 += 2;
	    		} hundred1-- hundred1 fifty1 += 2 fifty1 2 if(fifty1 > c) {
	    			System.out.println(count);
	    			return;
	    		} fifty1 > c fifty1 c {
	    			System.out.println(count);
	    			return;
	    		} System.out.println(count) System.out.println System.out System System.out count return; count++ count while(hundred1 > 0) {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		} hundred1 > 0 hundred1 0 {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		} hundred1-- hundred1 fifty1 += 2 fifty1 2 if(fifty1 > c) break;
	    			else {

	    				count++;
	    			} fifty1 > c fifty1 c break; {

	    				count++;
	    			} count++ count System.out.println(count) System.out.println System.out System System.out count String[] args args public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int fihundred = x / 500;
		while(fihundred > a) {
			fihundred--;
		}
		int largest = b * 100 + c * 50;
	    int count = 0;
	    for(int i = fihundred; i >= 0; i--) {
	    		int money = x - i * 500;
	    		if(money > largest) {
	    			System.out.println(count);
	    			return;
	    		}
	    		int hundred1 = money / 100;
	    		int fifty1 = money % 100 / 50;
	    		while(hundred1 > b) {
	    			hundred1--;
	    			fifty1 += 2;
	    		}
	    		if(fifty1 > c) {
	    			System.out.println(count);
	    			return;
	    		}
	    		count++;
	    		while(hundred1 > 0) {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		}
	    }
	    System.out.println(count);
	}
} public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int fihundred = x / 500;
		while(fihundred > a) {
			fihundred--;
		}
		int largest = b * 100 + c * 50;
	    int count = 0;
	    for(int i = fihundred; i >= 0; i--) {
	    		int money = x - i * 500;
	    		if(money > largest) {
	    			System.out.println(count);
	    			return;
	    		}
	    		int hundred1 = money / 100;
	    		int fifty1 = money % 100 / 50;
	    		while(hundred1 > b) {
	    			hundred1--;
	    			fifty1 += 2;
	    		}
	    		if(fifty1 > c) {
	    			System.out.println(count);
	    			return;
	    		}
	    		count++;
	    		while(hundred1 > 0) {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		}
	    }
	    System.out.println(count);
	}
} Main
import java.io.*;
import java.util.*;
public class Main { // "Main" should be used for most online judges
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int x = sc.nextInt();
		int fihundred = x / 500;
		while(fihundred > a) {
			fihundred--;
		}
		int largest = b * 100 + c * 50;
	    int count = 0;
	    for(int i = fihundred; i >= 0; i--) {
	    		int money = x - i * 500;
	    		if(money > largest) {
	    			System.out.println(count);
	    			return;
	    		}
	    		int hundred1 = money / 100;
	    		int fifty1 = money % 100 / 50;
	    		while(hundred1 > b) {
	    			hundred1--;
	    			fifty1 += 2;
	    		}
	    		if(fifty1 > c) {
	    			System.out.println(count);
	    			return;
	    		}
	    		count++;
	    		while(hundred1 > 0) {
	    			hundred1--;
	    			fifty1 += 2;
	    			if(fifty1 > c) break;
	    			else {

	    				count++;
	    			}
	    		}
	    }
	    System.out.println(count);
	}
}