using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    public class Program
    {


        public static void Main(string[] args)
        {
            Program p = new Program();
            var A = int.Parse(System.Console.ReadLine());
            var B = int.Parse(System.Console.ReadLine());
            var C = int.Parse(System.Console.ReadLine());
            var X = int.Parse(System.Console.ReadLine());

            var AMax = (int)Math.Floor(X / 500.0);
            var BMax = new Int32();
            var CMax = new Int32();
            var Counter = 0;


            if (AMax > A)
            {
                for (int i = A; i >= 0; i--)
                {
                    BMax = (int)Math.Floor((X - i * 500.0) / 100.0);
                    if (BMax > B)
                    {
                        for (int j = B; j >= 0; j--)
                        {
                            if ((X - i * 500 - j * 100) / 50 <= C)
                            {
                                Counter++;
                            }
                            else if ((X - i * 500 - j * 100) / 50 > C)
                            {
                                break;
                            }
                        }

                    }
                    else
                    {
                        for (int j = BMax; j >= 0; j--)
                        {
                            if ((X - i * 500 - j * 100) / 50 <= C)
                            {
                                Counter++;
                            }
                            else if ((X - i * 500 - j * 100) / 50 > C)
                            {
                                break;
                            }

                        }
                    }
                }
            }
            else
            {
                for (int i = AMax; i >= 0; i--)
                {
                    BMax = (int)Math.Floor((X - i * 500.0) / 100.0);
                    if (BMax > B)
                    {
                        for (int j = B; j >= 0; j--)
                        {
                            if ((X - i * 500 - j * 100) / 50 <= C)
                            {
                                Counter++;
                            }
                            else if ((X - i * 500 - j * 100) / 50 > C)
                            {
                                break;
                            }
                        }

                    }
                    else
                    {
                        for (int j = BMax; j >= 0; j--)
                        {
                            if ((X - i * 500 - j * 100) / 50 <= C)
                            {
                                Counter++;
                            }
                            else if ((X - i * 500 - j * 100) / 50 > C)
                            {
                                break;
                            }
                        }
                    }
                }
            }

            System.Console.WriteLine(Counter.ToString());

        }


    }
}

Measured memory_bytes: 13140