using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using System.Linq;
using System.IO;
using System.Globalization;
using System.Collections;
using System.Text.RegularExpressions;

namespace Task
{

    #region MyIo

    internal class MyIo : IDisposable
    {
        private readonly TextReader inputStream;
        private readonly TextWriter outputStream = Console.Out;

        private string[] tokens;
        private int pointer;

        public MyIo()
#if  LOCAL_TEST
            : this(new StreamReader("input.txt"))
#else
            : this(System.Console.In)
#endif
        {

        }

        public MyIo(TextReader inputStream)
        {
            this.inputStream = inputStream;
        }

        public char NextChar()
        {
            try
            {
                return (char)inputStream.Read();
            }
            catch (IOException)
            {
                return '\0';
            }
        }

        public string NextLine()
        {
            try
            {
                return inputStream.ReadLine();
            }
            catch (IOException)
            {
                return null;
            }
        }

        public string NextString()
        {
            try
            {
                while (tokens == null || pointer >= tokens.Length)
                {
                    tokens = (NextLine() + string.Empty).Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                    pointer = 0;
                }
                return tokens[pointer++];
            }
            catch (IOException)
            {
                return null;
            }
        }

        public int NextInt()
        {
            return Next<int>();
        }

        public long NextLong()
        {
            return Next<long>();
        }

        public T Next<T>()
        {
            var t = typeof(T);

            if (t == typeof(char))
                return (T)(object)NextChar();

            object s = NextString();

            if (t == typeof(string))
                return (T)s;

            return (T)Convert.ChangeType(s, typeof(T));
        }

        public IEnumerable<T> NextWhile<T>(Predicate<T> pred)
        {
            if (pred == null)
                yield break;

            T res = Next<T>();

            while (pred(res))
            {
                yield return res;

                res = Next<T>();
            }
        }

        public IEnumerable<T> NextSeq<T>(long n)
        {
            for (var i = 0; i < n; i++)
                yield return Next<T>();
        }

        public void Print(string format, params object[] args)
        {
            outputStream.Write(string.Format(CultureInfo.InvariantCulture, format, args));
        }

        public void PrintLine(string format, params object[] args)
        {
            Print(format, args);

            outputStream.WriteLine();
        }

        public void Print(bool o)
        {
            Print(o ? "yes" : "no");
        }

        public void PrintLine(bool o)
        {
            Print(o);

            outputStream.WriteLine();
        }

        public void Print<T>(T o)
        {
            outputStream.Write(Convert.ToString(o, CultureInfo.InvariantCulture));
        }

        public void PrintLine<T>(T o)
        {
            Print(o);

            outputStream.WriteLine();
        }

        public void Close()
        {
            inputStream.Close();
            outputStream.Close();
        }

        void IDisposable.Dispose()
        {
            Close();

#if  LOCAL_TEST
            Console.ReadLine();
#endif
        }
    }

    public static class ListExtensions
    {
        public static void Each<T>(this IEnumerable<T> self, Action<T> action)
        {
            foreach (var v in self)
                action(v);
        }

        public static IEnumerable<T> ToCycleEnumerable<T>(this IEnumerable<T> self)
        {
            if (self != null)
            {
                for (; ; )
                {
                    foreach (var x in self)
                        yield return x;
                }
            }
        }

        public static T CycleGet<T>(this IList<T> self, int index)
        {
            var c = self.Count;
            return self[(index % c + c) % c];
        }

        public static IList<T> Shuffle<T>(this IList<T> self)
        {
            var rnd = new Random(DateTime.Now.Millisecond);

            var n = self.Count;

            while (n > 1)
            {
                n--;
                var k = rnd.Next(n + 1);
                var value = self[k];
                self[k] = self[n];
                self[n] = value;
            }

            return self;
        }

        public static IList<IList<T>> UseForNew2D<T>(this T def, int fd, int sd)
        {
            var fdim = new T[fd][];

            for (int i = 0; i < fd; i++)
            {
                fdim[i] = new T[sd];
                Fill(fdim[i], def);
            }

            return fdim;
        }

        public static IList<T> Fill<T>(this IList<T> self, Func<T> fval)
        {
            for (var i = 0; i < self.Count; i++)
                self[i] = fval();

            return self;
        }

        public static IList<T> Fill<T>(this IList<T> self, T val)
        {
            return self.Fill(() => val);
        }

        public static long Hash<T>(this IList<T> self, Func<T, long> val = null)
        {
            return val != null ? self.Hash((t, current) => unchecked(current * 19L + val(t))) : self.Hash(HashOne);
        }

        public static long Hash<T>(this IList<T> self, Func<T, long, long> val)
        {
            return self.Aggregate(0L, (current, t) => unchecked(val(t, current)));
        }

        public static long HashOne<T>(this T self, long current)
        {
            return unchecked(current * 19L + (Equals(self, default(T)) ? 0 : self.GetHashCode()));
        }

        public static IList<T1> BuildSegTree<T1, T2>(this IList<T2> a, Func<T1, T1, T1> combine, Func<T2, T1> convert)
        {
            var t = new T1[a.Count << 2];

            a.BuildSegTree(t, 1, 0, a.Count - 1, combine, convert);

            return t;
        }

        private static void BuildSegTree<T1, T2>(this IList<T2> a, IList<T1> t, int v, int tl, int tr, Func<T1, T1, T1> combine, Func<T2, T1> convert)
        {
            if (tl == tr)
            {
                t[v] = convert(a[tl]);
            }
            else
            {
                int tm = (tl + tr) >> 1;

                BuildSegTree(a, t, v << 1, tl, tm, combine, convert);
                BuildSegTree(a, t, (v << 1) + 1, tm + 1, tr, combine, convert);

                t[v] = combine(t[v << 1], t[(v << 1) + 1]);
            }
        }
    }

    public static class P
    {
        public static P<T1, T2> Create<T1, T2>(T1 key, T2 val)
        {
            return new P<T1, T2>(key, val);
        }
    }

    public class P<T1, T2>
    {
        private class PComparer : IComparer<P<T1, T2>>
        {
            private readonly bool? byKey;

            public PComparer(bool? byKey)
            {
                this.byKey = byKey;
            }

            public int Compare(P<T1, T2> x, P<T1, T2> y)
            {
                x = x ?? new P<T1, T2>();
                y = y ?? new P<T1, T2>();

                if (byKey == true)
                    return Comparer<T1>.Default.Compare(x.Key, y.Key);
                else if (byKey == false)
                    return Comparer<T2>.Default.Compare(x.Value, y.Value);
                else
                {
                    var tr = Comparer<T1>.Default.Compare(x.Key, y.Key);

                    if (tr != 0)
                        tr = Comparer<T2>.Default.Compare(x.Value, y.Value);

                    return tr;
                }
            }
        }

        public P()
        {
        }

        public P(T1 key, T2 val)
        {
            this.Key = key;
            this.Value = val;
        }

        public T1 Key
        {
            get;
            set;
        }

        public T2 Value
        {
            get;
            set;
        }

        public P<T1, T2> Clone()
        {
            return new P<T1, T2>(Key, Value);
        }

        public static IComparer<P<T1, T2>> KeyComparer
        {
            get { return new PComparer(true); }
        }

        public static IComparer<P<T1, T2>> ValueComparer
        {
            get { return new PComparer(false); }
        }

        public static implicit operator T1(P<T1, T2> obj)
        {
            return obj.Key;
        }

        public static implicit operator T2(P<T1, T2> obj)
        {
            return obj.Value;
        }

        public P<T1, T2> SetKey(T1 key)
        {
            Key = key;
            return this;
        }

        public P<T1, T2> SetValue(T2 value)
        {
            Value = value;
            return this;
        }

        public override string ToString()
        {
            return string.Format("Key: {0}, Value: {1}", Key, Value);
        }

        public override bool Equals(object obj)
        {
            var co = obj as P<T1, T2>;

            return co != null && co.GetHashCode() == GetHashCode();
        }

        public override int GetHashCode()
        {
            int hash = 17;
            hash = hash * 31 + ((Equals(Key, default(T1))) ? 0 : Key.GetHashCode());
            hash = hash * 31 + ((Equals(Value, default(T1))) ? 0 : Value.GetHashCode());
            return hash;

        }
    }

    #endregion

    internal class Program
    {
        #region Program

        private readonly MyIo io;

        public Program(MyIo io)
        {
            this.io = io;
        }

        public static void Main(string[] args)
        {
            using (MyIo io = new MyIo())
            {
                new Program(io)
                    .Solve();
            }
        }

        #endregion

        public const long MOD = 1000000007;
        public const double EPS = 1e-14;

        private void Solve()
        {
            var n = io.NextLong();

            var x = io.NextLong();
            var y = io.NextLong();

            var c = io.NextLong();

            long s = 0;

            if (c > 1)
            {

                var ub = (long)Math.Sqrt(1+8*c);
                var lb = Math.Max(ub / 4L - 1L, 0L);

                s = ub;

                do
                {

                    var m = (ub + lb) >> 1;

                    var cn = Calc(n, x, y, m);

                    if (cn >= c)
                    {
                        ub--;
                        s = Math.Min(m, s);
                    }
                    else if (cn < c)
                    {
                        lb++;
                    }

                } while (ub > lb);

            }

            io.Print(s);
        }

        private long Pos0(long x)
        {
            return x > 0 ? x : 0;
        }

        private long Pow2(long x)
        {

            return x*x;
        }

        private long Pow2120(long x)
        {
            x = Pos0(x);

            return x * (x + 1L) / 2;
        }

        private long Calc(long n, long x, long y, long s)
        {

            if (s == 0)
                return 1;

            var r = Pos0(s + y - n);
            var b = Pos0(s + x - n);

            var l = Pos0(1 - y + s);
            var t = Pos0(1 - x + s);

            var ix = 1 + n - x;
            var iy = 1 + n - y;

            var bse = s*s + (s + 1)*(s + 1) - Pow2(r) - Pow2(t) - Pow2(b) - Pow2(l);

            bse += Pow2120(l - x);
            bse += Pow2120(r - x);

            bse += Pow2120(l - ix);
            bse += Pow2120(r - ix);

            return bse;
        }
    }

}


using System;
using System.IO;
using System.Collections.Generic;
using System.Globalization;

namespace first
{
    class MainClass
    {
        // 999999998765257149 10 -> 1414213571
        // 999999998765257152 10 -> 1414213572
        public static long GetRoot(long n, out bool isInt)
        {
            long res = 0;

            long start = Math.Max((long)Math.Sqrt(n) - 5, 1);

            for (long i = start; i < start + 10; i++)
                if (i * i > n)
                {
                    res = i - 1;
                    break;
                }

            isInt = res * res == n;

            return res;
        }

        public static void Main(string[] args)
        {
            //var textReader = new StreamReader(@"D:\Projects\cpp\input.txt");
            //Console.SetIn(textReader);

            var a = Console.ReadLine().Split(' ');
            long n = Convert.ToInt64(a[0]);
            long m = Convert.ToInt64(a[1]);

            //bool isInt;

            //long root = GetRoot(n - m, out isInt);
            //Console.WriteLine(String.Format("root {0}, is int {1}", root, isInt));

            if (n <= m) Console.WriteLine(n);
            else
            {
                long d = 1 + 8 * (n - m);
                bool isRootInt;
                long dRootLong = GetRoot(d, out isRootInt);

                bool intRes = isRootInt && (dRootLong % 2 == 1);

                long k = (dRootLong - 1) / 2;

                //decimal k1 = (dRoot - 1.0m) / 2.0m;
                //long k = (long)(Math.Floor(k1));

                if (!intRes) k++;

                Console.WriteLine(k + m);
            }

            //Console.ReadKey();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;

namespace Codeforces
{
	internal class Template
	{
		private void Solve()
		{
			var n = cin.NextLong();
			var m = cin.NextLong();
			if (m >= n)
			{
				Console.WriteLine(n);
				return;
			}
			var days = m;
			var value = n - m;
			var lo = 0L;
			var hi = 2000000000L;
			while (lo < hi)
			{
				var mid = lo + (hi - lo)/2;
				if (value <= mid*(mid + 1)/2)
				{
					hi = mid;
				}
				else
				{
					lo = mid + 1;
				}
			}
			var result = days + lo;
			Console.WriteLine(result);
		}

		private static readonly Scanner cin = new Scanner();

		private static void Main()
		{
#if DEBUG
			var inputText = File.ReadAllText(@"..\..\input.txt");
			var testCases = inputText.Split(new[] { "input" }, StringSplitOptions.RemoveEmptyEntries);
			var consoleOut = Console.Out;
			for (var i = 0; i < testCases.Length; i++)
			{
				var parts = testCases[i].Split(new[] { "output" }, StringSplitOptions.RemoveEmptyEntries);
				Console.SetIn(new StringReader(parts[0].Trim()));
				var stringWriter = new StringWriter();
				Console.SetOut(stringWriter);
				var sw = Stopwatch.StartNew();
				new Template().Solve();
				sw.Stop();
				var output = stringWriter.ToString();

				Console.SetOut(consoleOut);
				var color = ConsoleColor.Green;
				var status = "Passed";
				if (parts[1].Trim() != output.Trim())
				{
					color = ConsoleColor.Red;
					status = "Failed";
				}
				Console.ForegroundColor = color;
				Console.WriteLine("Test {0} {1} in {2}ms", i + 1, status, sw.ElapsedMilliseconds);
			}
			Console.ReadLine();
			Console.ReadKey();
#else
			new Template().Solve();
			Console.ReadLine();
#endif
		}
	}

	internal class Scanner
	{
		private string[] s = new string[0];
		private int i;
		private readonly char[] cs = { ' ' };

		public string NextString()
		{
			if (i < s.Length) return s[i++];
			var line = Console.ReadLine() ?? string.Empty;
			s = line.Split(cs, StringSplitOptions.RemoveEmptyEntries);
			i = 1;
			return s.First();
		}

		public double NextDouble()
		{
			return double.Parse(NextString());
		}

		public int NextInt()
		{
			return int.Parse(NextString());
		}

		public long NextLong()
		{
			return long.Parse(NextString());
		}
	}
}


using System;
using System.Collections.Generic;
using System.Text;

public class taskA
{
    static void Main(string[] args)
    {
        string inp = Console.ReadLine();
        string[] spl = inp.Split(' ');
        int n, m;
        n = int.Parse(spl[0]);
        m = int.Parse(spl[1]);

        long res = pow(3,n,m);

        res = (res - (long)1+(long)m) % m;

        Console.WriteLine(res);

    }

    private static long pow(int p, int n, int m)
    {
        long res = 0;
        if (n == 0) return 1;

        if ((n % 2) == 0)
        {
            res = pow(p, n / 2, m);
            res = res * res;
            res %= m;

        }
        else
        {
            res = pow(p, n - 1, m);
            res = res * p;
            return res;
        }
        res %= m;
        return res;
    }

}


using System;
using System.IO;
using System.Text;

namespace Flying_Saucer_Segments
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static int mod;

        private static long Pow(long a, int k)
        {
            long r = 1;
            while (k > 0)
            {
                if ((k & 1) == 1)
                {
                    r = (r*a)%mod;
                }
                a = (a*a)%mod;
                k >>= 1;
            }
            return r;
        }

        private static void Main(string[] args)
        {
            int n = Next();
            mod = Next();

            long res = Pow(3, n) - 1;
            if (res < 0)
                res += mod;

            writer.WriteLine(res);
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


using System;
using System.IO;
using System.Text;

namespace Alyona_and_copybooks
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            long n = Next(), a = Next(), b = Next(), c = Next();

            long amount = 0;
            switch (n%4)
            {
                case 0:
                    break;
                case 1:
                    amount = Math.Min(c, Math.Min(a + a + a, a + b));
                    break;
                case 2:
                    amount = Math.Min(b, Math.Min(a + a, c + c));
                    break;
                case 3:
                    amount = Math.Min(a, Math.Min(b + c, c + c + c));
                    break;
            }

            writer.WriteLine(amount);
            writer.Flush();
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}


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

namespace A
{
    class Program
    {
        static long N, A, B, C;

        static long Solve(long N, long A, long B, long C)
        {
            switch (N % 4)
            {
                case 1:
                    return Math.Min(Math.Min(3L * A, C), A + B);

                case 2:
                    return Math.Min(Math.Min(2L * A, B), 2L * C);

                case 3:
                    return Math.Min(Math.Min(A, 3L * C), 3L * B + C);

                default:
                    return 0;
            }
        }

        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            string[] vals = input.Split(' ');
            N = long.Parse(vals[0]);
            A = long.Parse(vals[1]);
            B = long.Parse(vals[2]);
            C = long.Parse(vals[3]);

            //Console.WriteLine(Solve(N, A, B, C));

            long minVal = long.MaxValue;
            for (int i = 0; i <= 10; i++)
            {
                for (int j = 0; j <= 10; j++)
                {
                    for (int k = 0; k <= 10; k++)
                    {
                        if ((N + i + 2 * j + 3 * k) % 4 == 0)
                        {
                            minVal = Math.Min(minVal, A * i + B * j + C * k);
                        }
                    }
                }
            }

            Console.WriteLine(minVal);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.Text;
using System.IO;
using System.Linq;
using System.Threading;

class Program
{

    void solve()
    {
        List<long> nums = new List<long>();
        string s = "";
        for (int i = 0; i < 4; i++)
            nums.Add(nextInt());
        for (int i = 0; i < 3; i++)
            s += nextString();
        long res = get(nums, s);
        println(res);

    }

    private long get(List<long> nums, string s)
    {
        if (nums.Count == 1)
        {
            if (s.Length != 0)
                throw new Exception();
            return nums[0];
        }
        long res = long.MaxValue;
        for(int i=0;i<nums.Count;i++)
            for (int j = i + 1; j < nums.Count; j++)
            {
                List<long> cur = new List<long>(nums);
                cur.RemoveAt(j);
                cur.RemoveAt(i);
                long add;
                if (s[0] == '+')
                    add = nums[i] + nums[j];
                else
                    add = nums[i] * nums[j];
                cur.Add(add);
                res = Math.Min(res, get(cur, s.Substring(1)));
            }
        return res;
    }

    ////////////
    private void println(int[] ar)
    {
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i]);
            else
                print(ar[i] + " ");
        }
    }
    private void println(int[] ar, bool add)
    {
        int A = 0;
        if (add)
            A++;
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i] + A);
            else
                print((ar[i] + A) + " ");
        }
    }

    private void println(string Stringst)
    {
        Console.WriteLine(Stringst);
    }
    private void println(char charnum)
    {
        Console.WriteLine(charnum);
    }
    private void println(int Intnum)
    {
        Console.WriteLine(Intnum);
    }
    private void println(long Longnum)
    {
        Console.WriteLine(Longnum);
    }
    private void println(double Doublenum)
    {
        string s = Doublenum.ToString(CultureInfo.InvariantCulture);
        Console.WriteLine(s);
    }

    private void print(string Stringst)
    {
        Console.Write(Stringst);
    }
    private void print(int Intnum)
    {
        Console.Write(Intnum);
    }
    private void print(char charnum)
    {
        Console.Write(charnum);
    }
    private void print(long Longnum)
    {
        Console.Write(Longnum);
    }
    private void print(double Doublenum)
    {
        Console.Write(Doublenum);
    }

    string[] inputLine = new string[0];
    int inputInd = 0;
    string nextLine()
    {
        return Console.ReadLine();
    }
    void readInput()
    {
        if (inputInd != inputLine.Length)
            throw new Exception();
        inputInd = 0;
        inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        if (inputLine.Length == 0)
            readInput();

    }
    int nextInt()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return int.Parse(inputLine[inputInd++]);
    }
    long nextLong()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return long.Parse(inputLine[inputInd++]);
    }
    double nextDouble()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return double.Parse(inputLine[inputInd++]);
    }
    string nextString()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return inputLine[inputInd++];
    }
    static void Main(string[] args)
    {
        Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        new Program().solve();
    }
}


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

namespace ProgrammingContest.Codeforces.Round51
{
    class B
    {
        public static void Main()
        {
            long[] xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => long.Parse(sss));
            bool[] ops = Array.ConvertAll(Console.ReadLine().Split(' '), sss=>sss=="+");
            long res = long.MaxValue;
            foreach (long[] ys in Permutations(xs))
            {
                long[] ys2 = new long[] { ops[0] ? ys[0] + ys[1] : ys[0] * ys[1], ys[2], ys[3] };
                foreach (long[] zs in Permutations(ys2))
                {
                    long tmp = 0;
                    tmp += ops[1] ? zs[0] + zs[1] : zs[0] * zs[1];
                    tmp = ops[2] ? tmp + zs[2] : tmp * zs[2];
                    res = Math.Min(res, tmp);
                }
            }
            Console.WriteLine(res);
        }

        private static void Swap<T>(T[] ts, int i, int j)
        {
            T tmp = ts[i];
            ts[i] = ts[j];
            ts[j] = tmp;
        }

        public static IEnumerable<T[]> Permutations<T>(T[] ts)
        {
            foreach (T[] p in Permutations(ts, 0, ts.Length))
            {
                yield return p;
            }
        }

        private static IEnumerable<T[]> Permutations<T>(T[] ts, int start, int end)
        {
            if (start == end) yield return ts;
            for (int i = start; i < end; i++)
            {
                for (int j = i - 1; j >= start; j--) Swap(ts, j, j + 1);
                foreach (T[] p in Permutations(ts, start + 1, end)) yield return p;
                for (int j = start; j < i; j++) Swap(ts, j, j + 1);
            }
        }
    }
}


using System;
using System.IO;
using System.Collections.Generic;
using System.Globalization;

//string[] lines = File.ReadAllLines (@"D:\Projects\cpp\input.txt");
//string s = File.ReadAllLines(@"D:\Projects\cpp\input.txt")[0];

namespace first
{
	class MainClass
	{
		public static string Reverse(string s)
		{
			char[] charArray = s.ToCharArray();
			Array.Reverse(charArray);
			return new string(charArray);
		}

		public static void Main(string[] args)
		{
			//var textReader = new StreamReader(@"D:\Projects\cpp\input.txt");
			//Console.SetIn(textReader);

			string[] s = Console.ReadLine().Split(' ');

			decimal d = (decimal)Convert.ToInt32(s[0]);
			decimal l = (decimal)Convert.ToInt32(s[1]);
			decimal v1 = (decimal)Convert.ToInt32(s[2]);
			decimal v2 = (decimal)Convert.ToInt32(s[3]);

			decimal res = ((l - d)) / ((v1 + v2));
			Console.WriteLine((string.Format(CultureInfo.GetCultureInfo("en-GB"), "{0:F6}", res)));
			//Console.ReadKey();
		}
	}
}


using System;
using System.Globalization;
using System.Linq;

namespace Codeforces
{
    public class Program
    {
        public static void Main(string[] args)
        {
            int[] input = Console.ReadLine()
                .Split(new [] {" "}, StringSplitOptions.RemoveEmptyEntries)
                .Select(int.Parse)
                .ToArray();

            double result = ((double)input[1] - input[0]) / ((double)input[2] + input[3]);
            Console.WriteLine(result.ToString("F6", CultureInfo.InvariantCulture));
        }
    }
}


using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Threading;
using System.Diagnostics;
using System.Linq;
using System.Globalization;

class Solution
{
    public TextInput cin;
    public TextOutput cout;
    public TextOutput cerr;

    public long Dist(long x)
    {
        x = x % 360L;
        return Math.Min(Math.Abs(x), 360 - Math.Abs(x));
    }
    public void Solve()
    {
        var n = (cin.Read<long>()) % 360L;
        var min = 0L;
        for (var i = 1L; i <= 4; i++)
        {
            var x = Dist(min * 90L - n);
            var y = Dist(i * 90L - n);
            if (y < x)
            {
                min = i;
            }
        }
        cout.WriteLine(min);
    }
}

#region Core
static class Program
{
    public static readonly TextInput cin = new TextInput(Console.In);
    public static readonly TextOutput cout = new TextOutput(Console.Out);
    public static readonly TextOutput cerr = new TextOutput(Console.Error);
#if !DEBUG
    static void Main()
    {
        new Solution
        {
            cin = cin,
            cout = cout,
            cerr = cerr
        }.Solve();
    }
#endif
}
public class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
{
    public new TValue this[TKey key]
    {
        get
        {
            TValue res;
            base.TryGetValue(key, out res);
            return res;
        }
        set
        {
            base[key] = value;
        }
    }
}
public static class Ext
{

    #region Prewriten
    public static void Foreach<T>(this IEnumerable<T> elements, Action<T> action)
    {
        foreach(var element in elements)
        {
            action(element);
        }
    }
    public static void Foreach<T>(this IEnumerable<T> elements, Action<T, int> action)
    {
        var index = 0;
        foreach(var element in elements)
        {
            action(element, index++);
        }
    }
    public static IEnumerable<T> Init<T>(int n) where T : new()
    {
        for (var i = 0; i < n; i++)
        {
            yield return new T();
        }
    }
    public static IEnumerable<T> Init<T>(int n, T defaultValue = default(T))
    {
        for (var i = 0; i < n; i++)
        {
            yield return defaultValue;
        }
    }
    public static IEnumerable<T> Init<T>(int n, Func<int, T> builder)
    {
        for (var i = 0; i < n; i++)
        {
            yield return builder(i);
        }
    }
    public static bool IsEmpty(this string s)
    {
        return string.IsNullOrEmpty(s);
    }
    public static string Safe(this string s)
    {
        return s.IsEmpty() ? string.Empty : s;
    }
    public static void Swap<T>(ref T a, ref T b)
    {
        T c = a;
        a = b;
        b = c;
    }
    public static long Gcd(long a, long b)
    {
        while (a > 0)
        {
            b %= a;
            Swap(ref a, ref b);
        }
        return b;
    }
    public static int[] ZFunction(string s)
    {
        var z = new int[s.Length];
        for (int i = 1, l = 0, r = 0; i < s.Length; ++i)
        {
            if (i <= r)
            {
                z[i] = Math.Min(r - i + 1, z[i - l]);
            }
            while (i + z[i] < s.Length && s[z[i]] == s[i + z[i]])
            {
                z[i]++;
            }
            if (i + z[i] - 1 > r)
            {
                l = i;
                r = i + z[i] - 1;
            }
        }
        return z;
    }
    public static long Pow(long a, long p)
    {
        var b = 1L;
        while (p > 0)
        {
            if ((p & 1) == 0)
            {
                a *= a;
                p >>= 1;
            }
            else
            {
                b *= a;
                p--;
            }
        }
        return b;
    }
    #endregion
}

public delegate bool TryParseDelegate<T>(string s, NumberStyles style, IFormatProvider format, out T value);
public class TextInput
{
    private static Dictionary<Type, Delegate> primitiveParsers = new Dictionary<Type, Delegate>
        {
            { typeof(sbyte), new TryParseDelegate<sbyte>(sbyte.TryParse) },
            { typeof(short), new TryParseDelegate<short>(short.TryParse) },
            { typeof(int),  new TryParseDelegate<int>(int.TryParse) },
            { typeof(long), new TryParseDelegate<long>(long.TryParse) },

            { typeof(byte), new TryParseDelegate<byte>(byte.TryParse) },
            { typeof(ushort), new TryParseDelegate<ushort>(ushort.TryParse) },
            { typeof(uint), new TryParseDelegate<uint>(uint.TryParse) },
            { typeof(ulong), new TryParseDelegate<ulong>(ulong.TryParse) },

            { typeof(float), new TryParseDelegate<float>(float.TryParse) },
            { typeof(double), new TryParseDelegate<double>(double.TryParse) },
            { typeof(decimal), new TryParseDelegate<decimal>(decimal.TryParse) },

            { typeof(char), new TryParseDelegate<char>(CharParser) },
            { typeof(string), new TryParseDelegate<string>(StringParser) }
        };
    private static bool CharParser(string s, NumberStyles style, IFormatProvider format, out char res)
    {
        res = char.MinValue;
        if (string.IsNullOrEmpty(s))
        {
            return false;
        }
        else
        {
            res = s[0];
            return true;
        }
    }
    private static bool StringParser(string s, NumberStyles style, IFormatProvider format, out string res)
    {
        res = s == null ? string.Empty : s;
        return true;
    }

    private string line = null;
    private int pos = 0;

    public IFormatProvider FormatProvider { get; set; }
    public NumberStyles NumberStyle { get; set; }
    public TextReader TextReader { get; set; }

    public TextInput(string path) : this(path, NumberStyles.Any, CultureInfo.InvariantCulture)
    {
    }
    public TextInput(string path, NumberStyles numberStyle, IFormatProvider formatProvider) : this(new StreamReader(path), numberStyle, formatProvider)
    {

    }
    public TextInput(TextReader textReader) : this(textReader, NumberStyles.Any, CultureInfo.InvariantCulture)
    {

    }
    public TextInput(TextReader textReader, NumberStyles numberStyle, IFormatProvider formatProvider)
    {
        TextReader = textReader;
        NumberStyle = numberStyle;
        FormatProvider = formatProvider;
    }

    public bool IsEof
    {
        get
        {
            return line == null && TextReader.Peek() == -1;
        }
    }
    public void SkipWhiteSpace()
    {
        while (!IsEof)
        {
            if (line != null && pos < line.Length && !char.IsWhiteSpace(line[pos]))
            {
                return;
            }
            if (line == null || pos >= line.Length)
            {
                Next();
                continue;
            }
            while (pos < line.Length && char.IsWhiteSpace(line[pos]))
            {
                pos++;
            }
        }
    }
    private void SkipWhiteSpace(bool force)
    {
        if (force)
        {
            SkipWhiteSpace();
        }
        else
        {
            SkipWhiteSpace();
        }
    }

    public T[] ReadArray<T>()
    {
        var length = Read<int>();
        return ReadArray<T>(length);
    }
    public T[] ReadArray<T>(int length)
    {
        var array = new T[length];

        var parser = GetParser<T>();
        var style = NumberStyle;
        var format = FormatProvider;

        for (var i = 0; i < length; i++)
        {
            array[i] = Read<T>(parser, style, format);
        }
        return array;
    }

    public bool TryReadArray<T>(out T[] array)
    {
        return TryReadArray<T>(GetParser<T>(), NumberStyle, FormatProvider, out array);
    }
    public bool TryReadArray<T>(out T[] array, int length)
    {
        return TryReadArray<T>(GetParser<T>(), NumberStyle, FormatProvider, out array, length);
    }
    public bool TryReadArray<T>(T[] array, int offset, int length)
    {
        return TryReadArray<T>(GetParser<T>(), NumberStyle, FormatProvider, array, offset, length);
    }
    public bool TryReadArray<T>(TryParseDelegate<T> parser, NumberStyles style, IFormatProvider format, out T[] array)
    {
        var length = 0;
        if (!TryRead<int>(out length))
        {
            array = null;
            return false;
        }
        array = new T[length];
        return TryReadArray<T>(parser, style, format, array, 0, length);
    }
    public bool TryReadArray<T>(TryParseDelegate<T> parser, NumberStyles style, IFormatProvider format, out T[] array, int length)
    {
        array = new T[length];
        return TryReadArray<T>(parser, style, format, array, 0, length);
    }
    public bool TryReadArray<T>(TryParseDelegate<T> parser, NumberStyles style, IFormatProvider format, T[] array, int offset, int length)
    {
        var result = true;
        for (var i = 0; i < length && result; i++)
        {
            result &= TryRead<T>(parser, style, format, out array[offset + i]);
        }
        return result;
    }

    private TryParseDelegate<T> GetParser<T>()
    {
        var type = typeof(T);
        return (TryParseDelegate<T>)primitiveParsers[type];
    }
    public T Read<T>()
    {
        return Read<T>(GetParser<T>());
    }
    public T Read<T>(NumberStyles style, IFormatProvider format)
    {
        return Read<T>(GetParser<T>(), style, format);
    }
    public T Read<T>(TryParseDelegate<T> parser)
    {
        return Read<T>(parser, NumberStyle, FormatProvider);
    }
    public T Read<T>(TryParseDelegate<T> parser, NumberStyles style, IFormatProvider format)
    {
        T result;
        if (!TryRead(parser, style, format, out result))
        {
            throw new FormatException();
        }
        return result;
    }
    public bool TryRead<T>(out T value)
    {
        return TryRead(GetParser<T>(), out value);
    }
    public bool TryRead<T>(NumberStyles style, IFormatProvider format, out T value)
    {
        return TryRead(GetParser<T>(), style, format, out value);
    }
    public bool TryRead<T>(TryParseDelegate<T> parser, out T value)
    {
        return parser(ReadToken(), NumberStyle, FormatProvider, out value);
    }
    public bool TryRead<T>(TryParseDelegate<T> parser, NumberStyles style, IFormatProvider format, out T value)
    {
        return parser(ReadToken(), style, format, out value);
    }
    public string ReadToken()
    {
        SkipWhiteSpace(false);
        if (IsEof)
        {
            throw new EndOfStreamException();
        }

        if (pos >= line.Length || char.IsWhiteSpace(line[pos])) return string.Empty;

        var start = pos;
        while (pos < line.Length && !char.IsWhiteSpace(line[pos]))
        {
            pos++;
        }
        return line.Substring(start, pos - start);
    }
    public string ReadLine()
    {
        if (IsEof)
        {
            throw new EndOfStreamException();
        }
        if (line == null || pos >= line.Length)
        {
            Next();
        }

        var ans = line.Substring(pos);
        pos = line.Length;
        return ans;
    }

    private void Next()
    {
        line = TextReader.ReadLine();
        pos = 0;
    }
}

public class TextOutput
{
    public IFormatProvider FormatProvider { get; set; }
    public TextWriter TextWriter { get; set; }

    public TextOutput(string path) : this(path, CultureInfo.InvariantCulture)
    {
    }
    public TextOutput(string path, IFormatProvider formatProvider) : this(new StreamWriter(path), formatProvider)
    {

    }
    public TextOutput(TextWriter textWriter) : this(textWriter, CultureInfo.InvariantCulture)
    {

    }
    public TextOutput(TextWriter textWriter, IFormatProvider formatProvider)
    {
        TextWriter = textWriter;
        FormatProvider = formatProvider;
    }

    public TextOutput WriteArray<T>(params T[] array)
    {
        return WriteArray(array, true);
    }
    public TextOutput WriteArray<T>(T[] array, bool appendLine)
    {
        return WriteArray(array, 0, array.Length, appendLine);
    }
    public TextOutput WriteArray<T>(T[] array, int offset, int length, bool appendLine = true)
    {
        var sb = new StringBuilder();
        for (var i = 0; i < length; i++)
        {
            sb.Append(Convert.ToString(array[offset + i], FormatProvider));
            if (i + 1 < length)
            {
                sb.Append(' ');
            }
        }
        return appendLine ? WriteLine(sb.ToString()) : Write(sb.ToString());
    }

    public TextOutput WriteLine(object obj)
    {
        return WriteLine(Convert.ToString(obj, FormatProvider));
    }
    public TextOutput WriteLine(string text, params object[] args)
    {
        return WriteLine(string.Format(FormatProvider, text, args));
    }
    public TextOutput WriteLine(string text)
    {
        TextWriter.WriteLine(text);
        return this;
    }
    public TextOutput WriteLine(char[] buffer)
    {
        TextWriter.WriteLine(buffer);
        return this;
    }
    public TextOutput WriteLine(char[] buffer, int offset, int length)
    {
        TextWriter.WriteLine(buffer, offset, length);
        return this;
    }
    public TextOutput WriteLine()
    {
        TextWriter.WriteLine();
        return this;
    }

    public TextOutput Write(object obj)
    {
        return Write(Convert.ToString(obj, FormatProvider));
    }
    public TextOutput Write(string text, params object[] args)
    {
        return Write(string.Format(FormatProvider, text, args));
    }
    public TextOutput Write(string text)
    {
        TextWriter.Write(text);
        return this;
    }
    public TextOutput Write(char[] buffer)
    {
        TextWriter.Write(buffer);
        return this;
    }
    public TextOutput Write(char[] buffer, int offset, int length)
    {
        TextWriter.Write(buffer, offset, length);
        return this;
    }
}
#endregion


using System;
using System.IO;
using System.Text;

namespace Turn
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            long n = long.Parse(reader.ReadLine());

            n %= 360;

            if (n >= 0)
            {
                if (n <= 45)
                    writer.WriteLine("0");
                else if (n <= 45 + 90)
                    writer.WriteLine("1");
                else if (n <= 45 + 180)
                    writer.WriteLine("2");
                else if (n < 45 + 270)
                    writer.WriteLine("3");
                else
                {
                    writer.WriteLine("0");
                }
            }
            else
            {
                if (n >= -45)
                    writer.WriteLine("0");
                else if (n > -45 - 90)
                    writer.WriteLine("3");
                else if (n > -45 - 180)
                    writer.WriteLine("2");
                else if (n > -45 - 270)
                    writer.WriteLine("1");
                else
                {
                    writer.WriteLine("0");
                }
            }

            writer.WriteLine();
            writer.Flush();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

class Program
{
    public class Num : IComparable<Num>
    {
        public int A, B;

        public Num(int x)
        {
            this.A = x;
            this.B = 1;
        }

        public Num(int a, int b)
        {
            this.A = a;
            this.B = b;
            this.Normalize();
        }

        public void Abs()
        {
            if (this.A < 0)
            {
                this.A = -this.A;
            }
        }

        public static Num operator +(Num a, Num b)
        {
            var top = a.A * b.B + b.A * a.B;
            var bot = a.B * b.B;

            return new Num(top, bot);
        }

        public static Num operator -(Num a, Num b)
        {
            return a + new Num(-b.A, b.B);
        }

        public static Num operator *(Num a, Num b)
        {
            var top = a.A * b.A;
            var bot = a.B * b.B;

            return new Num(top, bot);
        }

        public static Num operator /(Num a, Num b)
        {
            var top = a.A * b.B;
            var bot = a.B * b.A;

            return new Num(top, bot);
        }

        public void Normalize()
        {
            var gcd = GCD(A, B);
            if (gcd > 1)
            {
                this.A /= gcd;
                this.B /= gcd;
            }
        }

        public override string ToString()
        {
            return this.A.ToString() + "/" + this.B.ToString();
        }

        public int CompareTo(Num other)
        {
            return (this.A * other.B).CompareTo(this.B * other.A);
        }
    }

    private static void Main(string[] args)
    {
        PushTestData(@"
4
(99+98)/97
(26+4)/10
(12+33)/15
(5+1)/7
");
        var r = RI();
        var b = RI();
        Console.WriteLine(r == b ? "Yes" : "No");
    }

    private const int Mod = 1000000000 + 7;

    #region Data Read

    private static int GCD(int a, int b)
    {
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }

    private static List<int>[] ReadTree(int n)
    {
        return ReadGraph(n, n - 1);
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n];
        for (int i = 0; i < g.Length; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = RI() - 1;
            int b = RI() - 1;

            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

    private static int[,] ReadGraphAsMatrix(int n, int m)
    {
        int[,] matrix = new int[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = RI();
            int b = RI();
            matrix[a, b] = matrix[b, a] = 1;
        }

        return matrix;
    }

    private static void Sort(ref int a, ref int b)
    {
        if (a > b) Swap(ref a, ref b);
    }

    private static void Swap(ref int a, ref int b)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    private const int BufferSize = 1 << 16;
    private static StreamReader consoleReader;
    private static MemoryStream testData;

    private static int RI()
    {
        int ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static ulong RUL()
    {
        ulong ans = 0;
        int chr;
        do
        {
            chr = consoleReader.Read();
            if (chr == -1)
                return 0;
        } while (chr < '0' || chr > '9');

        ans = (uint)(chr - '0');
        while (true)
        {
            chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans;
            ans = ans * 10 + (uint)(chr - '0');
        }
    }

    private static long RL()
    {
        long ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static int[] RIA(int n)
    {
        int[] ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[i] = RI();
        return ans;
    }

    private static long[] RLA(int n)
    {
        long[] ans = new long[n];
        for (int i = 0; i < n; i++)
            ans[i] = RL();
        return ans;
    }

    private static char[] ReadWord()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*')));

        List<char> s = new List<char>();
        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z') || (ans == '*'));

        return s.ToArray();
    }

    private static char[] ReadString(int n)
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')));

        char[] s = new char[n];
        int pos = 0;
        do
        {
            s[pos++] = (char)ans;
            if (pos == n) break;
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));

        return s;
    }

    private static char[] ReadStringLine()
    {
        int ans;

        do
        {
            ans = consoleReader.Read();
        } while (ans == 10 || ans == 13);

        List<char> s = new List<char>();

        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while (ans != 10 && ans != 13 && ans != -1);

        return s.ToArray();
    }

    private static char ReadLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))
                return (char)ans;
        }
    }
    private static char ReadNonLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))
                return (char)ans;
        }
    }

    private static char ReadAnyOf(IEnumerable<char> allowed)
    {
        while (true)
        {
            char ans = (char)consoleReader.Read();
            if (allowed.Contains(ans))
                return ans;
        }
    }

    private static char ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

    private static int ReadDigitInt()
    {
        return ReadDigit() - (int)'0';
    }

    private static char ReadAnyChar()
    {
        return (char)consoleReader.Read();
    }

    private static string DoubleToString(double x)
    {
        return x.ToString(CultureInfo.InvariantCulture);
    }

    private static double DoubleFromString(string x)
    {
        return double.Parse(x, CultureInfo.InvariantCulture);
    }

    static Program()
    {
        //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        consoleReader = new StreamReader(Console.OpenStandardInput(BufferSize), Encoding.ASCII, false, BufferSize);
    }

    private static void PushTestData(StringBuilder sb)
    {
        PushTestData(sb.ToString());
    }
    private static void PushTestData(string data)
    {
#if TOLYAN_TEST
        if (testData == null)
        {
            testData = new MemoryStream();
            consoleReader = new StreamReader(testData);
        }

        var pos = testData.Position;
        var bytes = Encoding.UTF8.GetBytes(data);
        testData.Write(bytes, 0, bytes.Length);
        testData.Flush();
        testData.Position = pos;
#endif
    }
    #endregion
}


// Submitted by Stratholme @ Macau
using System;
using System.IO;
using System.Collections.Generic;
using CCF_XOI;

namespace CodeForces
{
	class CF526_ZeptoCodeRush2015_C
	{
		public void Solve(XOI xoi)
		{
			long C, Wr, Wb, Hr, Hb, Nb, Nr, v, ans;

			C = xoi.ReadLong();
			Hr = xoi.ReadLong();
			Hb = xoi.ReadLong();
			Wr = xoi.ReadLong();
			Wb = xoi.ReadLong();

			if (Hb * Wr < Hr * Wb)
			{
				long tw = Wb, th = Hb;
				Wb = Wr; Hb = Hr;
				Wr = tw; Hr = th;
			}

			for (Nr = ans = 0; (Nr < 10000000) && (Nr * Wr <= C); Nr++)
			{
				Nb = (C - Nr * Wr) / Wb;
				v = Nb * Hb + ((C - Nb * Wb) / Wr) * Hr;
				ans = Math.Max(ans, v);
			}

			xoi.o.WriteLine(ans);
		}
	}

	class CodeForcesMain
	{
		static void Main(string[] args)
		{
			(new CF526_ZeptoCodeRush2015_C()).Solve(new XOI());
		}
	}
}

namespace CCF_XOI
{	// version 2014.06.20
	class XOI
	{
		protected StreamReader sr;
		public StreamWriter o;
		protected Queue<string> buf = new Queue<string>();
		public bool EOF = false;

		public XOI()
		{
			this.sr = new StreamReader(Console.OpenStandardInput());
			this.o = new StreamWriter(Console.OpenStandardOutput());
			this.o.AutoFlush = true;
		}

		public XOI(string in_path, string out_path)
		{
			this.sr = new StreamReader(in_path);
			this.o = new StreamWriter(out_path);
			this.o.AutoFlush = true;
		}

		public int ReadInt()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int32.Parse(s);
		}

		public long ReadLong()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Int64.Parse(s);
		}

		public double ReadDouble()
		{
			string s = this.GetNext();
			if (s == null) return -1;
			else return Double.Parse(s, System.Globalization.CultureInfo.InvariantCulture);
		}

		public string ReadString()
		{
			string s = this.GetNext();
			return (s == null ? null : s);
		}

		public string ReadLine()
		{	// I will ignore current buffer and read a new line
			string s = "";
			while (s == "" && !this.EOF)
			{
				s = sr.ReadLine();
				this.EOF = (s == null);
			}
			return (this.EOF ? null : s);
		}

		protected string GetNext()
		{
			if (buf.Count == 0)
			{
				while (buf.Count == 0 && !this.EOF)
				{
					string s = sr.ReadLine();
					if (s == null)
						this.EOF = true;
					else
						foreach (string ss in s.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
							buf.Enqueue(ss);
				}
			}

			return (this.EOF ? null : buf.Dequeue());
		}
	}
}


using System;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Reflection;
using System.Net.Sockets;
using System.Xml;
using System.Diagnostics;
using System.Linq;
using System.Threading;

class Tree
{
    public int Index;

    public Tree Left;
    public Tree Right;

    public int Price;

    public void RecalcPrice()
    {
        if(Left != null && Right != null)
        {
            var min = Math.Min(Left.Price, Right.Price);
            Left.Price -= min;
            Right.Price -= min;

            Price += min;
        }
    }

    public long CalcPrice()
    {
        long res = 0;

        if (Left != null && Right != null)
        {
            res += Left.CalcPrice();
            res += Right.CalcPrice();

            RecalcPrice();
            res += Math.Max(Left.Price, Right.Price);
            Price += Math.Max(Left.Price, Right.Price);

            Left.Price = Right.Price = 0;
        }

        return res;
    }
    public void Build(int h)
    {
        if (h == 0) return;

        Left = new Tree();
        Right = new Tree();

        Left.Build(h - 1);
        Right.Build(h - 1);
    }
    public void CalcIndex(Tree[] output)
    {
        var index = 0;

        Queue<Tree> q = new Queue<Tree>();
        q.Enqueue(this);

        while(q.Count > 0)
        {
            var t = q.Dequeue();
            t.Index = index++;
            output[t.Index] = t;

            if (t.Left != null) q.Enqueue(t.Left);
            if (t.Right != null) q.Enqueue(t.Right);
        }
    }
}
static class Program
{
    #region IO
    public delegate ReadDelegate<T> ReadDelegate<T>(out T value);
    public delegate bool ParserDelegate<T>(string word, out T item);

    public class Input : IDisposable
    {
        private static EventArgs DefaultEventArgs = new EventArgs();

        public TextReader TextReader { get; private set; }

        public event EventHandler OnEndOfStream;
        public event EventHandler OnParseError;
        public event EventHandler OnReadError;

        public bool CanRead { get; private set; }
        public bool ThrowExceptions { get; set; }

        string line = string.Empty;
        int pos = 0;

        static EventHandler emptyHandler;

        public Input(string path)
            : this(File.OpenRead(path))
        {
        }
        public Input(Stream s)
            : this(new StreamReader(s))
        {

        }
        public Input(TextReader tr)
        {
            TextReader = tr;

            if (emptyHandler == null)
                emptyHandler = (a, b) => { };

            OnEndOfStream = emptyHandler;
            OnParseError = emptyHandler;
            OnReadError = emptyHandler;

            CanRead = true;
        }

        public static implicit operator Input(Stream s)
        {
            return new Input(s);
        }
        public static implicit operator Input(TextReader tr)
        {
            return new Input(tr);
        }

        private bool ReadStream()
        {
            if (!CanRead) return false;
            if (pos < line.Length) return true;

            Clear();

            string s = TextReader.ReadLine();
            if (s == null)
            {
                CanRead = false;
                return false;
            }

            line = s;
            return true;
        }

        public ReadDelegate<T> r<T>(out T value)
        {
            value = ReadData<T>();
            return r;
        }

        public void SkipChar()
        {
            if (pos < line.Length) pos++;
            else
            {
                ReadStream();
            }
        }
        public void SkipChars(int length)
        {
            while (length > 0)
            {
                int dt = line.Length - pos;
                if (dt <= 0)
                {
                    length--;
                    if (!ReadStream()) return;
                }
                dt = Math.Min(length, dt);
                pos += dt;
                length -= dt;
            }
        }

        public void SkipWhiteSpace()
        {
            while (true)
            {
                for (; pos < line.Length; pos++)
                {
                    if (!char.IsWhiteSpace(line[pos])) return;
                }
                if (!ReadStream())
                {
                    OnEndOfStream(this, DefaultEventArgs);
                    return;
                }
            }
        }
        public bool CanReadData()
        {
            SkipWhiteSpace();
            return CanRead;
        }

        public T[] ReadArray<T>()
        {
            int length = ReadInt32();
            return ReadArray<T>(length);
        }
        public T[] ReadArray<T>(int length)
        {
            ParserDelegate<T> parser = Parser.GetPrimitiveParser<T>();
            return ReadArray<T>(length, parser);
        }
        public T[] ReadArray<T>(ParserDelegate<T> parser)
        {
            int length = ReadInt32();
            return ReadArray<T>(length, parser);
        }
        public T[] ReadArray<T>(int length, ParserDelegate<T> parser)
        {
            T[] res = new T[length];
            for (int i = 0; i < length; i++)
            {
                res[i] = ReadData<T>(parser);
            }
            return res;
        }

        public Decimal ReadDecimal()
        {
            return ReadData<Decimal>(Parser.DecimalParser);
        }
        public Double ReadDouble()
        {
            return ReadData<Double>(Parser.DoubleParser);
        }
        public Single ReadSingle()
        {
            return ReadData<Single>(Parser.SingleParser);
        }
        public UInt64 ReadUInt64()
        {
            return ReadData<UInt64>(UInt64.TryParse);
        }
        public UInt32 ReadUInt32()
        {
            return ReadData<UInt32>(UInt32.TryParse);
        }
        public UInt16 ReadUInt16()
        {
            return ReadData<UInt16>(UInt16.TryParse);
        }
        public Int64 ReadInt64()
        {
            return ReadData<Int64>(Int64.TryParse);
        }
        public Int32 ReadInt32()
        {
            return ReadData<Int32>(Int32.TryParse);
        }
        public Int16 ReadInt16()
        {
            return ReadData<Int16>(Int16.TryParse);
        }
        public Boolean ReadYesNo()
        {
            return ReadData<Boolean>(Parser.YesNoParser);
        }
        public Boolean ReadBoolean()
        {
            return ReadData<Boolean>(Boolean.TryParse);
        }
        public Byte ReadByte()
        {
            return ReadData<Byte>(Byte.TryParse);
        }

        private bool ReadCheck()
        {
            if (!CanRead)
            {
                OnReadError(this, DefaultEventArgs);
                if (ThrowExceptions)
                {
                    throw new Exception("!CanRead");
                }
                return false;
            }
            return true;
        }
        public T ReadData<T>()
        {
            return ReadData<T>(true);
        }
        public T ReadData<T>(bool skipWhiteSpace)
        {
            ParserDelegate<T> parser = Parser.GetPrimitiveParser<T>();
            return ReadData<T>(parser, skipWhiteSpace);
        }
        public T ReadData<T>(ParserDelegate<T> parser)
        {
            return ReadData<T>(parser, true);
        }
        public T ReadData<T>(ParserDelegate<T> parser, bool skipWhiteSpace)
        {
            if (skipWhiteSpace)
                SkipWhiteSpace();

            if (!ReadCheck()) return default(T);

            string s = ReadWord(false);

            T res;
            if (!parser.Invoke(s, out res))
            {
                OnParseError(this, DefaultEventArgs);
                if (ThrowExceptions)
                {
                    throw new Exception("!validate, word = " + Output.ToString(s, 256));
                }
            }
            return res;
        }

        public string ReadWord()
        {
            return ReadWord(true);
        }
        public string ReadWord(bool skipWhiteSpace)
        {
            if (skipWhiteSpace)
                SkipWhiteSpace();

            if (!ReadCheck()) return string.Empty;

            int from = pos;
            int to = pos;
            for (int i = pos; i < line.Length; i++)
            {
                if (char.IsWhiteSpace(line[i])) break;
                to = i + 1;
            }
            pos = to;

            return line.Substring(from, to - from);
        }

        public string ReadLine()
        {
            if (!ReadCheck()) return string.Empty;

            ReadStream();
            string res = line.Substring(pos);
            pos = line.Length;

            return res;
        }

        public void Close()
        {
            TextReader.Close();
        }
        public void Clear()
        {
            pos = 0;
            line = string.Empty;
        }

        private bool disposed = false;
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    line = string.Empty;
                    TextReader.Dispose();
                }
                disposed = true;
            }
        }
        ~Input()
        {
            Dispose(false);
        }
    }
    public class Output : IDisposable
    {
        static char[] space = new char[] { ' ' };

        public TextWriter TextWriter { get; private set; }
        public bool AutoFlush { get; set; }

        public static string ToString(object obj, int maxLength)
        {
            return ToString(FormatReal(obj), maxLength);
        }
        public static string ToString(string s, int maxLength)
        {
            if (s.Length <= maxLength) return s;
            else return s.Substring(0, maxLength) + "...";
        }
        public static object FormatReal(object v, string format)
        {
            if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');
            if (v is double) return ((double)v).ToString(format).Replace(',', '.');
            if (v is float) return ((float)v).ToString(format).Replace(',', '.');

            return v;
        }
        public static object FormatReal(object v)
        {
            if (v is decimal || v is double || v is float)
            {
                return v.ToString().Replace(',', '.');
            }
            return v;
        }

        public Output()
            : this(new MemoryStream())
        {
        }
        public Output(string path)
            : this(File.Create(path))
        {

        }
        public Output(Stream s)
            : this(new StreamWriter(s))
        {
        }
        public Output(TextWriter tw)
        {
            TextWriter = tw;
        }

        public static implicit operator Output(Stream s)
        {
            return new Output(s);
        }

        public static implicit operator Output(TextWriter tw)
        {
            return new Output(tw);
        }

        public static Output operator +(Output output, object obj)
        {
            output.Write(obj);
            return output;
        }
        public Output WriteArray<T>(params T[] array)
        {
            return WriteArray<T>(array, false);
        }
        public Output WriteArray<T>(T[] array, bool appendLength)
        {
            return WriteArray<T>(array, 0, array.Length, appendLength);
        }
        public Output WriteArray<T>(T[] array, int index, int count)
        {
            return WriteArray<T>(array, index, count, false);
        }
        public Output WriteArray<T>(T[] array, int index, int count, bool appendLength)
        {
            if (index + count > array.Length)
            {
                string message = string.Format(
                    "Index out of range: {0} + {1} >= {2}",
                    index,
                    count,
                    array.Length);
                throw new Exception(message);
            }
            if (appendLength)
            {
                WriteLine(count);
            }
            for (int i = 0; i < count; i++)
            {
                Write(array[i + index]);
                Write(space, 0, space.Length);
            }
            WriteLine();

            return this;
        }
        public Output WriteLine(object obj)
        {
            obj = FormatReal(obj);
            return WriteLine(obj.ToString());
        }
        public Output WriteLine(string format, params object[] args)
        {
            return WriteLine(string.Format(format, args));
        }
        public Output WriteLine(string s)
        {
            return WriteLine(s.ToCharArray());
        }
        public Output WriteLine(char[] buffer)
        {
            return WriteLine(buffer, 0, buffer.Length);
        }
        public Output WriteLine(char[] buffer, int index, int count)
        {
            TextWriter.WriteLine(buffer, index, count);
            if (AutoFlush) TextWriter.Flush();
            return this;
        }
        public Output WriteLine()
        {
            TextWriter.WriteLine();
            if (AutoFlush) TextWriter.Flush();
            return this;
        }
        public Output Write(object obj)
        {
            obj = FormatReal(obj);
            return Write(obj.ToString());
        }
        public Output Write(string format, params object[] args)
        {
            return Write(string.Format(format, args));
        }
        public Output Write(string s)
        {
            return Write(s.ToCharArray());
        }
        public Output Write(char[] buffer)
        {
            return Write(buffer, 0, buffer.Length);
        }
        public Output Write(char[] buffer, int index, int count)
        {
            TextWriter.Write(buffer, index, count);
            if (AutoFlush) TextWriter.Flush();
            return this;
        }

        public void Close()
        {
            TextWriter.Close();
        }
        public void Flush()
        {
            TextWriter.Flush();
        }

        private bool disposed = false;
        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    TextWriter.Dispose();
                }
                disposed = true;
            }
        }
        ~Output()
        {
            Dispose(false);
        }
    }
    public static class Parser
    {
        public static ParserDelegate<T> GetPrimitiveParser<T>()
        {
            if (!typeof(T).IsPrimitive && typeof(T) != typeof(String)) throw new Exception("Unknown type");
            else if (default(T) is Byte)     return new ParserDelegate<Byte>(Byte.TryParse) as ParserDelegate<T>;
            else if (default(T) is Boolean)  return new ParserDelegate<Boolean>(Boolean.TryParse) as ParserDelegate<T>;
            else if (default(T) is Int16)    return new ParserDelegate<Int16>(Int16.TryParse) as ParserDelegate<T>;
            else if (default(T) is Int32)    return new ParserDelegate<Int32>(Int32.TryParse) as ParserDelegate<T>;
            else if (default(T) is Int64)    return new ParserDelegate<Int64>(Int64.TryParse) as ParserDelegate<T>;
            else if (default(T) is UInt16)   return new ParserDelegate<UInt16>(UInt16.TryParse) as ParserDelegate<T>;
            else if (default(T) is UInt32)   return new ParserDelegate<UInt32>(UInt32.TryParse) as ParserDelegate<T>;
            else if (default(T) is UInt64)   return new ParserDelegate<UInt64>(UInt64.TryParse) as ParserDelegate<T>;
            else if (default(T) is Single)   return new ParserDelegate<Single>(Parser.SingleParser) as ParserDelegate<T>;
            else if (default(T) is Double)   return new ParserDelegate<Double>(Parser.DoubleParser) as ParserDelegate<T>;
            else if (default(T) is Decimal)  return new ParserDelegate<Decimal>(Parser.DecimalParser) as ParserDelegate<T>;
            else if (typeof(T) == typeof(String))   return new ParserDelegate<String>(Parser.StringParser) as ParserDelegate<T>;
            else throw new Exception("Unknown type");
        }
        public static bool YesNoParser(string s, out Boolean result)
        {
            s = s.ToLower();
            if (s == "yes") result = true;
            else if (s == "no") result = false;
            else
            {
                result = false;
                return false;
            }
            return true;
        }
        public static bool ReplaceDot;
        public static bool StringParser(string s, out string result)
        {
            result = s;
            return string.IsNullOrEmpty(s);
        }
        private static string fs(string s)
        {
            if (ReplaceDot) return s.Replace(',', '.');
            else return s;
        }
        public static bool DecimalParser(string s, out Decimal result)
        {
            return Decimal.TryParse(fs(s), out result);
        }
        public static bool DoubleParser(string s, out Double result)
        {
            return Double.TryParse(fs(s), out result);
        }
        public static bool SingleParser(string s, out Single result)
        {
            return Single.TryParse(fs(s), out result);
        }
    }
    #endregion
    #region Streams
    static string endl = Environment.NewLine;
    static Input cin = new Input(Console.In);
    static Output cout = new Output(Console.Out);
    static Output cerr = new Output(Console.Error);
    static StringBuilder sb = new StringBuilder();
    #endregion
    #region Time
    //*
    static Stopwatch sw = new Stopwatch();
    static void Start()
    {
        sw.Reset();
        sw.Start();
    }
    static void Restart(string text = "")
    {
        Stop(text);
        Start();
    }
    static void Time(string text = "")
    {
        if (string.IsNullOrEmpty(text))
        {
            cerr.WriteLine(sw.Elapsed);
        }
        else
        {
            cerr.WriteLine(text + ": " + sw.Elapsed);
        }
    }
    static void Stop(string text = "")
    {
        sw.Stop();
        Time(text);
    }
    //*/
    #endregion

    static void InitIO(string name)
    {
#if DEBUG
#else
        cin = new Input(name + ".in");
        cout = new Output(name + ".out");
        Parser.ReplaceDot = false;
#endif
    }

    static long Slow(long c, long hr, long hb, long wr, long wb)
    {
        var min = 0;
        var max = c / wr;

        long res = 0;

        for (var i = min; i <= max; i++)
        {
            long c1 = i;
            long c2 = (c - wr * i) / wb;
            c1 += (c - wr * c1 - wb * c2) / wr;

            long t = c1 * hr + c2 * hb;

            res = Math.Max(t, res);
        }
        return res;
    }
    static long Fast(long c, long hr, long hb, long wr, long wb)
    {
        if (hr * wb < hb * wr)
        {
            return Fast(c, hb, hr, wb, wr);
        }

        long res1 = c / wr * hr + ((c - (c / wr) * wr) / wb) * hb;
        long res2 = 0;

        long x = ((c - (c / wr) * wr) / wb);
        for (var i = 0; i * i <= c; i++)
        {
            x++;
            if (x * wb <= c)
            {
                var t = x * hb + ((c - x * wb) / wr) * hr;
                res2 = Math.Max(t, res2);
            }
        }

        return Math.Max(res1, res2);
    }
    static void Main()
    {
        var c = cin.ReadInt64();

        var hr = cin.ReadInt64();
        var hb = cin.ReadInt64();

        var wr = cin.ReadInt64();
        var wb = cin.ReadInt64();

        cout.WriteLine(Fast(c, hr, hb, wr, wb));
    }
}


using System;
 public class Program
    {
        public static void Main(string[] args)
        {
            int[] nms;
            int n;
            {
                string[] input = Console.In.ReadToEnd().Split(new char[] { '\r', '\n', '\t', ' ' }, StringSplitOptions.RemoveEmptyEntries);
                nms = new int[3];
                for (int i = 2, curr; i < input.Length; ++i)
                {
                    curr = int.Parse(input[i]);
                    nms[0] += curr / 4;
                    curr %= 4;
                    if (curr == 3) nms[0]++;
                    else if(curr!=0) nms[curr]++;
                }
                n = Math.Min(nms[1], nms[2]);
                nms[0] += n;
                nms[1] -= n;
                nms[2] -= n;
                n = int.Parse(input[0])*4;
            }
            if (nms[2] > 0) Helper(ref n, ref nms[2], false);
            else Helper(ref n, ref nms[1], true);
            if (nms[0] * 4 > n) Console.WriteLine("NO");
            else Console.WriteLine("YES");
        }
        private static void Helper(ref int n, ref int a, bool one)
        {
            a = n - a * 2;
            if (a >= 0) n += a;
            else
            {
                a = Math.Abs(a);
                if(one) { if (a % 4 != 0) a += 2; n-=a; }
                else { n -= (int)(Math.Ceiling(a / 3d) * 4d); }
            }
        }
    }


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

namespace ConsoleApp30
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            int n = Convert.ToInt32(s[0]);
            int k = Convert.ToInt32(s[1]);
            int po_4 = n;
            int po_2 = n * 2;
            s = Console.ReadLine().Split();
            int[] mas = new int[k];
            for (int i = 0; i < k; i++)
            {
                mas[i] = Convert.ToInt32(s[i]);
            }
            for (int i = 0; i < mas.Length; i++)
            {
                int l = mas[i]/4;
                if(po_4>=l)
                {
                    po_4 -= l;
                    mas[i] -= l * 4;
                }
                else
                {
                    mas[i] -= po_4 * 4;
                    po_4 = 0;
                }
            }
            int po_1 = 0;
            for (int i = 0; i < mas.Length; i++)
            {
                if(po_4==0)
                {
                    int g = mas[i] / 2;
                    if (mas[i] % 2 == 1)
                        g++;
                    if(po_2>=g)
                    {
                        po_2 -= g;
                        mas[i] = 0;
                    }
                }
                else
                {
                    if(mas[i]==3)
                    {
                        po_4--;
                        mas[i] = 0;
                    }
                    else
                    {
                        if(mas[i]==2)
                        {
                            if(po_2>0)
                            {
                                po_2--;
                                mas[i] = 0;
                            }
                            else
                            {
                                if(po_4>0)
                                {
                                    po_4--;
                                    po_1++;
                                    mas[i] = 0;
                                }
                            }
                        }

                    }
                }
            }
            /*
            else
                        {
                if (mas[i] == 1)
                {
                    if (po_1 > 0)
                    {
                        mas[i] = 0;
                        po_1--;
                    }
                    else
                    {

                    }
                }
            }*/
            for (int i = 0; i < k; i++)
            {
                if(mas[i]!=0)
                {
                    if(po_1>=mas[i])
                    {
                        po_1 -= mas[i];
                        mas[i] = 0;
                    }
                    else
                    {
                        int l = mas[i] / 2 + mas[i] % 2;
                        if(po_2>=l)
                        {
                            po_2 -= l;
                            mas[i] = 0;
                        }
                        else
                        {
                            if(po_4>0)
                            {
                                po_4--;
                                mas[i]--;
                                po_1++;
                            }
                        }
                    }
                }
            }
            if (mas.Max()==0)
            {
                Console.WriteLine("YES");

            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
}


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

namespace cforce135bb
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] tmp = Console.ReadLine().Split(' ');
            long p = long.Parse(tmp[0]), d = long.Parse(tmp[1]), i=p, n=p, k, f=10;
            int count = 1;
            while (i>=p-d)
            {
                check:
                k=(long)((i + 1) % f);
                if (k == 0)
                {
                    count++;
                    n = i;
                    f = (long)Math.Pow(10, count);
                    goto check;
                }
                i -= (long)Math.Pow(10, count - 1);
            }
            Console.WriteLine(n);
            Console.ReadLine();
        }
    }
}