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

namespace ConsoleApp5
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] s = Console.ReadLine().Split().Select(int.Parse).ToArray();

            int min1;
            int min2;
            int[] st = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(st);
            int[] st1 = Console.ReadLine().Split().Select(int.Parse).ToArray();
            Array.Sort(st1);

            min1 = st.First();
            min2 = st1.First();

            int mindiff = 0;
            foreach(int el in st)
            {
                if (st1.Contains(el))
                {
                    mindiff = el;
                    break;
                }
            }

            int res = (min1 > min2) ? min2 * 10 + min1 : min1 * 10 + min2;
            res = (min1 == min2) ? min1 : res;

            res = (res > mindiff && mindiff != 0) ? mindiff : res;

            Console.WriteLine(res);

        }

    }
}


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

namespace Olymp
{
  public class ProblemSolver
  {
    private Tokenizer input;

    public void Solve()
    {
      var y = input.ReadInt();
      var b = input.ReadInt();
      var r = input.ReadInt();
      var s = 0;
      for (var i = 1; i <= y; i++)
      {
        if (i + 1 > b || i + 2 > r)
          break;
        s = 3 * i + 3;
      }
      Console.WriteLine(s);
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }

    #region Service functions

    private static void AddCount<T>(Dictionary<T, int> counter, T item)
    {
      if (counter.TryGetValue(item, out var count))
        counter[item] = count + 1;
      else
        counter.Add(item, 1);
    }

    private static int GetCount<T>(Dictionary<T, int> counter, T item)
    {
      return counter.TryGetValue(item, out var count) ? count : 0;
    }

    private static int GCD(int a, int b)
    {
      while (b != 0)
      {
        a %= b;
        var t = b;
        b = a;
        a = t;
      }
      return a;
    }

    #endregion
  }

  #region Service classes

  public class Tokenizer
  {
    private TextReader reader;

    public string ReadToEnd()
    {
      return this.reader.ReadToEnd();
    }

    public int ReadInt()
    {
      var c = SkipWS();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = this.reader.Read();
        if (c == -1)
          throw new InvalidOperationException();
      }
      if (!char.IsDigit((char)c))
        throw new InvalidOperationException();
      var result = (char)c - '0';
      c = this.reader.Read();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        if (!char.IsDigit((char)c))
          throw new InvalidOperationException();
        result = result * 10 + (char)c - '0';
        c = this.reader.Read();
      }
      if (isNegative)
        result = -result;
      return result;
    }

    public string ReadLine()
    {
      return reader.ReadLine();
    }

    public long ReadLong()
    {
      return long.Parse(this.ReadToken());
    }

    public double ReadDouble()
    {
      return double.Parse(this.ReadToken(), CultureInfo.InvariantCulture);
    }

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWS();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = this.reader.Read();
      }
      return sb.ToString();
    }

    private int SkipWS()
    {
      var c = this.reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = this.reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main(string[] args)
    {
      var solver = new ProblemSolver(Console.In);
      solver.Solve();
    }
  }

  #endregion
}


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

namespace codeforces
{
	class Program
	{
		public class User
		{
			public int c;

			public int r;
		}

		public class Point
		{
			public int x;

			public int y;
		}

		public class Comparer : IComparer<User>
		{
			public int Compare(User x, User y)
			{
				if (x.c < y.c || (x.c == y.c && x.r < y.r))
					return -1;
				return 1;
			}
		}

		public static long getGcd(long a, long b)
		{
			if (b == 0)
				return a;
			return getGcd(b, a % b);
		}

		public static void WriteYESNO(bool x, string yes = "YES", string no = "NO")
		{
			if (x)
				Console.WriteLine(yes);
			else
			{
				Console.WriteLine(no);
			}
		}

		public static string GetString()
		{
			return Console.ReadLine();
		}

		public static List<int> getList()
		{
			var s = Console.ReadLine();
			return s.Split(' ').Select(int.Parse).ToList();
		}

		public static int Min(int x, int y)
		{
			return Math.Min(x, y);
		}

		public static int Max(int x, int y)
		{
			return Math.Max(x, y);
		}

		public static int Abs(int x)
		{
			return Math.Abs(x);
		}

		public static int getInt()
		{
			var s = Console.ReadLine();
			return int.Parse(s);
		}

		public static bool Equal(int x, int y, int x1, int y1)
		{
			return x == x1 && y == y1;
		}

		public class Vertex
		{
			public List<int> edges;

			public int ct;

			public Vertex()
			{
				ct = 0;
				edges = new List<int>();
				for (var i = 0; i < 26; ++i)
					edges.Add(0);
			}
		}

		private static void Main(string[] args)
		{
/*			var input = new StreamReader("input.txt");
			var output = new StreamWriter("output.txt");*/

			var x = getList();
			var s = x.Sum();
			while (s < 0)
				s += x[0];
			var ans = s % x[0];
			if (ans == 0)
				ans = x[0];
			Console.WriteLine(ans);
			/*			input.Close();
			output.Close();*/
		}
	}
}


using System;
using System.Linq;

namespace tren
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] mass = n.Skip(1).ToArray();
            int[] dp = new int[n[0] + 1];
            foreach (int i in mass)
            {
                if (i <= n[0]) dp[i] = 1;
            }
            for(int i = mass.Min() + 1; i <= n[0]; i++)
            {
                foreach(int j in mass)
                {
                    if (j < i && dp[i - j] > 0) dp[i] = Math.Max(dp[i], dp[i - j] + 1);
                }
            }
            Console.Write(dp[n[0]]);
        }
    }
}


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

namespace ConsoleApplication33
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());
            double res = 0;
            long power = 1;

                if (n % 2 == 0)
                {
                    Console.WriteLine(n / 2);

                }
                else
                {
                    Console.WriteLine(n / 2 - n);

                }

            Console.Read();
        }
    }
}


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

namespace ProgrammingContest.Codeforces.SchoolTeam3
{
    class A
    {
        public static void Main()
        {
            string[] m = new[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" };
            string s = Console.ReadLine();
            for (int i = 0; i < m.Length; i++)
                if (m[i] == s)
                    Console.WriteLine(m[(i + int.Parse(Console.ReadLine())) % 12]);
        }
    }
}


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

class Program
{
    static void Main(string[] args)
    {
        String[] s = Console.ReadLine().Split().ToArray();
        Array.Sort(s);
        int ans = 3;
        if (s[0] == s[1] && s[1] == s[2])
        {
            ans = 0;
        }
        else
        {
            int x0 = int.Parse(s[0].Substring(0, 1));
            int x1 = int.Parse(s[1].Substring(0, 1));
            int x2 = int.Parse(s[2].Substring(0, 1));
            if (s[0][1] == s[1][1] && s[0][1] == s[2][1])
            {
                if (x0 + 1 == x1 && x1 + 1 == x2)
                {
                    ans = 0;
                }
                else if (x0 == x1 || x0 + 1 == x1 || x0 + 2 == x1)
                {
                    ans = 1;
                }
                else if (x1 == x2 || x1 + 1 == x2 || x1 + 2 == x2)
                {
                    ans = 1;
                }
                else ans = 2;
            }
            else if (s[0][1] == s[1][1])
            {
                if (x0 == x1 || x0 + 1 == x1 || x0 + 2 == x1)
                {
                    ans = 1;
                }
                else ans = 2;
            }
            else if (s[0][1] == s[2][1])
            {
                if (x0 == x2 || x0 + 1 == x2 || x0 + 2 == x2)
                {
                    ans = 1;
                }
                else ans = 2;
            }
            else if (s[1][1] == s[2][1])
            {
                if (x1 == x2 || x1 + 1 == x2 || x1 + 2 == x2)
                {
                    ans = 1;
                }
                else ans = 2;
            }
            else ans = 2;
        }
        Console.WriteLine(ans);
    }
}


using System;

namespace _460A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(new char[]{ ' ' });

            int n = int.Parse(input[0]);
            int m = int.Parse(input[1]);

            int total = 0;
            int curr = n;
            int rem = 0;

            while (curr > 0)
            {
                total += curr;
                int currNext = (curr + rem) / m;
                int remNext = (curr + rem) % m;

                curr = currNext;
                rem = remNext;
            }

            Console.WriteLine(total);
        }
    }
}


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

namespace Hongcow_Learns_the_Cyclic_Shift
{
    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)
        {
            string s = reader.ReadLine();

            var h = new HashSet<string>();
            for (int i = 0; i < s.Length; i++)
            {
                h.Add(s);
                s = s.Substring(1) + s.Substring(0, 1);
            }

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


using System;

namespace _48A
{
    class Program
    {
        static void Main(string[] args)
        {
            //     "F"                      "M"                     "S"
            string s1 = Console.ReadLine(), s2 = Console.ReadLine(), s3 = Console.ReadLine();
            //"F" wins when
            if (
                (s1.Equals("paper") && s2.Equals("rock") && s3.Equals("rock")) ||
                (s1.Equals("scissors") && s2.Equals("paper") && s3.Equals("paper")) ||
                (s1.Equals("rock") && s2.Equals("scissors") && s3.Equals("scissors"))
            ) Console.WriteLine("F");
            //"M" wins when
            else if (
                 (s2.Equals("paper") && s1.Equals("rock") && s3.Equals("rock")) ||
                 (s2.Equals("scissors") && s1.Equals("paper") && s3.Equals("paper")) ||
                 (s2.Equals("rock") && s1.Equals("scissors") && s3.Equals("scissors"))
             ) Console.WriteLine("M");
            //"S" wins when
            else if (
                 (s3.Equals("paper") && s1.Equals("rock") && s2.Equals("rock")) ||
                 (s3.Equals("scissors") && s1.Equals("paper") && s2.Equals("paper")) ||
                 (s3.Equals("rock") && s1.Equals("scissors") && s2.Equals("scissors"))
             ) Console.WriteLine("S");
            else Console.WriteLine("?");

        }
    }
}


using System;

namespace asfsdgdfgdfgdfgdfg
{
	class Program
	{
		public static void Main(string[] args)
		{int k=0;int y=0;
			int d =int.Parse(Console.ReadLine());
				string ab = Console.ReadLine();
			for(int i=0;i<ab.Length;i++){k=k+(int)ab[i]-48;}
			for(int i=2;i<=k;i++){int cc=0;
				if(k%i==0){
					int c=0;
					for(int ii=0;ii<ab.Length;ii++){
						c=c+(int)ab[ii]-48;
						if(c==k/i){c=0;cc=cc+1;}
						if(c>k/i){break;}
					}
				}
				if(cc==i){Console.WriteLine("YES");y=1;break;}
			}
			if(k==0){Console.WriteLine("YES");}
			if((y==0)&&(k!=0)){Console.WriteLine("NO");}

		}
	}
}


using System;

namespace Project
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] stringValue;
            Int32 n, a, b, c, d;
            Int64 ans;
            Int32[] value = new Int32[4];
            stringValue = Console.ReadLine().Split(' ');
            n = Convert.ToInt32(stringValue[0]);
            a = Convert.ToInt32(stringValue[1]);
            b = Convert.ToInt32(stringValue[2]);
            c = Convert.ToInt32(stringValue[3]);
            d = Convert.ToInt32(stringValue[4]);
            value[0] = a + b;
            value[1] = a + c;
            value[2] = b + d;
            value[3] = c + d;
            Array.Sort(value);
            ans = n - (value[3] - value[0]);
            if (ans > 0)
                Console.WriteLine(ans * n);
            else
                Console.WriteLine(0);
        }
    }
}


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

namespace WatchingFootball
{
    class Program
    {
        private static int a;

        private static int b;

        private static int c;

        static void Main(string[] args)
        {
            int[] values = Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray();
            a = values[0];
            b = values[1];
            c = values[2];

            int result = Solve();
            Console.Out.WriteLine(result);
        }

        private static int Solve()
        {
            return (int) Math.Max(0, Math.Ceiling((0.0 + a - b) * c / b));
        }
    }
}


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

namespace Codeforces
{
	class Program
	{
		static void Main(string[] args)
		{
			string input1 = Console.ReadLine();
			//string input2 = Console.ReadLine();

			//string input3 = Console.ReadLine();
			//string input4 = Console.ReadLine();

			//var inputs1 = input1.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();
			//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToList();

			long n = long.Parse(input1);
			var res = new List<long>();
			for (long i = 0; i < 2 * n- 1; i++)
			{
				res.Add(i % 2 > 0 ? (n - 1) : n);
			}

			Console.WriteLine(res.Sum());
		}

		public class Node
		{
			public int Count { get; set; }

			public int FirstIndex { get; set; } = -1;

			public int LastIndex { get; set; } = -1;
		}

		//public class Node<T>
		//{
		//	public Node<T> Left { get; set; }

		//	public Node<T> Right { get; set; }

		//	public T Value { get; set; }

		//	public Node(T value)
		//	{
		//		Value = value;
		//	}
		//}

		//public class Tree<T>
		//{
		//	public Node<T> Root { get; set; }

		//	public Tree(T value)
		//	{
		//		Root = new Node<T>(value);
		//	}
		//}

		private static long GCD(long a, long b)
		{
			long max = Math.Max(a, b);
			long min = Math.Min(a, b);

			if (min == 0)
			{
				return max;
			}

			a = min;
			b = max % min;
			return GCD(a, b);
		}

		private static long LCM(long a, long b)
		{
			return Math.Abs(a * b) / GCD(a, b);
		}

		//private static int Length(short[] a)
		//{
		//	int firstItemIndex = 0;
		//	for (int i = 0; i < a.Length; i++)
		//	{
		//		if (a[i] == 0)
		//		{
		//			continue;
		//		}

		//		firstItemIndex = i;
		//		break;
		//	}

		//	return a.Length - firstItemIndex;
		//}

		//private static short[] Subtract(short[] a, short[] b)
		//{
		//	if (a.Length != b.Length)
		//	{
		//		throw new ArgumentException();
		//	}

		//	short[] result = new short[a.Length];
		//	Array.Copy(a, result, a.Length);
		//	for (int i = result.Length - 1; i >= 0; i--)
		//	{
		//		if (result[i] < b[i])
		//		{
		//			int j = i - 1;
		//			while (result[j] == 0)
		//			{
		//				result[j--] = 9;
		//			}

		//			result[j]--;
		//			result[i] += 10;
		//		}

		//		result[i] -= b[i];
		//	}

		//	return result;
		//}

		private static short[] Multiply(short[] a, int b)
		{
			short[] result = new short[a.Length];
			for (int i = a.Length - 1; i > 0; i--)
			{
				int temp = a[i] * b;
				result[i] = (short)(result[i] + temp % 10);
				result[i - 1] = (short)(result[i - 1] + temp / 10);
			}

			for (int i = a.Length - 1; i > 0; i--)
			{
				if (result[i] > 9)
				{
					result[i] -= 10;
					result[i - 1]++;
				}
			}

			return result;
		}

		//private static int Mod(short[] a, int b)
		//{
		//	int rest = 0, i = 0;
		//	while (i < a.Length)
		//	{
		//		int d = 10 * rest + a[i];
		//		while (d < b && i < a.Length - 1)
		//		{
		//			d = 10 * d + a[++i];
		//		}

		//		rest = d % b;
		//		i++;
		//	}

		//	return rest;
		//}

		private static short[] Divide(short[] a, int b)
		{
			short[] result = new short[a.Length];
			int rest = 0, i = 0;
			while (i < a.Length)
			{
				int d = 10 * rest + a[i];
				while (d < b && i < a.Length - 1)
				{
					d = 10 * d + a[++i];
				}

				result[i] = (short)(d / b);
				rest = d % b;
				i++;
			}

			return result;
		}
	}
}


using System;
using System.Linq;
using System.Collections;

namespace P1 {

    public class A14 {
        static void p(ref BitArray a) {
            foreach (var b in a) Console.Write((bool)b ? '1' : '0');
            Console.WriteLine();
        }

        static BitArray add(ref BitArray a, ref BitArray b) {
            var c = new BitArray(a.Length);
            bool r = false;
            for (int i = 0; i < a.Length; i++ ) {
                var d  =  a[i]^b[i];
                c[i] = d ^ r;
                r = (d & r) | (a[i] & b[i]);
            }
            return c;
        }

        static void Main() {
            var n = int.Parse(Console.ReadLine());
            var x = new BitArray(Console.ReadLine().ToCharArray().Select(a=>a=='1'?true:false).ToArray());
            var one = new BitArray(n);
            var c = new BitArray(n);
            one.SetAll(false);
            one[0] = true;
            for (int i=0; i < n;i++) c[i]=x[i];
            c = add(ref x, ref one);
            var count = 0;
            foreach (var e in c.Xor(x)) count += (bool)e ? 1 : 0;
            Console.WriteLine(count);
        }
    }
}


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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
            int tc = 1;
            tc = int.Parse(Console.ReadLine());
            while (tc-- > 0)
            {
                solve();
            }
        }

        // write your code in solve function
        static void solve()
        {
            int x = int.Parse(Console.ReadLine());
            int[] a = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            bool[] open = new bool[3];
            open[x - 1] = true;

            while (a[x - 1] != 0)
            {
                x = a[x - 1];
                open[x - 1] = true;
            }

            bool ok = true;
            for (int i = 0; i < 3; i++ ) {
                if (!open[i])
                    ok = false;
            }

            Console.WriteLine((ok) ? "YES" : "NO");
        }
    }
}


using System;
using System.Linq;

namespace ConsoleApp15
{
    class Program
    {
        static void Main()
        {

            string input = Console.ReadLine();
            bool flag = input != null && input.Length >= 7 && input.Contains("0") && input.Contains("1");
            if (flag)
            {

                var digits = input.ToCharArray();
                var temp = new char[7] {'1', '0', '0', '0', '0', '0', '0'};
                var j = 0;
                var found = false;
                for (var index = 0; index < digits.Length; index++)
                {
                    char t = digits[index];
                    if (temp[j].Equals(t))
                    {
                       j++;
                    }
                    if (j == (temp.Length))
                    {
                        found = true;
                        break;
                    }
                }
                Console.WriteLine(found ? "yes" : "no");
            }
            else
            {
                Console.WriteLine("no");
            }
        }
    }
}


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

namespace Dima_and_the_equation
{
    class Program
    {
        static void Main(string[] args)
        {
            int c, a, b;
            long x;
            string[] hold;
            List<long> result = new List<long>();
            hold = Console.ReadLine().Split(' ');
            a = Int32.Parse(hold[0]);
            b = Int32.Parse(hold[1]);
            c = Int32.Parse(hold[2]);
            for (int i = 1; i <= 81; i++)
            {
                x = b *(long) Math.Pow(i, a) + c;
                if (x>0&& x< Math.Pow(10,9))
                    if (sum(x) == i)
                        result.Add(x);
            }
            Console.WriteLine(result.Count);
            foreach (int i in result)
            {
                Console.Write(i + " ");
            }
            Console.ReadLine();
        }
        static int sum(long number)
        {
            string k = number.ToString();
            int sum = 0;
            foreach (char i in k)
            {
                sum += Int32.Parse(i.ToString());
            }
            return sum;
        }
    }
}


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

namespace CodeForces
{
    class R194_Div2_C
    {
        static void Main(string[] args)
        {
            long n = long.Parse(Console.ReadLine());

            long pow3 = 3;
            while (n % pow3 == 0)
                pow3 *= 3;

            long cnt = n / pow3 + 1;
            Console.WriteLine(cnt);
        }
    }
}


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

namespace Codeforces
{
    internal class Program
    {
        private static string Read()
        {
            return Console.ReadLine();
        }

        private static string[] ReadArray()
        {
            return Console.ReadLine().Split(' ');
        }

        private static int[] ReadIntArray()
        {
            var input = ReadArray();
            var res = new int[input.Length];
            for (int i = 0; i < input.Length; i++)
            {
                res[i] = ReadNextInt(input, i);
            }
            return res;
        }

        private static int ReadInt()
        {
            return Int32.Parse(Console.ReadLine());
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static int ReadNextInt(string[] input, int index)
        {
            return Int32.Parse(input[index]);
        }

        private static List<long> divs;
        private static void Main()
        {
            var MOD = 1000000007;
            var input = ReadIntArray();
            var n = input[0];
            var m = input[1];
            var k = input[2];
            if(m == 1)
            {
                Console.WriteLine(1);
                return;
            }
            long res = 1;
            if(n < k || k==1)
            {
                for (int i = 0; i < n; i++)
                {
                    res *= m;
                    res %= MOD;
                }
                Console.WriteLine(res);
                return;
            }
            if(n == k)
            {
                for (int i = 0; i < n / 2 + (n %2); i++)
                {
                    res *= m;
                    res %= MOD;
                }
                Console.WriteLine(res);
                return;
            }
            if(k % 2 == 0)
            {
                Console.WriteLine(m);
                return;
            }
            Console.WriteLine(m*m);
        }
    }
}


using System;
using System.Linq;

namespace CSharp
{
    class _897B
    {
        public static void Main()
        {
            var tokens = Console.ReadLine().Split();

            int k = int.Parse(tokens[0]);
            int p = int.Parse(tokens[1]);

            Console.WriteLine(Enumerable.Range(1, k).Select(i => long.Parse(new string(i.ToString().ToArray().Concat(i.ToString().Reverse()).ToArray())) % p).Sum() % p);
        }
    }
}


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            long n = Convert.ToInt64(str[0]);
            long k = Convert.ToInt64(str[1]);

            if ((n/k)%2==0) { Console.WriteLine("NO"); } else { Console.WriteLine("YES"); }
        }
    }
}


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

namespace Diplomi
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            long n = long.Parse(s[0]);
            long k = long.Parse(s[1]);

            long x = n / (2 * (k + 1));

            Console.WriteLine("{0} {1} {2}", x, k * x, n - (k + 1) * x);
        }
    }
}


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

namespace CF {
    class Program {
        static int n;
        static int[ ] t;

        static int f( ) {
            if ( t[ 0 ] > 15 )
                return 15;
            int ant = t[ 0 ];
            for ( int i = 1; i < n; i++ ) {
                if ( t[ i ] - ant > 15 ) {
                    return Math.Min( 90, ant + 15 );
                }
                ant = t[ i ];
            }
            if ( 90 - ant > 15 ) {
                return ant + 15;
            }
            return 90;
        }

        static void solve( ) {
            n = int.Parse( Console.ReadLine( ) );
            t = Array.ConvertAll( Console.ReadLine( ).Split( ' ' ), ts => int.Parse( ts ) );

            Console.Write( f( ) );
        }

        static void Main( string[ ] args ) {
            solve( );
        }
    }
}


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

namespace WorldGame
{
    class Program
    {

        static void Main(string[] args)
        {
            string a = Console.ReadLine();

            string[] sNumbers = a.Split(' ');

            Console.WriteLine(int.Parse(sNumbers[1]) + int.Parse(sNumbers[0])+0);
        }
    }
}


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

namespace a2oj
{
    class Program
    {

        static void Main(string[] args)
        {
            List<int> len = new List<int>();
            for (int i = 0; i < 4; i++)
            {
                len.Add(Console.ReadLine().Split('.')[1].Length);
            }
            int[] len1 = new int[4];
            List<int> list = new List<int>();

            len.CopyTo(len1);
            list = len1.ToList();
            len.Sort();
            //foreach (var item in len)
            //{
            //    Console.WriteLine(item);
            //}
            if (len[0] * 2 <= len[1] && len[2] * 2 <= len[3])
            {
                Console.WriteLine("C"); return;
            }
            if(len[0]*2<=len[1])
            {
                switch (list.IndexOf(len[0])+1)
                {
                    case 1:
                        Console.WriteLine("A");
                        break;
                    case 2:
                        Console.WriteLine("B");
                        break;
                    case 3:
                        Console.WriteLine("C");
                        break;
                    case 4:
                        Console.WriteLine("D");
                        break;
                }
                //Console.ReadKey();
                return;
            }
            if (len[2] * 2 <= len[3])
            {
                switch (list.IndexOf(len[3])+1)
                {
                    case 1:
                        Console.WriteLine("A");
                        break;
                    case 2:
                        Console.WriteLine("B");
                        break;
                    case 3:
                        Console.WriteLine("C");
                        break;
                    case 4:
                        Console.WriteLine("D");
                        break;
                }
                //Console.ReadKey();
                return;
            }
            Console.WriteLine("C");

           //Console.ReadKey();
        }
    }
}


using System;

namespace D {
    internal class Program {
        private static void Main() {
            int x, y, z, x1, y1, z1, a1, a2, a3, a4, a5, a6;
            var line1 = Console.ReadLine().Split(' ');
            x = Convert.ToInt32(line1[0]);
            y = Convert.ToInt32(line1[1]);
            z = Convert.ToInt32(line1[2]);
            var line2 = Console.ReadLine().Split(' ');
            x1 = Convert.ToInt32(line2[0]);
            y1 = Convert.ToInt32(line2[1]);
            z1 = Convert.ToInt32(line2[2]);
            var line3 = Console.ReadLine().Split(' ');
            a1 = Convert.ToInt32(line3[0]);
            a2 = Convert.ToInt32(line3[1]);
            a3 = Convert.ToInt32(line3[2]);
            a4 = Convert.ToInt32(line3[3]);
            a5 = Convert.ToInt32(line3[4]);
            a6 = Convert.ToInt32(line3[5]);

            var res = 0;

            if (x > x1) {
                res += a6;
            }

            if (x < 0) {
                res += a5;
            }

            if (y > y1) {
                res += a2;
            }

            if (y < 0) {
                res += a1;
            }

            if (z > z1) {
                res += a4;
            }

            if (z < 0) {
                res += a3;
            }

            Console.WriteLine(res);
        }
    }
}


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

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 string NextLine()
        {
            try
            {
                return inputStream.ReadLine();
            }
            catch (IOException)
            {
                return null;
            }
        }

        public string NextString()
        {
            try
            {
                while (tokens == null || pointer >= tokens.Length)
                {
                    tokens = NextLine().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>()
        {
            return (T)Convert.ChangeType(NextString(), typeof(T));
        }

        public IEnumerable<T> NextSeq<T>(int n)
        {
            for (int 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)
        {
            PrintLine(o ? "YES" : "NO");
        }

        public void Print<T>(T o)
        {
            outputStream.Write(o);
        }

        public void PrintLine<T>(T o)
        {
            outputStream.WriteLine(o);
        }

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

        void IDisposable.Dispose()
        {
            Close();

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

    public static class ListExtensions
    {
        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, T val)
        {
            for (int i = 0; i < self.Count; i++)
            {
                self[i] = val;
            }

            return self;
        }
    }

    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 int GetHashCode()
        {
            int hash = 17;
            hash = hash * 31 + ((Equals(Key, default(T1))) ? 0 : Key.GetHashCode());
            hash = hash * 31 + ((Equals(Value, default(T1))) ? 0 : Key.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 s = io.NextLine().Select(x => x - '0').ToArray();

            var max = -1;

            if (s.Length > 0)
            {
                for (int i = 1; i <= 7; i++)
                {
                    for (int j = 1; j <= 7; j++)
                    {
                        for (int k = 1; k <= 7; k++)
                        {
                            if (i + j + k != s.Length)
                                continue;

                            var n1 = 0;
                            var x = 1;

                            for (int l = 1; l <= i; l++)
                            {
                                n1 += s[i - l]*x;
                                x *= 10;
                            }

                            if (n1 > 1000000 || (n1 > 0 && n1 < x / 10) || (n1 == 0 && x > 10))
                                continue;

                            var n2 = 0;
                            x = 1;

                            for (int l = 1; l <= j; l++)
                            {
                                n2 += s[i + j - l]*x;
                                x *= 10;
                            }

                            if (n2 > 1000000 || (n2 > 0 && n2 < x / 10) || (n2 == 0 && x > 10))
                                continue;

                            var n3 = 0;
                            x = 1;

                            for (int l = 1; l <= k; l++)
                            {
                                n3 += s[i + j + k - l]*x;
                                x *= 10;
                            }

                            if (n3 > 1000000 || (n3 > 0 && n3 < x / 10) || (n3 == 0 && x > 10))
                                continue;

                            max = Math.Max(max, n1 + n2 + n3);
                        }
                    }
                }
            }

            io.Print(max);
        }
    }

}


using System;
using System.Collections.Generic;
using System.Linq;
using CompLib.Util;

public class Program
{
    int N;
    long M;
    long[] A;
    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        M = sc.NextInt();
        A = sc.LongArray();

        /*
         * Aからいくつか選んで Mod Mが最大になるようにする
         */

        var left = Calc(0, N / 2);
        var right = Calc(N / 2, N);
        long ans = ((left.Last() + right.Last()) % M);
        foreach (int i in left)
        {
            // i + right[j] がM未満最大
            //
            int ok = 0;
            int ng = right.Count;
            while(ng - ok > 1)
            {
                int mid = (ok + ng) / 2;
                if (i + right[mid] < M) ok = mid;
                else ng = mid;
            }
            ans = Math.Max(ans, i + right[ok]);
        }

        Console.WriteLine(ans);
    }

    List<long> Calc(int b, int e)
    {
        var ls = new List<long>();
        ls.Add(0);

        for (int i = b; i < e; i++)
        {
            int len = ls.Count;
            for (int j = 0; j < len; j++)
            {
                ls.Add((ls[j] + A[i]) % M);
            }
        }

        var result = new List<long>();
        ls.Sort();
        for (int i = 0; i < ls.Count; i++)
        {
            if (i == 0 || ls[i - 1] != ls[i])
            {
                result.Add(ls[i]);
            }
        }

        return result;
    }

    public static void Main(string[] args) => new Program().Solve();
}

namespace CompLib.Util
{
    using System;
    using System.Linq;

    class Scanner
    {
        private string[] _line;
        private int _index;
        private const char Separator = ' ';

        public Scanner()
        {
            _line = new string[0];
            _index = 0;
        }

        public string Next()
        {
            if (_index >= _line.Length)
            {
                string s;
                do
                {
                    s = Console.ReadLine();
                } while (s.Length == 0);

                _line = s.Split(Separator);
                _index = 0;
            }

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

        public int NextInt() => int.Parse(Next());
        public long NextLong() => long.Parse(Next());
        public double NextDouble() => double.Parse(Next());
        public decimal NextDecimal() => decimal.Parse(Next());
        public char NextChar() => Next()[0];
        public char[] NextCharArray() => Next().ToCharArray();

        public string[] Array()
        {
            string s = Console.ReadLine();
            _line = s.Length == 0 ? new string[0] : s.Split(Separator);
            _index = _line.Length;
            return _line;
        }

        public int[] IntArray() => Array().Select(int.Parse).ToArray();
        public long[] LongArray() => Array().Select(long.Parse).ToArray();
        public double[] DoubleArray() => Array().Select(double.Parse).ToArray();
        public decimal[] DecimalArray() => Array().Select(decimal.Parse).ToArray();
    }
}


using System;

namespace Task3 {
    internal class Program {
        private static void Main(string[] args) {
            string s = Console.ReadLine();
            string[] ss = s.Split(' ');
            long a = int.Parse(ss[0]);
            long b = int.Parse(ss[1]);
            long t = GetLCM(a, b);
            string s1 = "Dasha";
            string s2 = "Masha";
            if (a < b) {
                string temp = s1;
                s1 = s2;
                s2 = temp;
                long tt = a;
                a = b;
                b = tt;
            }
            long first = 0;
            long previous = 0;
            long next = a;
            while (next <= t) {
                long k = (next/b)*b;
                first += k - previous;

                previous = next;
                next = next + a;
            }
            first -= b;
            long second = t - first;
            if (first < second) Console.WriteLine(s1);
            else if (second < first) Console.WriteLine(s2);
            else Console.WriteLine("Equal");
        }

        public static long GetLCM(long a, long b) {
            return Math.Abs(a*b)/GetGCD(a, b);
        }

        public static long GetGCD(long a, long b) {
            while (a != 0 && b != 0) {
                if (a >= b) a = a%b;
                else b = b%a;
            }
            return a + b;
        }
    }
}


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

namespace A.Газировкопитие
{
    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 l = Convert.ToInt32(s[2]);
            int c = Convert.ToInt32(s[3]);
            int d = Convert.ToInt32(s[4]);
            int p = Convert.ToInt32(s[5]);
            int nl = Convert.ToInt32(s[6]);
            int np = Convert.ToInt32(s[7]);
            int gaz = (k * l) / nl;
            int lime = c * d;
            int salt = p / np;
            Tosti(gaz,lime,salt,n);
        }

        static void Tosti(int gaz, int lime, int salt, int chelov)
        {
            int min1=1000000;
            int[] min = new int[3];
            min[0] = gaz;
            min[1] = lime;
            min[2] = salt;
            for (int i = 0; i < 3; i++)
                if (min[i] < min1)
                    min1 = min[i];
            Console.WriteLine(min1/chelov);
        }

    }
}


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

namespace Task
{
    class Program
    {
        static void Main(string[] args)
        {
            int n, pos, l, r;
            string[] split = Console.ReadLine().Split(' ');
            n = int.Parse(split[0]);
            pos = int.Parse(split[1]);
            l = int.Parse(split[2]);
            r = int.Parse(split[3]);

            int ans = 0;
            if (pos < l)
            {
                ans += l - pos;
                pos = l;
            }
            if (pos > r)
            {
                ans += pos - r;
                pos = r;
            }

            if (l == 1)
            {
                if (r == n) { }
                else
                {
                    ans++;
                    ans += r - pos;
                }
            } else if (r == n)
            {
                ans++;
                ans += pos - l;
            }
            else
            {
                ans += 2;
                ans += r - l;
                ans += Math.Min(pos - l, r - pos);
            }
            Console.WriteLine(ans);

        }
    }
}


using System;
class Program
{
    static void Main()
    {
        string s = Console.ReadLine();
        int i = 0;
        for (i = s.Length - 2; !Char.IsLetter(s[i]); i--) { }
        Console.WriteLine(Array.IndexOf(new char[] { 'a', 'e', 'i', 'o', 'u', 'y' }, Char.ToLower(s[i])) != -1 ? "YES" : "NO");
    }
}


/*
 * У Николая есть массив a, состоящий из n различных целых чисел от 1 до n. Другими словами, массив Николая — это перестановка целых чисел от 1 до n.
 * Николай решил, что будет лучше, если минимальный элемент его массива (то есть число 1) и максимальный элемент его массива (то есть число n) будут находиться как можно дальше
 * друг от друга. Поэтому он решил ровно один раз поменять местами два каких-нибудь элемента таким образом, чтобы расстояние между минимальным и максимальным элементами стало
 * максимально возможным. Расстоянием между двумя элементами называется модуль разности номеров позиций данных элементов.
 *
 * Входные данные
 * В первой строке входных данных следует целое положительное число n (2 ≤ n ≤ 100) — количество элементов в массиве Николая.
 * Во второй строке входных данных записаны различные целые числа a1, a2, ..., an (1 ≤ ai ≤ n), где ai равно элементу, который находится в i-й позиции в массиве Николая.
 *
 * Выходные данные
 * Выведите единственное целое число — максимальное расстояние между минимальным и максимальным элементами в массиве Николая, которое может быть получено с помощью ровно одного
 * обмена местами двух элементов массива.
 *
 * Примеры
 * Входные данные
 * 5
 * 4 5 1 3 2
 * Выходные данные
 * 3
 *
 * Входные данные
 * 7
 * 1 6 5 3 4 7 2
 * Выходные данные
 * 6
 *
 * Входные данные
 * 6
 * 6 5 4 3 2 1
 * Выходные данные
 * 5
 *
 * #реализация
*/
using System;

namespace A
{
	class MainClass
	{
		static int search(ref int[] a, int elem)
		{
			for (int i = 0; i < a.Length; ++i) {
				if (a [i] == elem)
					return i;
			}
			return -1;
		}
		public static void Main (string[] args)
		{
			int n = int.Parse (Console.ReadLine ());
			int i;
			int[] mas = new int[n];
			int pos_first, pos_last;
			int max_offset_first, max_offset_last;
			int max;
			var str = Console.ReadLine ().Split (new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
			for (i = 0; i < n; ++i) {
				mas [i] = int.Parse (str [i]);
			}
			pos_first = search (ref mas, 1);
			max_offset_first = Math.Max(pos_first, n-1 - pos_first) ;
			pos_last = search (ref mas, n);
			max_offset_last = Math.Max (pos_last, n - 1 - pos_last);
			max = Math.Max (max_offset_first, max_offset_last);

			Console.Write (max);
		}
	}
}


using System;

public class Solution
{
    static void Main(String[] args)
    {
        int n = int.Parse(Console.ReadLine());
        if (n == 1)
        {
            Console.WriteLine(n);
        }
        else if (n == 2)
        {
            Console.WriteLine(n);
        }
        else
        {
            Console.WriteLine(1);
        }
    }
}


using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Program
{
    public class Solver
    {
        public void Solve()
        {
            var n = sc.Integer();
            var k = sc.Integer();
            var dp = new ModInteger[n + 1];
            dp[1] = 1;
            for (int _ = 0; _ < k; _++)
            {
                var next = new ModInteger[n + 1];
                for (int i = 1; i <= n; i++)
                {
                    for (int j = i; j <= n; j += i)
                        next[j] += dp[i];
                }
                dp = next;
                //IO.Printer.Out.WriteLine(dp.AsJoinedString());
            }
            ModInteger sum = 0;
            for (int i = 1; i <= n; i++)
                sum += dp[i];
            IO.Printer.Out.WriteLine(sum);
        }

        public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
        static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}

#region main
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion
#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Text;
    using System.Globalization;
    public class Printer : StreamWriter
    {
        static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }
        public static Printer Out { get; set; }
        public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        public readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }

        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public string ScanLine()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b != '\n'; b = (char)read())
                if (b == 0) break;
                else if (b != '\r') sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public char[] Char(int n) { return enumerate(n, Char); }
        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
    }
}
#endregion
#region ModNumber
public partial struct ModInteger
{
    public const long Mod = (long)1e9 + 7;
    public long num;
    public ModInteger(long n) : this() { num = n % Mod; if (num < 0) num += Mod; }
    public override string ToString() { return num.ToString(); }
    public static ModInteger operator +(ModInteger l, ModInteger r) { var n = l.num + r.num; if (n >= Mod) n -= Mod; return new ModInteger() { num = n }; }
    public static ModInteger operator -(ModInteger l, ModInteger r) { var n = l.num + Mod - r.num; if (n >= Mod) n -= Mod; return new ModInteger() { num = n }; }
    public static ModInteger operator *(ModInteger l, ModInteger r) { return new ModInteger(l.num * r.num); }
    public static implicit operator ModInteger(long n) { return new ModInteger(n); }
}
#endregion


using System;

namespace ConsoleApp8
{
    class Program
    {
     static   ulong meth(ulong n)
        {
            ulong i = 1;
            while ((n /= 10) > 0)
            {
                i++;
            }
            return i;
        }

        static ulong sum(ulong x)
        {
            ulong sum = 0;
            while (x / 1 > 0)
            {
                sum += x % 10;
                x /= 10;
            }
            return sum;
        }
        static void Main(string[] args)
        {
            ulong n = ulong.Parse(Console.ReadLine());

            ulong v, t, x;

                ulong y = 10;
                t = meth(n);
                x = n;
                for (ulong i = 1; i < t; i++)
                {
                    ulong b = y * 10;
                    v = (n / b) * b + (n % b / y - 1) * y + y - 1;
                    if (sum(v) > sum(x))
                        x = v;
                    y *= 10;
                }
            Console.WriteLine(x);

    }

    }
}


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

namespace Giga_Tower
{
    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)
        {
            int a = Next();
            int c = 0;
            do
            {
                a++;
                c++;
            } while (!a.ToString().Contains("8"));

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

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


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

namespace ConsoleApplication46
{
    class Program
    {
        static void Main(string[] args)
        {
            List<string> strList = new List<string>();
            List<string> strList2 = new List<string>();

            for (int x = 0; x < 8; x++) {

                strList.Add(Console.ReadLine());
            }

          //Ideal
            strList2.Add("WBWBWBWB");
            strList2.Add("BWBWBWBW");
            strList2.Add("WBWBWBWB");//
            strList2.Add("BWBWBWBW");
            strList2.Add("WBWBWBWB");
            strList2.Add("BWBWBWBW");
            strList2.Add("WBWBWBWB");
            strList2.Add("BWBWBWBW");

            bool b = true;

            for (int x = 0; x < 8; x++)
            {
                if (strList[x].ToString()!=strList2[x].ToString())
                {
                    if (cambia(strList[x].ToString()).ToString()==strList2[x].ToString())
                    {
                        //Console.WriteLine(cambia(strList[x].ToString()).ToString() +" "+ strList2[x].ToString());
                    }
                    else
                    {
                        //Console.WriteLine("si");
                        b = false;
                        break;
                    }
                }
            }

            if (b)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }

            Console.ReadLine();

        }

        static StringBuilder cambia(string str){

            StringBuilder sb = new StringBuilder();

            for (int x = 1; x < str.Length; x++)
            {
                sb.Append(str[x].ToString());
            }
            sb.Append(str[0].ToString());

            return sb;

        }

    }
}


using System;
using System.Collections.Generic;

namespace FoxAndBoxAccumulation
{
    partial class FoxAndBoxAccumulation
    {
        static void Main(string[] args)
        {
            int n, current;
            int[] strengths;
            bool added = false;
            List<int> pilesCount = new List<int>();

            n = NextInt();
            strengths = new int[n];

            for (int i = 0; i < n; i++)
                strengths[i] = NextInt();

            Array.Sort(strengths);
            pilesCount.Add(1);

            for (int i = 1; i < n; i++)
            {
                current = strengths[i];
                added = false;

                for (int j = 0; j < pilesCount.Count; j++)
                {
                    if (current >= pilesCount[j])
                    {
                        pilesCount[j]++;
                        added = true;
                        break;
                    }
                }

                if (!added)
                    pilesCount.Add(1);
            }

            Console.WriteLine(pilesCount.Count);
        }
    }

    partial class FoxAndBoxAccumulation
    {
        static string[] tokens = new string[0];
        static int cur_token = 0;

        static void ReadArray(char sep)
        {
            cur_token = 0;
            tokens = Console.ReadLine().Split(sep);
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int NextInt()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return int.Parse(tokens[cur_token++]);
        }

        static long NextLong()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return long.Parse(tokens[cur_token++]);
        }

        static double NextDouble()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return double.Parse(tokens[cur_token++]);
        }

        static decimal NextDecimal()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return decimal.Parse(tokens[cur_token++]);
        }

        static string NextToken()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return tokens[cur_token++];
        }

        static string ReadLine()
        {
            return Console.ReadLine();
        }
    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        public static string solve(string t)
        {
            foreach(char x in t)
            {
                if (!(x == '4' || x == '7'))
                    return "NO";
            }
            int left = 0;
            int right = 0;
            for(int i=0;i<t.Length/2;i++)
            {
                int x = Convert.ToInt32(t[i]);
                left += x;
            }
            for(int i=t.Length/2;i<t.Length;i++)
            {
                int x = Convert.ToInt32(t[i]);
                right += x;
            }
            if (right != left)
                return "NO";
            else return "YES";
        }
        static void Main(string[] args)
        {
            Console.ReadLine();
            string t = Console.ReadLine();
            Console.WriteLine(solve(t));
        }
    }
}


using System;
using static System.Console;
using static System.Math;
using static System.Array;
using System.IO;

namespace ConsoleApp9
{
    class Program
    {
        static void Conv(string[] a,int[] b)
        {
            for(int i = 0; i < a.Length; i++)
            {
                b[i] = Convert.ToInt32(a[i]);
            }
        }
        static void Print(int[] b)
        {
            for(int i = 0; i < b.Length; i++)
            {
                Write($"{b[i]} ");
            }
            WriteLine();
        }
        static int Main(string[] args)
        {

            int n = int.Parse(ReadLine());
            string a = ReadLine();
            char[] m = a.ToCharArray();
            for (int i = 0; i < n; i++)
            {
                if (n % (i + 1) == 0)
                {
                    int k = 0;
                    for(int j = i; j >=k; j--)
                    {
                        char c = m[j];
                        m[j] = m[k];
                        m[k] = c;
                        k++;
                    }
                }
            }
            foreach (var e in m) Write(e);
            return 0;
        }

    }
}


using System;

namespace Company
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int result = 0, half = n / 2;
            for (int i = 1; i <= half; ++i)
            {
                if ((n - i) % i == 0)
                {
                    ++result;
                }
            }
            Console.WriteLine(result);
            //Console.ReadKey();
        }
    }
}


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

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            //int[] arr = Console.ReadLine().Split(' ').Select(i => int.Parse(i)).ToArray();

            string ans = "";
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            if (s.Count(c => c == '1') == 0)
            {
                Console.WriteLine(0);
            }
            else
            {
                int start = s.IndexOf('1');
                int zeros = 0;
                for (int i = start; i < s.Length; i++)
                    if (s[i] == '0')
                        zeros++;

                ans = ans + "1";
                while (zeros != 0)
                {
                    ans += "0";
                    zeros--;
                }

                Console.WriteLine(ans);
            }
        }
    }
}


using System;

namespace _777A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int x = int.Parse(Console.ReadLine());
            int result = 0;
            switch (n % 6)
            {
                case 0:
                    switch (x)
                    {
                        case 0:
                            result = 0;
                            break;
                        case 1:
                            result = 1;
                            break;
                        case 2:
                            result = 2;
                            break;
                    }
                    break;
                case 1:
                    switch (x)
                    {
                        case 0:
                            result = 1;
                            break;
                        case 1:
                            result = 0;
                            break;
                        case 2:
                            result = 2;
                            break;
                    }
                    break;
                case 2:
                    switch (x)
                    {
                        case 0:
                            result = 1;
                            break;
                        case 1:
                            result = 2;
                            break;
                        case 2:
                            result = 0;
                            break;
                    }
                    break;
                case 3:
                    switch (x)
                    {
                        case 0:
                            result = 2;
                            break;
                        case 1:
                            result = 1;
                            break;
                        case 2:
                            result = 0;
                            break;
                    }
                    break;
                case 4:
                    switch (x)
                    {
                        case 0:
                            result = 2;
                            break;
                        case 1:
                            result = 0;
                            break;
                        case 2:
                            result = 1;
                            break;
                    }
                    break;
                case 5:
                    switch (x)
                    {
                        case 0:
                            result = 0;
                            break;
                        case 1:
                            result = 2;
                            break;
                        case 2:
                            result = 1;
                            break;
                    }
                    break;
            }
            Console.WriteLine(result);
        }
    }
}


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    class Bit
    {
        private readonly int size;
        private readonly int[] data;

        public Bit(int n)
        {
            size = n;
            data = new int[n];
        }

        public int PrefixSum(int r)
        {
            int ret = 0;
            for (; r >= 0; r = (r & r + 1) - 1)
                ret += data[r];
            return ret;
        }

        public void Update(int idx, int diff)
        {
            for (; idx < size; idx = (idx | idx + 1))
                data[idx] += diff;
        }
    }

    long InvCount(int[] a)
    {
        int n = a.Length;
        var bit = new Bit(n + 1);
        long ret = 0;
        for (int i = 0; i < n; i++)
        {
            ret += i - bit.PrefixSum(a[i]);
            bit.Update(a[i], 1);
        }
        return ret;
    }

    public void Solve()
    {
        int n = ReadInt();
        int m = ReadInt();

        var a = Enumerable.Range(0, n).ToArray();
        for (int i = 0; i < n / 2 && m > 0; i++, m--)
        {
            int t = a[i];
            a[i] = a[n - i - 1];
            a[n - i - 1] = t;
        }

        Write(InvCount(a));
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            //var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken() { while (currentLineTokens.Count == 0)currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(int.Parse).ToArray(); }
    public static long[] ReadLongArray() { return ReadAndSplitLine().Select(long.Parse).ToArray(); }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++)matrix[i] = ReadIntArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++)ret[i][j] = matrix[j][i]; } return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++)lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void WriteArray<T>(IEnumerable<T> array) { writer.WriteLine(string.Join(" ", array)); }
    public static void Write(params object[] array) { WriteArray(array); }
    public static void WriteLines<T>(IEnumerable<T> array) { foreach (var a in array)writer.WriteLine(a); }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++)ret[i] = new T(); return ret; }
    #endregion
}


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

//using System.Threading;

namespace ReadWriteTemplate
{
    public static class Solver
    {
        public static void Solve()
        {
            int a = ReadInt();
            int b = ReadInt();
            int c = ReadInt();
            int d = ReadInt();

            int N = 1000000;
            bool[] u = new bool[N];
            for (int i = b; i < N; i += a)
            {
                u[i] = true;
            }
            for (int i = d; i < N; i += c)
            {
                if (u[i])
                {
                    Writer.WriteLine(i);
                    return;
                }
            }
            Writer.WriteLine(-1);
        }

        public static void Main()
        {
            //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

#if DEBUG
            Reader = File.OpenText("input.txt"); Writer = File.CreateText("output.txt");
#else
            Reader = Console.In; Writer = Console.Out;
#endif
            //Reader = File.OpenText("concatenation.in"); Writer = File.CreateText("concatenation.out");

            Solve();

            Reader.Close();
            Writer.Close();
        }

        public static IOrderedEnumerable<TSource> OrderByWithShuffle<TSource, TKey>(this IEnumerable<TSource> source, Func<TSource, TKey> keySelector)
        {
            return source.Shuffle().OrderBy(keySelector);
        }

        public static T[] Shuffle<T>(this IEnumerable<T> source)
        {
            T[] result = source.ToArray();
            Random rnd = new Random();
            for (int i = result.Length - 1; i >= 1; i--)
            {
                int k = rnd.Next(i + 1);
                T tmp = result[k];
                result[k] = result[i];
                result[i] = tmp;
            }
            return result;
        }

#region Read/Write

        private static TextReader Reader;

        private static TextWriter Writer;

        private static Queue<string> CurrentLineTokens = new Queue<string>();

        private static string[] ReadAndSplitLine()
        {
            return Reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
        }

        public static string ReadToken()
        {
            while (CurrentLineTokens.Count == 0)
                CurrentLineTokens = new Queue<string>(ReadAndSplitLine());
            return CurrentLineTokens.Dequeue();
        }

        public static string ReadLine()
        {
            return Reader.ReadLine();
        }

        public static int ReadInt()
        {
            return int.Parse(ReadToken());
        }

        public static long ReadLong()
        {
            return long.Parse(ReadToken());
        }

        public static double ReadDouble()
        {
            return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
        }

        public static int[] ReadIntArray()
        {
            return ReadAndSplitLine().Select(int.Parse).ToArray();
        }

        public static long[] ReadLongArray()
        {
            return ReadAndSplitLine().Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
        }

        public static int[][] ReadIntMatrix(int numberOfRows)
        {
            int[][] matrix = new int[numberOfRows][];
            for (int i = 0; i < numberOfRows; i++)
                matrix[i] = ReadIntArray();
            return matrix;
        }

        public static string[] ReadLines(int quantity)
        {
            string[] lines = new string[quantity];
            for (int i = 0; i < quantity; i++)
                lines[i] = Reader.ReadLine().Trim();
            return lines;
        }

        public static void WriteArray<T>(IEnumerable<T> array)
        {
            Writer.WriteLine(string.Join(" ", array));
        }

#endregion
    }
}


using System;
using System.Linq;

namespace Codeforces
{
  public static class Algr
  {
    public static string Solve(string input)
    {
      var array = input.Split(' ')
        .Select(x => Int32.Parse(x))
        .ToArray();

      int n = array[0];
      int m = array[1];
      int a = array[2];
      int b = array[3];

      double costB = (double) b / m;
      int r = 0;

      if (a <= costB)
      {
        r = n * a;
      }

      else
      {
        r = (n / m) * b;
        r += Math.Min((n - ((n / m) * m)) * a, b);
      }

      return r.ToString();
    }
  }

  class Program
  {
    static void Main(string[] args)
    {
      Console.WriteLine(Algr.Solve(Console.ReadLine()));
    }
  }
}


using System;

public class Test
{
	public static void Main()
	{
		string s = Console.ReadLine();
		char lolo= s[0];
		int eee = Convert.ToInt16(Convert.ToString(s[1]));
		int it=8; bool prov=true;
		if ((lolo=='h')||(lolo=='a'))
		{
			prov=false;
			it-=3;
		}
		if ((eee==1)||(eee==8))
		{
			if (prov) it-=3;
			else it-=2;
		}
		Console.WriteLine(it);
	}
}


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

namespace project
{
    class Program
    {
        public static void Main(string[] args)
        {
            long X = 10000010 , Y = 1;
            long ansX = 0 , ansY = 0 ;
            string input = Console.ReadLine();
            long x = long.Parse(input.Split(new char[] { ' ' })[0]);
            long y = long.Parse(input.Split(new char[] { ' ' })[1]);
            long n = long.Parse(input.Split(new char[] { ' ' })[2]);
            for (long i = 1; i <= n; i++)
            {
                bool flag = true;
                long tx, ty , t;
                ty = i * y;
                t = i * x / y;
                tx = Math.Min(Math.Abs(i * x - t * y), Math.Abs(i * x - (t + 1) * y));
                if (tx != Math.Abs(i * x - t * y))
                    flag = false;
                if (tx * Y < ty * X)
                {
                    X = tx;
                    Y = ty;
                    if (flag == true)
                        ansX = t;
                    else
                        ansX = t + 1;
                    ansY = i;
                }
            }
            Console.WriteLine(ansX + "/" + ansY);
        }
    }
}


// Author : Suvash Kumar Sumon

using System;

namespace CS_Repo
{
    class Program2
    {
        static void Main(string [] args)
        {
            int n = int.Parse(Console.ReadLine());
            var raw = Console.ReadLine().Split();
            int a;
            int sum = 0, b = -1, q = 0;
            for (int i = 0; i < n; i++)
            {
                a = int.Parse(raw[i]);
                sum += a;
                q += 1 - 2 * a;
		        b = Math.Max(b, q);
		        q = Math.Max(0, q);
            }
             Console.WriteLine(sum+b);
        }
    }

}


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

namespace ConsoleApplication5
{
    class Program
    {

        static void Main(string[] args)
        {
            Console.ReadLine();
            string simple =
                "31 28 31 30 31 30 31 31 30 31 30 31 "+
                "31 28 31 30 31 30 31 31 30 31 30 31 "+
                "31 28 31 30 31 30 31 31 30 31 30 31 " +
                "31 29 31 30 31 30 31 31 30 31 30 31 "+
                "31 28 31 30 31 30 31 31 30 31 30 31 "+
                "31 28 31 30 31 30 31 31 30 31 30 31" ;
           string s = Console.ReadLine();
            if(simple.Contains(s))
                Console.WriteLine("YES");
            else Console.WriteLine("NO");
        }

    }
}


using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        long l = int.Parse(str[0]);
        long r = int.Parse(str[1]);
        long x = int.Parse(str[2]);
        long y = int.Parse(str[3]);
        long k = int.Parse(str[4]);
        for(long i=x;i<=y;i++){
            if(l <= i*k && i*k <= r){
                sb.Append("YES\n");
                return;
            }
        }
        sb.Append("NO\n");
    }
}


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

public class Program
{
	public static void Main()
	{
		int n=Convert.ToInt32(Console.ReadLine());
		string s=Console.ReadLine();
		string[] p={"vaporeon", "jolteon", "flareon", "espeon", "umbreon", "leafeon", "glaceon", "sylveon"};
		int q=0;
		var qq=s.Where(x=>x!='.').Count();
		for(int i=0; i<8; i++)
		{
			if(p[i].Length==n)
			{
				var ch=p[i].ToCharArray();
					for(int l=0; l<n; l++)
					{
						if(s[l]==ch[l])
						{
							q++;
						}
					}
				if(qq==q)
				{
					Console.WriteLine(p[i]);
					break;
				}
				q=0;
			}
		}
	}
}


using System;
using System.Linq;
using System.Diagnostics;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;

namespace Program
{

    public class Solver
    {
        public void Solve()
        {
            var a = sc.Integer();
            var b = sc.Integer();
            var c = sc.Integer();
            var v = b - a;
            if (c == 0)
            {
                if (a == b)
                    IO.Printer.Out.WriteLine("YES");
                else IO.Printer.Out.WriteLine("NO");
                return;
            }
            if (v % c == 0 && v / c >= 0)
                IO.Printer.Out.WriteLine("YES");
            else IO.Printer.Out.WriteLine("NO");
        }
        public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
        static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}

#region main
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion
#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Text;
    using System.Globalization;
    public class Printer : StreamWriter
    {
        static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }
        public static Printer Out { get; set; }
        public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        public readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }

        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public string ScanLine()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b != '\n'; b = (char)read())
                if (b == 0) break;
                else if (b != '\r') sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != 0 && b != '-' && (b < '0' || '9' < b));
            if (b == 0) return long.MinValue;
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { var s = Scan(); return s != "" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN; }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public char[] Char(int n) { return enumerate(n, Char); }
        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
    }
}
#endregion