import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    System.err.println("コインの数");
    int A, B, C, X;
    do{
      do {
        System.err.print("500円玉：");
        A = stdIn.nextInt();
      } while (A < 0 || A > 50);
      do {
        System.err.print("100円玉：");
        B = stdIn.nextInt();
      } while (B < 0 || B > 50);
      do {
        System.err.print(" 50円玉：");
        C = stdIn.nextInt();
      } while (C < 0 || C > 50);
    } while (A + B + C == 0);

    do {
      System.err.print("X円にする：");
      X = stdIn.nextInt();
    } while (X < 50 || X > 20000);

    int count = 0; int sum = 0;
    for (int i = 0; i <= A ; i++) {
      int a = 500 * i;
      sum = a;
      if (sum > X) {
        break;
      } else if (sum == X) {
        count++;
        break;
      }

      for (int j = 0; j <= B ; j++) {
        int b = 100 * j;
        sum = a + b;
        if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        }

        for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        }
      }
    }

  System.out.println(count);
  }
} import java.util.Scanner; Scanner java.util class Main {
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    System.err.println("コインの数");
    int A, B, C, X;
    do{
      do {
        System.err.print("500円玉：");
        A = stdIn.nextInt();
      } while (A < 0 || A > 50);
      do {
        System.err.print("100円玉：");
        B = stdIn.nextInt();
      } while (B < 0 || B > 50);
      do {
        System.err.print(" 50円玉：");
        C = stdIn.nextInt();
      } while (C < 0 || C > 50);
    } while (A + B + C == 0);

    do {
      System.err.print("X円にする：");
      X = stdIn.nextInt();
    } while (X < 50 || X > 20000);

    int count = 0; int sum = 0;
    for (int i = 0; i <= A ; i++) {
      int a = 500 * i;
      sum = a;
      if (sum > X) {
        break;
      } else if (sum == X) {
        count++;
        break;
      }

      for (int j = 0; j <= B ; j++) {
        int b = 100 * j;
        sum = a + b;
        if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        }

        for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        }
      }
    }

  System.out.println(count);
  }
} Main public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    System.err.println("コインの数");
    int A, B, C, X;
    do{
      do {
        System.err.print("500円玉：");
        A = stdIn.nextInt();
      } while (A < 0 || A > 50);
      do {
        System.err.print("100円玉：");
        B = stdIn.nextInt();
      } while (B < 0 || B > 50);
      do {
        System.err.print(" 50円玉：");
        C = stdIn.nextInt();
      } while (C < 0 || C > 50);
    } while (A + B + C == 0);

    do {
      System.err.print("X円にする：");
      X = stdIn.nextInt();
    } while (X < 50 || X > 20000);

    int count = 0; int sum = 0;
    for (int i = 0; i <= A ; i++) {
      int a = 500 * i;
      sum = a;
      if (sum > X) {
        break;
      } else if (sum == X) {
        count++;
        break;
      }

      for (int j = 0; j <= B ; j++) {
        int b = 100 * j;
        sum = a + b;
        if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        }

        for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        }
      }
    }

  System.out.println(count);
  } main {
    Scanner stdIn = new Scanner(System.in);
    System.err.println("コインの数");
    int A, B, C, X;
    do{
      do {
        System.err.print("500円玉：");
        A = stdIn.nextInt();
      } while (A < 0 || A > 50);
      do {
        System.err.print("100円玉：");
        B = stdIn.nextInt();
      } while (B < 0 || B > 50);
      do {
        System.err.print(" 50円玉：");
        C = stdIn.nextInt();
      } while (C < 0 || C > 50);
    } while (A + B + C == 0);

    do {
      System.err.print("X円にする：");
      X = stdIn.nextInt();
    } while (X < 50 || X > 20000);

    int count = 0; int sum = 0;
    for (int i = 0; i <= A ; i++) {
      int a = 500 * i;
      sum = a;
      if (sum > X) {
        break;
      } else if (sum == X) {
        count++;
        break;
      }

      for (int j = 0; j <= B ; j++) {
        int b = 100 * j;
        sum = a + b;
        if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        }

        for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        }
      }
    }

  System.out.println(count);
  } Scanner stdIn = new Scanner(System.in); stdIn new Scanner(System.in) System.err.println("コインの数") System.err.println System.err System System.err "コインの数" int A A B B C C X; X do{
      do {
        System.err.print("500円玉：");
        A = stdIn.nextInt();
      } while (A < 0 || A > 50);
      do {
        System.err.print("100円玉：");
        B = stdIn.nextInt();
      } while (B < 0 || B > 50);
      do {
        System.err.print(" 50円玉：");
        C = stdIn.nextInt();
      } while (C < 0 || C > 50);
    } while (A + B + C == 0); A + B + C == 0 A + B + C A + B + C A B C 0 {
      do {
        System.err.print("500円玉：");
        A = stdIn.nextInt();
      } while (A < 0 || A > 50);
      do {
        System.err.print("100円玉：");
        B = stdIn.nextInt();
      } while (B < 0 || B > 50);
      do {
        System.err.print(" 50円玉：");
        C = stdIn.nextInt();
      } while (C < 0 || C > 50);
    } do {
        System.err.print("500円玉：");
        A = stdIn.nextInt();
      } while (A < 0 || A > 50); A < 0 || A > 50 A < 0 A 0 A > 50 A 50 {
        System.err.print("500円玉：");
        A = stdIn.nextInt();
      } System.err.print("500円玉：") System.err.print System.err System System.err "500円玉：" A = stdIn.nextInt() A stdIn.nextInt() stdIn.nextInt stdIn do {
        System.err.print("100円玉：");
        B = stdIn.nextInt();
      } while (B < 0 || B > 50); B < 0 || B > 50 B < 0 B 0 B > 50 B 50 {
        System.err.print("100円玉：");
        B = stdIn.nextInt();
      } System.err.print("100円玉：") System.err.print System.err System System.err "100円玉：" B = stdIn.nextInt() B stdIn.nextInt() stdIn.nextInt stdIn do {
        System.err.print(" 50円玉：");
        C = stdIn.nextInt();
      } while (C < 0 || C > 50); C < 0 || C > 50 C < 0 C 0 C > 50 C 50 {
        System.err.print(" 50円玉：");
        C = stdIn.nextInt();
      } System.err.print(" 50円玉：") System.err.print System.err System System.err " 50円玉：" C = stdIn.nextInt() C stdIn.nextInt() stdIn.nextInt stdIn do {
      System.err.print("X円にする：");
      X = stdIn.nextInt();
    } while (X < 50 || X > 20000); X < 50 || X > 20000 X < 50 X 50 X > 20000 X 20000 {
      System.err.print("X円にする：");
      X = stdIn.nextInt();
    } System.err.print("X円にする：") System.err.print System.err System System.err "X円にする：" X = stdIn.nextInt() X stdIn.nextInt() stdIn.nextInt stdIn int count = 0; count 0 int sum = 0; sum 0 for (int i = 0; i <= A ; i++) {
      int a = 500 * i;
      sum = a;
      if (sum > X) {
        break;
      } else if (sum == X) {
        count++;
        break;
      }

      for (int j = 0; j <= B ; j++) {
        int b = 100 * j;
        sum = a + b;
        if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        }

        for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        }
      }
    } int i = 0; int i = 0; i 0 i <= A i A i++ i++ i {
      int a = 500 * i;
      sum = a;
      if (sum > X) {
        break;
      } else if (sum == X) {
        count++;
        break;
      }

      for (int j = 0; j <= B ; j++) {
        int b = 100 * j;
        sum = a + b;
        if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        }

        for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        }
      }
    } {
      int a = 500 * i;
      sum = a;
      if (sum > X) {
        break;
      } else if (sum == X) {
        count++;
        break;
      }

      for (int j = 0; j <= B ; j++) {
        int b = 100 * j;
        sum = a + b;
        if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        }

        for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        }
      }
    } int a = 500 * i; a 500 * i 500 i sum = a sum a if (sum > X) {
        break;
      } else if (sum == X) {
        count++;
        break;
      } sum > X sum X {
        break;
      } break; if (sum == X) {
        count++;
        break;
      } sum == X sum X {
        count++;
        break;
      } count++ count break; for (int j = 0; j <= B ; j++) {
        int b = 100 * j;
        sum = a + b;
        if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        }

        for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        }
      } int j = 0; int j = 0; j 0 j <= B j B j++ j++ j {
        int b = 100 * j;
        sum = a + b;
        if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        }

        for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        }
      } {
        int b = 100 * j;
        sum = a + b;
        if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        }

        for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        }
      } int b = 100 * j; b 100 * j 100 j sum = a + b sum a + b a b if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        } sum > X sum X {
          break;
        } break; if (sum == X) {
          count++;
          break;
        } sum == X sum X {
          count++;
          break;
        } count++ count break; for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        } int k = 0; int k = 0; k 0 k <= C k C k++ k++ k {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        } {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        } int c = 50 * k; c 50 * k 50 k sum = a + b + c sum a + b + c a + b + c a b c if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          } sum > X sum X {
            break;
          } break; if (sum == X) {
            count++;
            break;
          } sum == X sum X {
            count++;
            break;
          } count++ count break; System.out.println(count) System.out.println System.out System System.out count String[] args args
import java.util.Scanner;

class Main {
  public static void main(String[] args) {
    Scanner stdIn = new Scanner(System.in);
    System.err.println("コインの数");
    int A, B, C, X;
    do{
      do {
        System.err.print("500円玉：");
        A = stdIn.nextInt();
      } while (A < 0 || A > 50);
      do {
        System.err.print("100円玉：");
        B = stdIn.nextInt();
      } while (B < 0 || B > 50);
      do {
        System.err.print(" 50円玉：");
        C = stdIn.nextInt();
      } while (C < 0 || C > 50);
    } while (A + B + C == 0);

    do {
      System.err.print("X円にする：");
      X = stdIn.nextInt();
    } while (X < 50 || X > 20000);

    int count = 0; int sum = 0;
    for (int i = 0; i <= A ; i++) {
      int a = 500 * i;
      sum = a;
      if (sum > X) {
        break;
      } else if (sum == X) {
        count++;
        break;
      }

      for (int j = 0; j <= B ; j++) {
        int b = 100 * j;
        sum = a + b;
        if (sum > X) {
          break;
        } else if (sum == X) {
          count++;
          break;
        }

        for (int k = 0; k <= C ; k++) {
          int c = 50 * k;
          sum = a + b + c;
          if (sum > X) {
            break;
          } else if (sum == X) {
            count++;
            break;
          }
        }
      }
    }

  System.out.println(count);
  }
}
