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

class Program
{
    private static void Main(string[] args)
    {
        int n = ReadInt();
        int[] m = ReadIntArray(n).Distinct().ToArray();
        Array.Sort(m);
        for (int i = 1; i < n - 1; i++)
            if (m[i] == m[i - 1] + 1 && m[i] == m[i + 1] - 1)
            {
                Console.Write("YES");
                return;
            }
        Console.Write("NO");
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n + 1];
        for (int i = 0; i <= n; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = ReadInt() - 1;
            int b = ReadInt() - 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 = ReadInt();
            int b = ReadInt();
            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 ReadInt()
    {
        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 ReadULong()
    {
        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 ReadLong()
    {
        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[] ReadIntArray(int n)
    {
        int[] ans = new int[n];
        for (int i = 0; i < n; i++)
            ans[i] = ReadInt();
        return ans;
    }

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

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

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

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

        return s.ToArray();
    }

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

        do
        {
            ans = consoleReader.Read();
        } while (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');

        return s;
    }

    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 ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

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

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

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

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

    private static void PushTestData(string data)
    {
#if !ONLINE_JUDGE
        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
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Configuration;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using System.Text;
using System.Threading.Tasks;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();
            string[] numbers = line.Split(' ');
            int a = int.Parse(numbers[0]);
            int b = int.Parse(numbers[1]);

            if(a == b)
                Console.WriteLine(a + " " + b);
            else if (a > b)
            {
                int temp = a - b;
                temp = temp / 2;
                Console.WriteLine(b +" " + temp);
            }
            else
            {
                int temp = b - a;
                temp = temp / 2;
                Console.WriteLine(a + " " + temp);
            }
            Console.ReadLine();
        }


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

namespace A.Vasya_the_Hipster
{
    class Program
    {
        static void Main(string[] args)
        {
            start:
            int[] omar = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int res = omar.Min();
            int mod = omar.Max() - omar.Min();
            if (mod % 2 != 0 && mod > 2)
            {
                mod--;
            }
            if (mod == 1)
                mod = 0;

            Console.Write(res+" "+mod/2);
            goto start;
        }
    }
}


using System;
using System.IO;

namespace A
{
	class Program
	{
		static void Main(string[] args)
		{
			StreamReader sr = new StreamReader("input.txt");
			StreamWriter sw = new StreamWriter("output.txt");

			string[] input_line = sr.ReadLine().Split();

			int a = Convert.ToInt32(input_line[0]);
			int b = Convert.ToInt32(input_line[1]);

			if (a < b)
				sw.Write(a + " " + ((b - a) / 2));
			else
				sw.Write(b + " " + ((a - b) / 2));

			sr.Close();
			sw.Close();
		}
	}
}


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

namespace CodeforcesTemplate
{
    public static class Permutation
    {
        private static bool Next(ref int[] arr)
        {
            int k, j, l;
            for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }
            if (j == -1)
            {
                arr = arr.OrderBy(c => c).ToArray();
                return false;
            }
            for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }
            var tmp = arr[j];
            arr[j] = arr[l];
            arr[l] = tmp;
            for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)
            {
                tmp = arr[k];
                arr[k] = arr[l];
                arr[l] = tmp;
            }
            return true;
        }
        public static IEnumerable<int[]> AllPermutations(int[] arr)
        {
            do yield return arr;
            while (Next(ref arr));
        }
    }

    class Program
    {
        private const string FILENAME = "distance4";

        private const string INPUT = FILENAME + ".in";

        private const string OUTPUT = FILENAME + ".out";

        private static Stopwatch _stopwatch = new Stopwatch();

        private static StreamReader _reader = null;
        private static StreamWriter _writer = null;

        private static string[] _curLine;
        private static int _curTokenIdx;

        private static char[] _whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        private static string ReadNextToken()
        {
            if (_curTokenIdx >= _curLine.Length)
            {
                //Read next line
                string line = _reader.ReadLine();
                if (line != null)
                    _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    _curLine = new string[] { };
                _curTokenIdx = 0;
            }

            if (_curTokenIdx >= _curLine.Length)
                return null;

            return _curLine[_curTokenIdx++];
        }

        private static int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        private static void RunTimer()
        {
#if (DEBUG)

            _stopwatch.Start();

#endif
        }

        private static void Main(string[] args)
        {

#if (DEBUG)
            double before = GC.GetTotalMemory(false);
#endif

            int n = int.Parse(Console.ReadLine());

            int s = ((1 + n / 2) * (n / 2));

            if (n % 2 == 0)
            {
                s += (n + 1) / 2;
            }

            Console.WriteLine(s);

#if (DEBUG)
            _stopwatch.Stop();

            double after = GC.GetTotalMemory(false);

            double consumedInMegabytes = (after - before) / (1024 * 1024);

            Console.WriteLine($"Time elapsed: {_stopwatch.Elapsed}");

            Console.WriteLine($"Consumed memory (MB): {consumedInMegabytes}");

            Console.ReadKey();
#endif

        }

        private static int CountLeadZeros(string source)
        {
            int countZero = 0;

            for (int i = source.Length - 1; i >= 0; i--)
            {
                if (source[i] == '0')
                {
                    countZero++;
                }

                else
                {
                    break;
                }

            }

            return countZero;
        }

        private static string ReverseString(string source)
        {
            char[] reverseArray = source.ToCharArray();

            Array.Reverse(reverseArray);

            string reversedString = new string(reverseArray);

            return reversedString;
        }

        private static int[] CopyOfRange(int[] src, int start, int end)
        {
            int len = end - start;
            int[] dest = new int[len];
            Array.Copy(src, start, dest, 0, len);
            return dest;
        }

        private static string StreamReader()
        {

            if (_reader == null)
                _reader = new StreamReader(INPUT);
            string response = _reader.ReadLine();
            if (_reader.EndOfStream)
                _reader.Close();
            return response;

        }

        private static void StreamWriter(string text)
        {

            if (_writer == null)
                _writer = new StreamWriter(OUTPUT);
            _writer.WriteLine(text);

        }

        private static int BFS(int start, int end, int[,] arr)
        {
            Queue<KeyValuePair<int, int>> queue = new Queue<KeyValuePair<int, int>>();
            List<bool> visited = new List<bool>();
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                visited.Add(false);
            }

            queue.Enqueue(new KeyValuePair<int, int>(start, 0));
            KeyValuePair<int, int> node;
            int level = 0;
            bool flag = false;

            while (queue.Count != 0)
            {
                node = queue.Dequeue();
                if (node.Key == end)
                {
                    return node.Value;
                }
                flag = false;
                for (int i = 0; i < arr.GetLength(0); i++)
                {

                    if (arr[node.Key, i] == 1)
                    {
                        if (visited[i] == false)
                        {
                            if (!flag)
                            {
                                level = node.Value + 1;
                                flag = true;
                            }
                            queue.Enqueue(new KeyValuePair<int, int>(i, level));
                            visited[i] = true;
                        }
                    }
                }

            }
            return 0;

        }

        private static void Write(string source)
        {
            File.WriteAllText(OUTPUT, source);
        }

        private static string ReadString()
        {
            return File.ReadAllText(INPUT);
        }

        private static void WriteStringArray(string[] source)
        {
            File.WriteAllLines(OUTPUT, source);
        }

        private static string[] ReadStringArray()
        {
            return File.ReadAllLines(INPUT);
        }

        private static int[] GetIntArray()
        {
            return ReadString().Split(' ').Select(int.Parse).ToArray();
        }

        private static double[] GetDoubleArray()
        {
            return ReadString().Split(' ').Select(double.Parse).ToArray();
        }

        private static int[,] ReadINT2XArray(List<string> lines)
        {
            int[,] arr = new int[lines.Count, lines.Count];

            for (int i = 0; i < lines.Count; i++)
            {
                int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();

                for (int j = 0; j < lines.Count; j++)
                {
                    arr[i, j] = row[j];
                }
            }

            return arr;
        }
    }
}


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

class Program{
    static void Main(string[] args){
        string[] input = Console.ReadLine().Split(' ');
        int ridesPlanned = Int32.Parse(input[0]);
        int ridesInSpecialTicket=Int32.Parse(input[1]);
        int priceForSingleRide= Int32.Parse(input[2]);
        int priceForSpecialRides=Int32.Parse(input[3]);

        if (ridesPlanned == 0)
                Console.WriteLine(0);
            else if (ridesInSpecialTicket == 0)
                Console.WriteLine(ridesPlanned * priceForSingleRide);

            else
            {

                if (ridesPlanned % ridesInSpecialTicket == 0)
                    Console.WriteLine((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides);
                else{
                    int cost = (ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides + (ridesPlanned % ridesInSpecialTicket) * priceForSingleRide;
                    int x = ridesPlanned / ridesInSpecialTicket + 1;
                    if(x*priceForSpecialRides < cost)
                    {
                        ConsoleWriteLine(x * priceForSpecialRides);
                    }
                }
            }

        }
}


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

class Program{
    static void Main(string[] args){
        string[] input = Console.ReadLine().Split(' ');
        int ridesPlanned = Int32.Parse(input[0]);
        int ridesInSpecialTicket=Int32.Parse(input[1]);
        int priceForSingleRide= Int32.Parse(input[2]);
        int priceForSpecialRides=Int32.Parse(input[3]);

        if (ridesPlanned == 0)
                return 0;
            else if (ridesInSpecialTicket == 0)
                return ridesPlanned * priceForSingleRide;

            else
            {
                if (ridesPlanned % ridesInSpecialTicket == 0)
                        return (ridesPlanned * priceForSingleRide)< ((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides)? ridesPlanned * priceForSingleRide :(ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides;
                else
                {
                    if (((ridesPlanned / ridesInSpecialTicket + 1) * priceForSpecialRides) < ((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides + (ridesPlanned % ridesInSpecialTicket) * priceForSingleRide))
                        return (ridesPlanned / ridesInSpecialTicket + 1) * priceForSpecialRides;
                    else
                        return ((ridesPlanned / ridesInSpecialTicket) * priceForSpecialRides + (ridesPlanned % ridesInSpecialTicket) * priceForSingleRide);
                }
            }

        }
}


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

namespace CodeForcesProblems
{
    class A466_CheapTravel
    {
        public static void Main()
        {
            while (true)
            {
                string[] z = Console.ReadLine().Split(' ');
                int n = int.Parse(z[0]);
                int m = int.Parse(z[1]);
                int a = int.Parse(z[2]);
                int b = int.Parse(z[3]);
                double c =(double) b / m;
                if(c>a)
                {
                    Console.WriteLine(a*n);
                }
                else
                {
                    int t = n / m;
                    int result = (t * b);  //+((n-(t*m))*a);

                    if (((n - (t * m)) * a) > b)
                        result += b;
                    else
                        result += ((n - (t * m)) * a);

                    Console.WriteLine(result);
                }

            }
        }
    }
}


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

namespace Ladder4
{
    class Prob21
    {
        static void Main(string[] args)
        {
            List<int> input = Console.ReadLine().Split(' ').Select(alias => int.Parse(alias)).ToList();
            int rides = input[0];
            int loop = rides;
            int multipleRides = input[1];
            int oneRide = input[2];
            int multiplePrice = input[3];
            int sum = 0;

            if (multipleRides * oneRide < multiplePrice)
                Console.WriteLine(loop * oneRide);
            else
            {
                int x = loop / multipleRides * multiplePrice;
                int restRides = loop % multipleRides;
                if (restRides * oneRide > multiplePrice)
                    x += multiplePrice;
                else
                    x += restRides * oneRide;
                Console.WriteLine(x);
            }
            while (true) ;
        }
    }
}


using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
class Problem
{
    static void Main()
    {
        //--------------------------------input--------------------------------//

        var v = Array.ConvertAll( Console.ReadLine().Split(), Convert.ToInt32 );

        //--------------------------------solve--------------------------------//

        int n = v[0],m=v[1],a=v[2],b=v[3];
        if(b / m > a)
            Console.WriteLine( a * n );
        else
        {
            int kq=0;
            kq = ( n / m ) * b + ( n % m ) * a;
            Console.WriteLine( Math.Min(kq,(n/m+1)*b );
        }

    }
}


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

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            String[] inp = new String[4];
            for (int i = 0; i < 4; ++i)
            {
                inp[i] = Console.ReadLine();
            }
            int s;
            for (int i = 1; i < 10; ++i)
            {
                s = 0;
                for (int j = 0; j < 4; ++j)
                {
                    for (int k = 0; k < 4; ++k)
                    {
                        if (inp[j][k] - '0' == i)
                        {
                            s++;
                        }
                    }
                }
                if (s > n)
                {
                    Console.WriteLine("NO");
                    return;
                }
            }
            Console.WriteLine("YES");
        }
    }
}


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

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            var line = Console.ReadLine().Split(' ');
            var N = int.Parse(line[0]);
            //var board = new int[4, 4];
            var set = new HashSet<int>();
            var numbers = new int[10];
            for (int n = 0; n <= 4; n++)
            {
                var s = Console.ReadLine();
                for (int i = 0; i < 4; i++)
                {

                    if (s[i] != '.')
                    {
                        var number = int.Parse(s[i].ToString());
                        numbers[number]++;
                    }
                }
            }
            var success = numbers.All(i => i <= N);

            string ans = success ? "YES" : "NO";
            Console.WriteLine(ans);
        }
    }
}


using System;

namespace olymp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            int e = 0;
            int[] k = new int[9];
            string input;
            while (e != 4)
            {
                input = Console.ReadLine();
                for (int i = 0; i < 4; i++)
                    if (input[i] != '.')
                        k[Int32.Parse(input.Substring(i, 1)) - 1] += 1;
                e++;
            }
            n *= 2;
            bool b = true;
            for (int i = 0; i < 4; i++)
                if (k[i] > n)
                {
                    b = false;
                    break;
                }
            Console.WriteLine(b ? "YES" : "NO");
        }
    }
}


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

namespace _373A___Collecting_Beats_is_Fun
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = Int32.Parse(Console.ReadLine());

            string[] lines = new string[4];
            for (int i = 0; i < 4; i++)
            {
                lines[i] = Console.ReadLine();
            }

            int[] numbers = new int[17];

            for (int i = 0; i < lines.Length; i++)
            {
                for (int j = 0; j < lines[i].Length; j++)
                {
                    if (lines[i][j] != '.')
                    {
                        numbers[Int32.Parse(lines[i][j].ToString())]++;
                    }
                }
            }

            for (int i = 0; i < numbers.Length; i++)
            {
                if (numbers[i] > 2 * k)
                {
                    Console.WriteLine("NO");
                    return;
                }
            }

            Console.WriteLine("Yes");
        }
    }
}


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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        int k = ReadInt();
        var cnt = new int[100];
        foreach (char ch in string.Concat(ReadLines(4)))
            cnt[ch]++;
        Write(cnt.Max() > 2 * k ? "NO" : "YES");
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("cycle.in");
        //writer = new StreamWriter("cycle.out");
#endif
        try
        {
            //            var thread = new Thread(new Solver().Solve, 1024 * 1024 * 128);
            //            thread.Start();
            //            thread.Join();
            new Solver().Solve();
        }
        catch (Exception ex)
        {
#if DEBUG
            Console.WriteLine(ex);
#else
            Console.WriteLine(ex);
            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);
    }

    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; }
        }
    }

    #endregion
}


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 k = Int32.Parse(Console.ReadLine());
            Dictionary<int, int> match = new Dictionary<int, int>();
            for (int i = 0; i< 4; i++)
            {
                string goal = Console.ReadLine();
                for(int j=0;j< 4; j++)
                {
                    if (goal[j] == '.') continue;
                    int time = goal[j] - '0';
                    if (!match.ContainsKey(time))
                    {
                        match.Add(time, 1);
                    }
                    else
                    {
                        match[time]++;
                    }
                }

            }
            int maxPressed = k * 2;
            if(match.OrderByDescending(x => x.Value).ElementAt(0).Value > maxPressed)
            {
                Console.WriteLine("NO");
            } else
                Console.WriteLine("YES");
        }
    }
}


using System;

namespace _219A
{
    class Program
    {
        static void Main(string[] args)
        {
            int k = int.Parse(Console.ReadLine());
            string s;
            char[,] a = new char[4, 4];

            for (int i=0; i<4;i++)
            {
                s = Console.ReadLine();
                for(int j = 0; j<4 ; j++)
                {
                    a[i, j] = s[j];

                }

           }

            bool flag = true;
            int counter;
            for (int i = 1; i <= 9; i++)
            {
                counter = 0;
                for (int j = 0; j < 4; j++)
                {

                    for (int m = 0; m < 4; m++)
                    {
                        if (a[j, m] - '0' == i) counter++;

                    }

                }
                if (counter > k) { flag = false; break; }
            }

            s = flag ? "YES" : "NO";
            Console.WriteLine(s);

        }
    }
}


using System;

namespace ConsoleApplication23
{
    class Program
    {
        static void Main(string[] args)
        {
            while (true)
            {

            string str = Console.ReadLine();
            string[] str2 = str.Split(' ');
            if (int.Parse(str2[3]) / int.Parse(str2[1]) >=int.Parse(str2[2]))
            {
                Console.WriteLine(int.Parse(str2[2]) * int.Parse(str2[0]));
            }
            else
            {
                int counter = int.Parse(str2[0]);
                int answer = 0;
                do
                {
                    answer = answer + int.Parse(str2[3]);
                    counter = counter - int.Parse(str2[1]);
                } while (int.Parse(str2[1]) < counter);
                if (counter < 0)
                    counter = 0;

                if (int.Parse(str2[2]) < int.Parse(str2[3]) || counter == 0)
                {
                    answer = answer + int.Parse(str2[2]) * counter;
                }
                else
                {
                    answer = answer + int.Parse(str2[3]);
                }
                Console.WriteLine(answer);
            }
            }

            Console.ReadLine();
        }
    }
}


class programm
{
  static void main()
    {
      int n,m,a,b;
      n=Convert.ToInt32(Console.ReadLine());
      m=Convert.ToInt32(Console.ReadLine());
      a=Convert.ToInt32(Console.ReadLine());
      b=Convert.ToInt32(Console.ReadLine());
      if (a*m<=b) {Console.WriteLine(a*n)}
      else {Console.WriteLine(n/m*b+max(n%m*a,b))};

    }
}


using System;
namespace Myprogramm
{
  class programm
  {
    static void Main()
      {
        int n,m,a,b;
        n=Convert.ToInt32(Console.ReadLine());
        m=Convert.ToInt32(Console.ReadLine());
        a=Convert.ToInt32(Console.ReadLine());
        b=Convert.ToInt32(Console.ReadLine());
        if (a*m<=b) {Console.WriteLine(a*n);}
        else
          {if (n%m*a>b) {a=n%m*a;}
           else {a=b;};
          Console.WriteLine(n/m*b+a);};

      }
  }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "A", "A\A.csproj", "{72C18F33-1F07-490F-98D2-4940AA438842}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{72C18F33-1F07-490F-98D2-4940AA438842}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{72C18F33-1F07-490F-98D2-4940AA438842}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{72C18F33-1F07-490F-98D2-4940AA438842}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{72C18F33-1F07-490F-98D2-4940AA438842}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


using System;

using System.Text;

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] mass=new string[4];
            string s;
            s=Console.ReadLine();
            mass=s.Split(new char[] {' '}, 4);
            int n= Convert.ToInt16(mass[0]);
            int m=Convert.ToInt16(mass[1]);
            int a=Convert.ToInt16(mass[2]);
            int b=Convert.ToInt16(mass[3]);
            int g=0;
            int t;

            if(n<m && b<a)
            {Console.WriteLine(b);}
            if(n<m && b>a)
            {
                for(t=n;t>0;t--)
                    {
                        a=a+1;
                    }
                     Console.WriteLine(a);
            }
            t = 0;
            if(n>m)
            {
                bool poka = true;
                while(poka==true)
                {
                    n = n - m;
                    g = g + b;

                    if (n < m && b < a)
                    { Console.WriteLine(g + b); poka = false; }
                    if (n < m && b > a)
                    {
                        for (t = n; t > 0; t--)
                        {
                            g = g + a;
                        }
                        Console.WriteLine(g);
                        poka = false;
                    }
                }
            }
            s=Console.ReadLine();
        }
    }
}


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    long Sum(int from, int to)
    {
        int len = to - from + 1;
        return 1L * from * len + 1L * len * (len - 1) / 2;
    }

    long Fun(int height, int width, int start, int cut)
    {
        long ret = 0;
        if (start - height + 1 <= cut)
            ret += Sum(1, Math.Min(height - 1, cut - start + height));
        if (start <= cut)
            ret += 1L * height * (Math.Min(width, cut - start) + 1);
        if (start + width + 1 <= cut)
            ret += Sum(Math.Max(1, start + width + height - cut), height - 1);
        return ret;
    }

    void Solve()
    {
        int a = ReadInt();
        int b = ReadInt();
        int c = ReadInt();
        int v = ReadInt();
        int s = a + b + c;
        long ans = 0;
        for (int i = 0; i <= v; i++, s++)
        {
            int s2 = (s - 1) / 2;
            int ca = s2 - a;
            int cb = s2 - b;
            int cc = s2 - c;
            if (ca < 0 || cb < 0 || cc < 0)
                continue;
            int min = Math.Min(cb, cc);
            int max = Math.Max(cb, cc);
            ans += Fun(min + 1, max - min, i - cb - cc + min, ca) - Fun(min + 1, max - min, i - cb - cc + min, -1);
        }

        Write(ans);
    }

    #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("transform.in");
        writer = new StreamWriter("transform.out");
#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.Text;
using System.Linq;
using System.Collections.Generic;

namespace SeaBattle
{
    class Program
    {

        public static void Main()
        {
            char[] hello = { 'h', 'e', 'l', 'l', 'o' };
            string word = Console.ReadLine();
            int equals = 0;
            foreach(char letter in word)
            {
                if(letter == hello[equals])
                {
                    equals++;
                }
            }
            if(equals == 5)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
    }
    //struct Vector3
    //{
    //    public int x;
    //    public int y;
    //    public int z;
    //    public Vector3(int[] ar)
    //    {
    //        x = ar[0];
    //        y = ar[1];
    //        z = ar[2];
    //    }
    //    public bool IsEquilibriun(Vector3 vector)
    //    {
    //        if (x + vector.x == 0 && y + vector.y == 0 && z + vector.z == 0)
    //        {
    //            return true;
    //        }
    //        return false;
    //    }
    //}
}


using System;

namespace _58A
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            string hello = "hello";
            int  j = 0;

            for(int i = 0; i < s.Length; i++)
            {
                if(s[i] == hello[j])
                {
                    j++;
                }
            }
            if(j == 5)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }

    }
}


using System;
using System.Collections.Generic;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            String s = Console.ReadLine();
            String res = "";
            String[] table = new String[5] { "h", "e", "l", "l", "o" };

            int model = 0;

            for (int i = 0; i < s.Length; i++)
            {
                if (s[i].ToString().Equals(table[model].ToString()))
                {
                    res += table[model];
                    model++;
                }
            }

            if (res.Equals("hello"))
            {
                Console.Write("YES");
            }

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

        }
    }
}


using System;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            String s = Console.ReadLine().ToString() ;
            String res = "";
            char[] table = new char[5] { 'h', 'e', 'l', 'l', 'o'};

            int model = 0;

            for (int i = 0; i < s.Length; i++)
            {
                if (s[i]==(table[model]))
                {
                    res += table[model];
                    model++;
                }
            }
            Console.WriteLine(res.Equals("hello") ? "YES" : "NO");
        }
    }
}


#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

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

namespace ed32e
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

        static void Main(string[] args)
        {
            StreamWriter file = null;
#if DEBUG
			Console.SetIn(getInput());
#else
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }
#endif

            try
            {
                solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }
        }

        static void solution()
        {
            #region SOLUTION

            var d = readIntArray();
            var n = d[0];
            var m = d[1];
            var a = readIntArray();

            var fh = n / 2;
            if (n % 2 == 1)
            {
                fh++;
            }
            var sh = n / 2;

            var mv = 0;
            for (int i = 0; i < fh; i++)
            {
                mv |= 1 << i;
            }

            var arr = new long[mv + 1];
            for (int i = 0; i <= mv; i++)
            {
                arr[i] = sum(i, a, m, 0);
            }

            Array.Sort(arr);
            var max = arr[arr.Length - 1];

            var sm = 0;
            //for (int i = mv; i < n; i++)
            //{
            //    sm &= 1 << i;
            //}

            for (int i = 0; i < sh; i++)
            {
                sm |= 1 << i;
            }

            //var smin = mv + 1;
            var res = long.MinValue;
            for (int i = 0; i <= sm; i++)
            {
                var val = sum(i, a, m, fh);
                var nr = (val + max) % m;
                if (nr > res)
                {
                    res = nr;
                }

                var req = m - val - 1;
                if (req <= 0)
                {
                    continue;
                }

                var l = 0;
                var r = arr.Length - 1;
                while (true)
                {
                    if (l == r)
                    {
                        break;
                    }

                    var mid = l + (r - l + 1) / 2;
                    var vv = arr[mid];
                    if (vv <= req)
                    {
                        l = mid;
                    }
                    else
                    {
                        r = mid - 1;
                    }
                }

                if (arr[l] <= req)
                {
                    if (val + arr[l] > res)
                    {
                        res = val + arr[l];
                    }
                }
            }

            Console.WriteLine(res);
            //var n = readInt();
            //var m = readInt();

            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

        static long sum(int pattern, int[] a, int m, int start)
        {
            var res = 0;
            for (int i = 0; i < 20; i++)
            {
                if ((pattern & (1 << i)) != 0)
                {
                    res += a[i + start];
                    res %= m;
                }
            }

            return res;
        }

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

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

        static int[] readIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] readLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
    }
}


using System;

class Program
{
    static void Main(string[] args)
    {
        int red = int.Parse(Console.ReadLine());
        int blue = int.Parse(Console.ReadLine());
        int resultDoubleSocks;
        int otherSocks;

        if (red > blue)
        {
            resultDoubleSocks = red - (red - blue);
            otherSocks = (red - blue) / 2;
            Console.WriteLine(resultDoubleSocks + " " + otherSocks);
        }
        else
        {
            resultDoubleSocks = blue - (blue - red);
            otherSocks = (blue - red) / 2;
            Console.WriteLine(resultDoubleSocks + " " + otherSocks);
        }
    }
}


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

class Program {
    static void Main(string[] args) {
        int x = 10, sum;
        string[] s = Console.ReadLine().Split();
        int l = int.Parse(s[0]);
        int r = int.Parse(s[1]);
        while (r >= x) {
            x *= 10;
        }
        if (r >= x / 2 && l <= x / 2 - 1) {
            sum = x / 2 - 1;
        }
        else if (l > x / 2 - 1) {
            sum = l;
        }
        else {
            sum = r;
        }
        Console.WriteLine(sum * (x - sum - 1));
    }
}


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

namespace CF
{
	class Program
	{
		const int MOD = 1000000007;

		static void Main(string[] args)
		{
			new Program().run();
		}

		long quickpow(long a, long exp)
		{
			long res = 1;
			while(exp > 0)
			{
				if((exp & 1) == 1)
				{
					res *= a;
					res %= MOD;
				}
				a = a*a;
				a %= MOD;
				exp >>= 1;
			}
			return res % MOD;
		}

		void run()
		{
			long[] arr = ReadLong();

			long x = arr[0], n = arr[1];

			List<long> prime = new List<long>();

			long tmp = x;
			for(long i = 2; i * i <= tmp; ++i)
			{
				if(tmp % i == 0)
				{
					prime.Add(i);
					while(tmp % i == 0)
						tmp /= i;
				}
			}

			if(tmp > 1)
				prime.Add(tmp);

			long res = 1;
			foreach(long p in prime)
			{
				long tn = n;
				long exp = 0;
				while(tn / p > 0)
				{
					exp += (tn / p);
					exp %= MOD;
					tn /= p;
				}

				//Console.WriteLine("test: {0} {1} {2}", tn, p, exp);

				res *= (quickpow(p, exp) % MOD);
				res %= MOD;
			}

			Console.WriteLine(res % MOD);
			//Console.ReadLine();

		}

		long[] ReadLong()
		{
			return Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
		}
	}
}


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

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

			long x = Convert.ToInt64(str[0]);
			long n = Convert.ToInt64(str[1]);

			List<long> primes = new List<long>();

			for (long i = 2; i * i <= x; ++i)
			{
				if (isPrime(i) && x % i == 0)
					primes.Add(i);
			}

			if (isPrime(x))
				primes.Add(x);

			long mod = 1000000007;
			long res = 1;

			List<long> powers = new List<long>();

			for (int i = 0; i < primes.Count(); ++i)
			{
				powers.Add(powerInFact(n, primes[i]));
			}

			for (int i = 0; i < primes.Count(); ++i)
			{
				if (powers[i] != 0)
				{
					res = (res * (binpow(primes[i], powers[i], mod) % mod)) % mod;
				}
			}

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

		public static bool isPrime(long n)
		{
			for (long i = 2; i * i <= n; ++i)
			{
				if (n % i == 0)
					return false;
			}

			return true;
		}

		public static long powerInFact(long n, long k)
		{
			long res = 0;
			while (n > 0)
			{
				n /= k;
				res += n;
			}
			return res;
		}

		public static long binpow(long a, long n, long mod)
		{
			if (n == 0)
				return 1;
			if (n % 2 == 1)
				return ((binpow(a, n - 1, mod) % mod) * a) % mod;
			else
			{
				long b = binpow(a, n / 2, mod) % mod;
				return (b * b) % mod;
			}
		}
	}
}


/*
csc -debug C.cs && mono --debug C.exe <<< "10 2"
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Reflection;
// using System.Numerics;

public class HelloWorld {
    public static void SolveCodeForces() {
        var x = cin.NUL();
        var n = cin.NUL();

// var sieve = GetPrimeSieve(13);
// var primes = new List<int>();
// for (var p = 2; p < sieve.Length; p++) if (!sieve[p]) primes.Add(p);
// System.Console.WriteLine("Sieve: " + primes.Join());
        // var sieve = GetPrimeSieve(100);
        var sieve = GetPrimeSieve(100000);

        var primeDivs = new HashSet<ulong>();
        for (var p = 1ul; p * p <= x; p++)
            if (x % p == 0) {
                if (p > 1 && !sieve[p]) primeDivs.Add(p);
                var q = x / p;
                if (q > 1 && q != p && (int)q < sieve.Length && !sieve[q]) primeDivs.Add(q);
            }
        if (primeDivs.Count == 0)
            primeDivs.Add(x);

// System.Console.WriteLine(primeDivs.Join());

        var ans = 1ul;

        // BigInteger nn = n;

        foreach (var p in primeDivs) {
            var pow = 0ul;

            // var ppow = p;
            // while (ppow <= n) {
            //     pow += n / ppow;
            //     ppow *= p;
            // }

            // BigInteger ppow = p;
            // while (ppow <= n) {
            //     pow += n / (ulong)ppow;
            //     ppow *= p;
            // }

            var ppow = 1ul;
            while (ppow <= n / p) {
                ppow *= p;
                pow += n / ppow;
            }

            var curr = ModPow(p, pow, MOD);

            ans = ans * curr % MOD;
        }

        System.Console.WriteLine(ans);
    }

    const ulong MOD = 1000000007ul;

    public static ulong ModPow(ulong x, ulong exp, ulong mod) {
        ulong ret = 1ul;
        while (exp > 0) {
            if (exp % 2 == 1) ret = ret * x % mod;
            x = x * x % mod;
            exp /= 2;
        }
        return ret;
    }

    static bool[] GetPrimeSieve(int max) {
        var sieve = new bool[max + 1];
        for (var a = 2; 2 * a <= max; a++) {
            if (!sieve[a]) {
                for (var b = 2 * a; b <= max; b += a)
                    sieve[b] = true;
            }
        }
        return sieve;
    }

    static Scanner cin = new Scanner();
    static StringBuilder cout = new StringBuilder();

    static public void Main () {
        SolveCodeForces();
        // IncreaseStack(SolveCodeForces);
        // System.Console.Write(cout.ToString());
    }

    public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)
    {
        var thread = new Thread(action, stackSize);
        thread.Start();
        thread.Join();
    }
}

public static class Helpers {
    public static string Join<T>(this IEnumerable<T> arr, string sep = " ") {
        return string.Join(sep, arr);
    }

    public static void Swap<T>(ref T a, ref T b) {
        var tmp = a;
        a = b;
        b = tmp;
    }

    public static T[] CreateArray<T>(int length, Func<int, T> itemCreate) {
        var result = new T[length];
        for (var i = 0; i < result.Length; i++)
            result[i] = itemCreate(i);
        return result;
    }
}

public class Scanner
{
    private string[] line = new string[0];
    private int index = 0;

    public string Next() {
        if (line.Length <= index) {
            line = Console.ReadLine().Split(' ');
            index = 0;
        }
        var res = line[index];
        index++;
        return res;
    }

    public int NI() {
        return int.Parse(Next());
    }

    public long NL() {
        return long.Parse(Next());
    }

    public ulong NUL() {
        return ulong.Parse(Next());
    }

    public string[] Array() {
        line = Console.ReadLine().Split(' ');
        index = line.Length;
        return line;
    }

    public int[] NIA(int emptyPrefixLen = 0) {
        var array = Array();
        var result = new int[emptyPrefixLen + array.Length];
        for (int i = 0; i < array.Length; i++)
            result[emptyPrefixLen + i] = int.Parse(array[i]);
        return result;
    }

    public long[] NLA() {
        var array = Array();
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = long.Parse(array[i]);
        return result;
    }

    public ulong[] NULA() {
        var array = Array();
        var result = new ulong[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = ulong.Parse(array[i]);
        return result;
    }
}


/*
csc -debug C.cs && mono --debug C.exe <<< "10 2"
*/

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Reflection;
// using System.Numerics;

public class HelloWorld {
    public static void SolveCodeForces() {
        var x = cin.NUL();
        var n = cin.NUL();

// var sieve = GetPrimeSieve(13);
// var primes = new List<int>();
// for (var p = 2; p < sieve.Length; p++) if (!sieve[p]) primes.Add(p);
// System.Console.WriteLine("Sieve: " + primes.Join());
        // var sieve = GetPrimeSieve(100);
        var sieve = GetPrimeSieve(100000);

        var primeDivs = new HashSet<ulong>();
        for (var p = 1ul; p * p <= x; p++)
            if (x % p == 0) {
                if (p > 1 && !sieve[p]) primeDivs.Add(p);
                var q = x / p;
                if (q > 1 && q != p && (int)q < sieve.Length && !sieve[q]) primeDivs.Add(q);
                if (q > 1 && q != p && (int)q >= sieve.Length && IsPrime((int)q, 5)) primeDivs.Add(q);
            }
        if (primeDivs.Count == 0)
            primeDivs.Add(x);

// System.Console.WriteLine(primeDivs.Join());

        var ans = 1ul;

        // BigInteger nn = n;

        foreach (var p in primeDivs) {
            var pow = 0ul;

            // var ppow = p;
            // while (ppow <= n) {
            //     pow += n / ppow;
            //     ppow *= p;
            // }

            // BigInteger ppow = p;
            // while (ppow <= nn) {
            //     pow += n / (ulong)ppow;
            //     ppow *= p;
            // }

            var ppow = 1ul;
            while (ppow <= n / p) {
                ppow *= p;
                pow += n / ppow;
            }

            var curr = ModPow(p, pow, MOD);

            ans = ans * curr % MOD;
        }

        System.Console.WriteLine(ans);
    }

    const ulong MOD = 1000000007ul;

    public static ulong ModPow(ulong x, ulong exp, ulong mod) {
        ulong ret = 1ul;
        while (exp > 0) {
            if (exp % 2 == 1) ret = ret * x % mod;
            x = x * x % mod;
            exp /= 2;
        }
        return ret;
    }

    static bool[] GetPrimeSieve(int max) {
        var sieve = new bool[max + 1];
        for (var a = 2; 2 * a <= max; a++) {
            if (!sieve[a]) {
                for (var b = 2 * a; b <= max; b += a)
                    sieve[b] = true;
            }
        }
        return sieve;
    }

    public static bool IsPrime(int n, int k) {
        if ((n < 2) || (n % 2 == 0)) return (n == 2);

        int s = n - 1;
        while (s % 2 == 0)  s >>= 1;

        Random r = new Random();
        for (int i = 0; i < k; i++) {
            int a = r.Next(n - 1) + 1;
            int temp = s;
            long mod = 1;
            for (int j = 0; j < temp; ++j)  mod = (mod * a) % n;
            while (temp != n - 1 && mod != 1 && mod != n - 1) {
                mod = (mod * mod) % n;
                temp *= 2;
            }

            if (mod != n - 1 && temp % 2 == 0) return false;
        }
        return true;
    }

    static Scanner cin = new Scanner();
    static StringBuilder cout = new StringBuilder();

    static public void Main () {
        SolveCodeForces();
        // IncreaseStack(SolveCodeForces);
        // System.Console.Write(cout.ToString());
    }

    public static void IncreaseStack(ThreadStart action, int stackSize = 128000000)
    {
        var thread = new Thread(action, stackSize);
        thread.Start();
        thread.Join();
    }
}

public static class Helpers {
    public static string Join<T>(this IEnumerable<T> arr, string sep = " ") {
        return string.Join(sep, arr);
    }

    public static void Swap<T>(ref T a, ref T b) {
        var tmp = a;
        a = b;
        b = tmp;
    }

    public static T[] CreateArray<T>(int length, Func<int, T> itemCreate) {
        var result = new T[length];
        for (var i = 0; i < result.Length; i++)
            result[i] = itemCreate(i);
        return result;
    }
}

public class Scanner
{
    private string[] line = new string[0];
    private int index = 0;

    public string Next() {
        if (line.Length <= index) {
            line = Console.ReadLine().Split(' ');
            index = 0;
        }
        var res = line[index];
        index++;
        return res;
    }

    public int NI() {
        return int.Parse(Next());
    }

    public long NL() {
        return long.Parse(Next());
    }

    public ulong NUL() {
        return ulong.Parse(Next());
    }

    public string[] Array() {
        line = Console.ReadLine().Split(' ');
        index = line.Length;
        return line;
    }

    public int[] NIA(int emptyPrefixLen = 0) {
        var array = Array();
        var result = new int[emptyPrefixLen + array.Length];
        for (int i = 0; i < array.Length; i++)
            result[emptyPrefixLen + i] = int.Parse(array[i]);
        return result;
    }

    public long[] NLA() {
        var array = Array();
        var result = new long[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = long.Parse(array[i]);
        return result;
    }

    public ulong[] NULA() {
        var array = Array();
        var result = new ulong[array.Length];
        for (int i = 0; i < array.Length; i++)
            result[i] = ulong.Parse(array[i]);
        return result;
    }
}


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

namespace ConsoleApp5
{
    class Program
    {
        private static Stack<bool> GetBin(ulong number)
        {
            Stack<bool> NumInBinNot = new Stack<bool>();

            while (number != 0)
            {
                NumInBinNot.Push(number % 2 == 1);
                number /= 2;
            }
            return NumInBinNot;
        }
        public static ulong IntNumberToIntDegree(ulong IntNumber, ulong Pow)
        {
            ulong result = 1;
            Stack<bool> NumInBinNot = GetBin(Pow);
            while (NumInBinNot.Count != 0)
            {
                result *= result;
                result %= (int)(1e9 + 7);
                if (NumInBinNot.Pop())
                {
                    result *= IntNumber;
                    result %= (int)(1e9 + 7);
                }
            }
            return result;
        }
        static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split();
            ulong x = ulong.Parse(str[0]);
            ulong n = ulong.Parse(str[1]);
            HashSet<ulong> SimpleDividers = new HashSet<ulong>();
            ulong m = x;
            for (ulong i = 2; i<=Math.Sqrt(x); i++)
            {
                if (m % i == 0)
                {
                    SimpleDividers.Add(i);
                    while (m % i == 0)
                    {
                        m /= i;
                    }
                }
            }
            if (m > 1)
                SimpleDividers.Add(m);
            ulong result = 1;
            foreach(ulong dev in SimpleDividers)
            {
                ulong Degree = dev;
                ulong count = 0;
                for(; Degree<=n && Degree> 0; Degree*=dev)
                {
                    count += n / Degree;
                    if (Degree*dev < Degree)
                        break;
                }
                ulong res = IntNumberToIntDegree(dev, 1044032052841069); ;
                result *= IntNumberToIntDegree(dev, count);
                result %= (int)(1e9 + 7);
            }
            Console.WriteLine(result);
        }
    }
}


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

namespace _29B
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');
            int l = int.Parse(input[0]);
            int d = int.Parse(input[1]);
            int v = int.Parse(input[2]);
            int g = int.Parse(input[3]);
            int r = int.Parse(input[4]);
            double t = l * 1.0 / v;
            double td = (d * 1.0 / v);
            int tdmod = (int)td % (g + r);
            if (td < g) Console.WriteLine("{0:0.########}",t);
            else Console.WriteLine("{0:0.########}",t + (g + r - td));
        }
    }
}


using System;
class Program
    {
        public static void Main(string[] args)
        {
            string data;
            {
                string[] input = Console.In.ReadToEnd().Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
                data = input[1];
            }
            int[] info = new int[3];
            info[2] = -1;
            for(int i = 0; i<data.Length; ++i)
            {
                if (data[i] == 'U')
                    info[1]++;
                else if (data[i] == 'D')
                    info[1]--;
                else if (data[i] == 'R')
                    info[0]++;
                else info[0]--;
                if (info[0] == 0 && info[1] == 0)
                    info[2] = i;
            }
            Console.WriteLine(info[2]+1);
        }
    }


using System;
using System.Collections.Generic;
using System.Linq;
using System.Diagnostics;
using Pair = System.IComparable;

[DebuggerNonUserCode]
static class Extension
{
    internal static IEnumerable<T> forEach<T>(this IEnumerable<T> stream, Action<T> act) { foreach (var elem in stream) act(elem); return stream; }
    internal static Dictionary<int, T> ToDictionary<T>(this IList<T> list)
    { var ans = new Dictionary<int, T>(list.Count); for (var i = 0; i < list.Count; i++) ans.Add(i, list[i]); return ans; }
    internal static TValue? GetOrDefault<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key) where TValue : struct
    { TValue ans; if (dict.TryGetValue(key, out ans)) return ans; return null; }
    internal static TValue computeIfAbsent<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key, Func<TValue> fallback)
    { TValue ans; if (dict.TryGetValue(key, out ans)) return ans; ans = fallback(); dict.Add(key, ans); return ans; }
    internal static HashSet<T> ToSet<T>(this IEnumerable<T> stream) { return new HashSet<T>(stream); }
}
[DebuggerNonUserCode]
public class Helper
{
    internal const int DEFAULT_BUFFER_SIZE = 4194304;
    internal static IEnumerable<int> range(int left, int right) { for (var i = left; i <= right; i++) yield return i; }
    internal Accumulator<T> accumulate<T>(T init, Func<T, T, T> aggregate) where T : struct
    { var ans = new Accumulator<T>(aggregate); ans.Add(init); return ans; }
    [DebuggerDisplay("{Value}")]
    internal class Accumulator<T> where T : struct
    {
        Func<T, T, T> aggregate; public T? Value { get; private set; }
        public Accumulator(Func<T, T, T> aggregate) { this.aggregate = aggregate; }
        public Accumulator<T> Add(T value) { Value = Value.HasValue ? aggregate(Value.Value, value) : value; return this; }
    }
    internal static int? explainLinearSearchIndex(int rawIndex) { if (rawIndex < 0) return null; return rawIndex; }
    internal static Pair pair<T1, T2>(T1 value1, T2 value2) { return Tuple.Create(value1, value2); }
}
public class Solution : StdioHelper
{
    public Solution()
    {
        var n = readInt32();
        var arr = readLine_TRIM().ToLookup(c => c);
        var L = arr['L'].Count();
        var R = arr['R'].Count();
        var D = arr['D'].Count();
        var U = arr['U'].Count();
        var a = Math.Min(L, R);
        var b = Math.Min(U, D);
        Console.WriteLine(a + b);
    }
}

//

[DebuggerNonUserCode]
public class StdioHelper : Helper
{
    static void Main() { new Solution(); }
    static void eof() { throw new System.IO.EndOfStreamException(); }
    internal string readLine_TRIM()
    { while (true) { var ans = Console.ReadLine(); if (ans == null) eof(); ans = ans.Trim(); if (ans.Any()) return ans; } }
    IEnumerable<char> stream() { while (true) { var iread = Console.Read(); if (iread < 0) break; yield return (char)iread; } }
    static bool isWhitespace(char c) { return c == ' ' || c == '\n' || c == '\r'; }
    internal long readLong64()
    {
        var cap = 21; var sb = new System.Text.StringBuilder(cap, cap);
        var iter = stream().SkipWhile(isWhitespace).TakeWhile(c => !isWhitespace(c));
        foreach (var c in iter) sb.Append(c);
        if (sb.Length == 0) eof(); return long.Parse(sb.ToString());
    }
    internal int readInt32() { return Convert.ToInt32(readLong64()); }
}


using System;

namespace CodeForces1
{
    class Program
    {
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();
            var max = 0;
            for (int i = 0, x = 0, y = 0; i < n; i++)
            {
                if (s[i] == 'L')
                    x++;
                else if (s[i] == 'R')
                    x--;
                else if (s[i] == 'U')
                    y++;
                else if (s[i] == 'D')
                    y--;

                if (x == 0 & y == 0)
                {
                    max = i + 1;
                }

            }
            Console.WriteLine(max);
        }
    }
}


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

namespace cf461
{
    class Program
    {
        static void Main(string[] args)
        {
            //Console.SetIn(new StreamReader("input.txt"));
            solve_cf461B();
        }

        public static void solve_cf461B()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int max = 0;
            /*
            The big mistake was to use this array of used numbers
            I thought that finding i and j such that their xor gives x
            is enough to remember the numbers i and j in the used array
            so that the next time I will not iterate over the numbers that have been
            used. But the issue with that is that i and j can be from different iterations
            not necessairly from the same iteration.
            Example:
            if i = 2 and j = 3 gives us xor x and we remember i and j in the array - used.
            then next time
            if i = 4 and j = 3 also gives us xor x then we will not even consider this case
            because used[3] will be not 0 which means that we have already considered this case
            and we will skip it. But we should not have skipped it because it is a different pair of numbers
            giving xor which is equal to x.
             */
            //int[] u = new int[2501];
            for (int i = 1; i <= n; i++)
            {
                for (int j = 1; j <= n; j++)
                {
                    //if (u[i] == 1 && u[j] == 1)
                    //{
                    //    continue;
                    //}
                    int x = i ^ j;
                    //(x < i && x + i > j) dont' need to look back as associative
                    if (x <= n && ((x > j && i + j > x) || (x > i && x < j && i + x > j)))
                    {
                        max++;
                        //u[i] = 1;
                        //u[j] = 1;
                    }
                }
            }

            Console.WriteLine(max);
        }

        public static void solve_cf461A()
        {

        }
    }
}


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

namespace cf461
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.SetIn(new StreamReader("input.txt"));
            solve_cf461B();
        }

        public static void solve_cf461B()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int max = 0;
            int[] u = new int[2501];
            for (int i = 1; i < n; i++)
            {
                for (int j = i + 1; j <= n; j++)
                {
                    if (u[i] == 1 && u[j] == 1)
                    {
                        continue;
                    }
                    int x = i ^ j;
                    //(x < i && x + i > j) dont' need to look back as associative
                    if (x < n && (x > j && i + j > x))
                    {
                        max++;
                        u[i] = 1;
                        u[j] = 1;
                    }
                }
            }

            Console.WriteLine(max);
        }

        public static void solve_cf461A()
        {

        }
    }
}


using System;

namespace Triangle
{
    class Program
    {
        static void Main(string[] args)
        {
            int max_number = Int32.Parse(args[0]);
            int res = 0;
            for (int x = 1; x < max_number + 1; x++)
            {
                for (int y = x; y < max_number + 1; y++)
                {
                    int z = x ^ y;
                    if (z < x + y && z < max_number + 1 && z > y)
                    res++;
                }
            }
            Console.WriteLine(res);
        }
    }
}


#if DEBUG
using System.Reflection;
using System.Threading.Tasks;
#endif

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

namespace _40c
{
    class Program
    {
        static string _inputFilename = "input.txt";
        static string _outputFilename = "output.txt";
        static bool _useFileInput = false;

        static void Main(string[] args)
        {
            StreamWriter file = null;
#if DEBUG
			Console.SetIn(getInput());
#else
            if (_useFileInput)
            {
                Console.SetIn(File.OpenText(_inputFilename));
                file = new StreamWriter(_outputFilename);
                Console.SetOut(file);
            }
#endif

            try
            {
                solution();
            }
            finally
            {
                if (_useFileInput)
                {
                    file.Close();
                }
            }
        }

        static void solution()
        {
            #region SOLUTION
            var s = Console.ReadLine().ToCharArray();
            for (int i = 1; i < s.Length - 1 - 1; i++)
            {
                if (s[i] == 'a' && s[i + 1] == 't')
                {
                    s[i] = '@';
                    s[i + 1] = ' ';
                    break;
                }
            }

            var pos = 0;
            var start = -1;
            for (int i = 1; i < s.Length - 1; i++)
            {
                var next = s[i];
                if (next == ' ')
                {
                    continue;
                }

                var want = ' ';
                switch (pos)
                {
                    case 0:
                        want = 'd';
                        break;
                    case 1:
                        want = 'o';
                        break;
                    case 2:
                        want = 't';
                        break;
                    default:
                        break;
                }

                if (next != want)
                {
                    pos = 0;
                    start = -1;

                    if (next == 'd')
                    {
                        pos++;
                        start = i;
                        continue;
                    }
                }

                if (pos < 2)
                {
                    if (pos == 0)
                    {
                        start = i;
                    }

                    pos++;
                    continue;
                }

                s[start] = '.';
                for (int j = start + 1; j < start + 3; j++)
                {
                    s[j] = ' ';
                }

                pos = 0;
                start = -1;
            }

            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] != ' ')
                {
                    Console.Write(s[i]);
                }
            }
            //var n = readInt();
            //var m = readInt();

            //var a = readIntArray();
            //var b = readIntArray();
            #endregion
        }

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

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

        static int[] readIntArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => int.Parse(i)).ToArray();
        }

        static long[] readLongArray()
        {
            return Console.ReadLine().Split(' ').Where(i => !string.IsNullOrEmpty(i)).Select(i => long.Parse(i)).ToArray();
        }

#if DEBUG
		static StreamReader getInput()
		{
			var resName = Assembly.GetCallingAssembly().GetManifestResourceNames()[0];
			var resource = Assembly.GetCallingAssembly().GetManifestResourceStream(resName);

			return new StreamReader(resource);
		}
#endif
    }
}


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

public class Program
{
	public static void Main()
	{
		int n=Convert.ToInt32(Console.ReadLine());
		var a=Console.ReadLine();
		List<int> l=new List<int>();
		for(int i=0; i<n; i++)
		{
			if(a[i]=='2')
				l.Add(Convert.ToInt32(2));
			else if(a[i]=='3')
			{
				l.Add(Convert.ToInt32(3));
			}
			else if(a[i]=='4')
			{
				l.Add(Convert.ToInt32(2));
				l.Add(Convert.ToInt32(2));
				l.Add(Convert.ToInt32(3));
			}
			else if(a[i]=='5')
			{
				l.Add(Convert.ToInt32(5));
			}
			else if(a[i]=='6')
			{
				l.Add(Convert.ToInt32(3));
				l.Add(Convert.ToInt32(5));
			}
			else if(a[i]=='7')
			{
				l.Add(Convert.ToInt32(7));
			}
			else if(a[i]=='8')
			{
				l.Add(Convert.ToInt32(2));
				l.Add(Convert.ToInt32(2));
				l.Add(Convert.ToInt32(2));
				l.Add(Convert.ToInt32(7));
			}
			else if(a[i]=='9')
			{
				l.Add(Convert.ToInt32(9));
			}
		}
		l.Sort();
		l.Reverse();

		foreach(var p in l)
			Console.Write(p);
	}
}


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

namespace CF515C
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            input = Console.ReadLine();
            //string[] pInput = input.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            string output = "";
            for (int i = 0; i < input.Length; i++)
            {
                switch (input[i])
                {
                    case '4': output += "322";break;
                    case '6': output += "53"; break;
                    case '8': output += "722"; break;
                    case '9': output += "7332"; break;
                    case '0': break;
                    case '1': break;
                    default:
                        output += input[i]; break;
                }
            }
            var chars = new List<char>(output.ToCharArray());
            chars.Sort();
            chars.Reverse();
            string result = new string(chars.ToArray());
            Console.WriteLine(result);

        }
    }
}


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

namespace DrazilAndFactorial
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long a = int.Parse(Console.ReadLine());
            string s = a.ToString();
            string t = "";

            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] == '4')
                    t += "322";
                else if (s[i] == '6')
                    t += "53";
                else if (s[i] == '8')
                    t += "7222";
                else if (s[i] == '9')
                    t += "7332";
                else if ((int)s[i]-(int)'0' > 1)
                    t += s[i];
            }

            char[] c = t.ToCharArray();
            Array.Sort(c);
            for (int i = c.Length - 1; i >= 0; i--)
                Console.Write(c[i]);
            Console.ReadLine();
        }
    }
}


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

namespace Drazil_and_Factorial
{
    class Operacao
    {
        private int contador;
        private string numeros;
        private string[] posicoes = { "", "", "2", "3", "223", "5", "53", "7", "7222", "7332" };
        private List<string> resposta;

        public Operacao(int x, string y)
        {
            contador = x;
            numeros = y;
        }

        public void calcula()
        {
            for (int i = 0; i < contador; i++)
            {
                resposta.Add(posicoes[int.Parse(numeros.Substring(i, 1))]);
            }

            resposta.Sort();
            resposta.Reverse();
            exibe();
        }

        public void exibe()
        {
            foreach (string x in resposta)
            {
                Console.Write(x);
            }
        }
    }
    class Program
    {
        static void Main(string[] args)
        {
            RecebeDados();
        }

        static public void RecebeDados()
        {
            Operacao x = new Operacao(int.Parse(Console.ReadLine()), Console.ReadLine());
            x.calcula();
        }
    }
}


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

namespace CodeForces
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            var test = Console.ReadLine();
            var input = Console.ReadLine();
            var dict = GetDict();
            StringBuilder sb = new StringBuilder();
            foreach(char c in input)
            {
                if (c == '0' || c == '1') continue;
                sb.Append(dict[c - '0']);
            }
            var result = sb.ToString().ToCharArray();
            Array.Sort(result);
            Array.Reverse(result);
            Console.WriteLine(new string(result));

        }

        private static Dictionary<int, int> GetFactorial()
        {
            Dictionary<int, int> factorial = new Dictionary<int, int>();
            factorial.Add(2, 2);
            for (int i = 3; i <= 9; i++)
            {
                factorial.Add(i, factorial[i - 1] * i);
            }
            return factorial;
        }

        private static Dictionary<int,string> GetDict()
        {
            Dictionary<int, string> dict = new Dictionary<int, string>();
            var factorial = GetFactorial();
            dict.Add(2, "2");
            for (int i = 3; i <= 9; i++)
            {
                string result = "";
                int iter = i;
                var temp = factorial.Keys.ToArray();
                Array.Sort(temp);
                Array.Reverse(temp);
                foreach (int z in temp)
                {
                    int j = factorial[z];
                    while (i % j == 0 && i > 1)
                    {
                        i = i / j;
                        result += z.ToString();
                    }
                    if (i <= 1) break;
                }
                if(i == 1 )
                {
                    result += dict[iter - 1];
                    dict.Add(iter, result);
                }
                else
                {
                    dict.Add(iter, Convert.ToString(iter));
                }
                i = iter;
            }
            dict[9] = "332;"
            return dict;
        }

    }
}


using System;
class Test {
    static void Main() {
        string [] str = Console.ReadLine().Split();
        long a = Int64.Parse(str[0]);
        long b = Int64.Parse(str[1]);
        long c = Int64.Parse(str[2]);
        long col = b+c-1;
        long ans = 0;
        int i;
        for( i=0 ; i<b ; i++){
            ans += a+i;
        }
        ans *= 2;
        if(b==c){
            ans -= a+i-1;
        }else{
            ans += (a+i)*Convert.ToInt64(Math.Abs(col-2*b));
        }
        Console.WriteLine(ans);
    }
}


using System;

class Program
{
    static int Main()
    {
        int a, b, c;
        string []s = Console.ReadLine().Split(' ');
        a = Convert.ToInt32(s[0]);
        b = Convert.ToInt32(s[1]);
        c = Convert.ToInt32(s[2]);
        Console.WriteLine(a * b * c - (a - 1) * (b - 1) * (c - 1));
    }
}


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

namespace AcmSolution4
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
#if !ACM_HOME
            Do();
#else
            var tmp = Console.In;
            Console.SetIn(new StreamReader("a.txt"));
            while (Console.In.Peek() > 0)
            {
                Do();
                WL(GetStr());
            }
            Console.In.Close();
            Console.SetIn(tmp);
#endif
            Console.ReadLine();
        }

        private static void Do()
        {
            int a,b,c;
            GetInts(out a, out b, out c);

            long ans = 0;
            for (int i = 0; i < c - 1; i++)
                ans += a + i;

            for (int i = 0; i < b; i++)
                ans += a + i;

            WL(ans);
        }

        #region Utils
        private const double Epsilon = 0.00000001;

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

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

        private static string[] GetStrs(int cnt)
        {
            var s = new string[cnt];
            for (var i = 0; i < cnt; ++i)
                s[i] = GetStr();
            return s;
        }

        private static int GetInt()
        {
            return int.Parse(GetStr());
        }

        private static void GetInts(out int a, out int b)
        {
            var q = GetInts();
            a = q[0];
            b = q[1];
        }

        private static void GetInts(out int a, out int b, out int c)
        {
            var q = GetInts();
            a = q[0];
            b = q[1];
            c = q[2];
        }

        private static int[] GetInts()
        {
            var s = GetStrs();
            var a = new int[s.Length];
            for (var i = 0; i < s.Length; ++i)
                a[i] = int.Parse(s[i]);
            return a;
        }

        private static long GetLong()
        {
            return long.Parse(GetStr());
        }

        private static IEnumerable<long> GetLongs()
        {
            return GetStrs().Select(long.Parse);
        }

        private static void WriteDouble<T>(T d)
        {
            Console.WriteLine(string.Format("{0:0.000000000}", d).Replace(',', '.'));
        }

        private static void WL<T>(T s)
        {
            Console.WriteLine(s);
        }

        private static void W<T>(T s)
        {
            Console.Write(s);
        }

        private static void Assert(bool b)
        {
            if (!b) throw new Exception();
        }

        private static void Swap<T>(ref T a, ref T b)
        {
            var temp = a;
            a = b;
            b = temp;
        }

        #endregion
    }
}


using System;

class Program
{
    static void Main(string[] args)
    {
        string[] abc = Console.ReadLine().Split(' ');

        long a, b, c;
        a = long.Parse(abc[0]);
        b = long.Parse(abc[1]);
        c = long.Parse(abc[2]);

        long s = (a + b + c) * 2;
        Console.WriteLine(s);
    }
}


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

namespace CodeForces {
    struct Node {
        public int X, Y, D;
        public Node(int x,int y, int d) {
            X = x;
            Y = y;
            D = d;
        }
    }

    class Pair : IComparable<Pair> {
        public int Vertex, Danger;
        public Pair(int f, int s) {
            Vertex = f;
            Danger = s;
        }

        public int CompareTo(Pair other) {
            return Vertex.CompareTo(Danger);
        }
    }

    class Desc : IComparer<int> {
        public int Compare(int x, int y) {
            return y.CompareTo(x);
        }
    }

    class Cf {
        static TextReader input;
        static void Main(string[] args) {
#if TESTS
            Stopwatch sw = new Stopwatch();
            sw.Start();
            input = new StreamReader("input.txt");
#else
            input = Console.In;
#endif
            Solve();
#if TESTS
            Console.WriteLine();
            Console.WriteLine("Milliseconds: {0}", sw.ElapsedMilliseconds);
            Console.ReadLine();
#endif
        }

        const int MOD = 1000000007;
        static int n, m;
        static void Solve() {
             int a = nextInt();
            int b = nextInt();
            int c = nextInt();
            if (a == 1) {
                Console.WriteLine(b * c);
                return;
            }
            if (b == 1) {
                Console.WriteLine(a * c);
                return;
            }
            if (c == 1) {
                Console.WriteLine(b * a);
                return;
            }
            int res = (b + 1) * (c + 1);
            int sum = 0;
            for (int i = 1; i < a; i++) {
                sum += i;
            }
            Console.WriteLine(res - 2*sum);
        }

        static int[] _bitcounts;
        static void InitializeBitcounts() {
            _bitcounts = new int[65536];
            int position1 = -1;
            int position2 = -1;
            for (int i = 1; i < 65536; i++, position1++) {
                if (position1 == position2) {
                    position1 = 0;
                    position2 = i;
                }
                _bitcounts[i] = _bitcounts[position1] + 1;
            }
        }

        static int Bitcount(int value) {
            return _bitcounts[value & 65535] + _bitcounts[(value >> 16)];
        }

        static int First(int mask) {
            for (int i = 0; i < 32; i++) {
                if ((mask & (1 << i)) > 0)
                    return i;
            }
            return -1;
        }

        #region math
        static long gcd(long a, long b) {
            return b != 0 ? gcd(b, a % b) : a;
        }

        static long lcm(long a, long b) {
            return a / gcd(a, b) * b;
        }

        //static int SquaredDistanceBetweenSegments(int x1, int y1, int x2, int y2, int xx1, int yy1, int xx2, int yy2) {
        //    return Math.Min(Math.Min(SquaredDistanceToSegment(x1, y1, xx1, yy1, xx2, yy2), SquaredDistanceToSegment(x2, y2, xx1, yy1, xx2, yy2)),
        //        Math.Min(SquaredDistanceToSegment(xx1, yy1, x1, y1, x2, y2), SquaredDistanceToSegment(xx2, yy2, x1, y1, x2, y2)));
        //}

        //static int SquaredDistanceToSegment(int x, int y, int x1, int y1, int x2, int y2) {
        //    int result = Math.Min(SquaredDistance(x, y, x1, y1), SquaredDistance(x, y, x2, y2));
        //    if (x1 == x2 && y1 <= y && y <= y2)
        //        result = (x - x1) * (x - x1);
        //    else if (y1 == y2 && x1 <= x && x <= x2)
        //        result = (y - y1) * (y - y1);
        //    return result;
        //}

        static long SquaredDistance(long ax, long ay, long bx, long by) {
            return (ax - bx) * (ax - bx) + (ay - by) * (ay - by);
        }
        #endregion

        #region read helpers
        static int nextPositive() {
            int t = input.Read();
            while (t < '0' || t > '9') t = input.Read();
            int x = 0;
            while (t >= '0' && t <= '9') {
                x *= 10;
                x += t - '0';
                t = input.Read();
            }
            return x;
        }

        static int nextInt() {
            int t = input.Read();
            while ((t < '0' || t > '9') && t != '-') t = input.Read();
            int sign = 1;
            if (t == '-') {
                sign = -1;
                t = input.Read();
            }
            int x = 0;
            while (t >= '0' && t <= '9') {
                x *= 10;
                x += t - '0';
                t = input.Read();
            }
            return x * sign;
        }

        static long nextLong() {
            int t = input.Read();
            while (t < '0' || t > '9') t = input.Read();
            long x = 0;
            while (t >= '0' && t <= '9') {
                x *= 10;
                x += t - '0';
                t = input.Read();
            }
            return x;
        }

        public static List<int> ReadIntList() {
            return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList();
        }

        public static int[] ReadIntArray() {
            return input.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        }

        public static double[] ReadDoubleArray() {
            return input.ReadLine().Split(' ').Select(x => double.Parse(x)).ToArray();
        }

        public static long[] ReadLongArray() {
            return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToArray();
        }

        public static List<long> ReadLongList() {
            return input.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList();
        }

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

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

        public static long ReadLong() {
            return long.Parse(input.ReadLine());
        }
#endregion
    }

    public class SegmentTree {
        private int[] a, t;
        private int n;
        public SegmentTree(int[] a) {
            n = a.Length;
            this.a = a;
            t = new int[n << 2];
            buildSegmentTree(0, n - 1, 1);
        }

        private void buildSegmentTree(int l, int r, int v) {
            if (l == r)
                t[v] = a[l];
            else {
                int m = (l + r) >> 1;
                int vl = v << 1;
                int vr = (v << 1) | 1;
                buildSegmentTree(l, m, vl);
                buildSegmentTree(m + 1, r, vr);
                t[v] = t[vl] + t[vr];
            }
        }

        public int QuerySegmentTree(int l, int r) {
            return querySegmentTree(1, l, r, 0, n - 1);
        }

        public void Update(int v, int tl, int tr, int pos, int new_val) {
            if (tl == tr)
                t[v] = new_val;
            else {
                int tm = (tl + tr) / 2;
                if (pos <= tm)
                    Update(v << 1, tl, tm, pos, new_val);
                else
                    Update(v << 1 + 1, tm + 1, tr, pos, new_val);
                t[v] = t[v << 1] + t[v << 1 + 1];
            }
        }

        private int querySegmentTree(int v, int l, int r, int tl, int tr) {
            if (l > r)
                return 0;
            if (l == tl && r == tr)
                return t[v];
            int m = (tl + tr) >> 1;
            return querySegmentTree(v << 1, l, Math.Min(r, m), tl, m) + querySegmentTree((v << 1) | 1, Math.Max(l, m + 1), r, m + 1, tr);
        }
    }
    class Graph : List<List<int>> {
        public Graph(int num): base(num) {
            for (int i = 0; i < num; i++) {
                this.Add(new List<int>());
            }
        }
    }
    class Heap<T> : IEnumerable<T> {
        List<T> items = new List<T>();
        IComparer<T> comparer;
        public Heap(IComparer<T> comparer) {
            this.comparer = comparer;
        }
        public Heap() {
            comparer = Comparer<T>.Default;
        }

        public void Add(T item) {
            items.Add(item);
            MoveUp(Count - 1);
        }

        public T Extract() {
            CheckHeap();
            T item = items[0];
            items.Swap(0, Count - 1);
            items.RemoveAt(Count - 1);
            MoveDown(0);
            return item;
        }

        public int Count {
            get {
                return items.Count;
            }
        }

        public bool IsEmpty {
            get {
                return items.Count == 0;
            }
        }

        public T Top {
            get {
                CheckHeap();
                return items[0];
            }
        }

        void CheckHeap() {
            if (items.Count == 0)
                throw new ArgumentException("Heap is empty");
        }

        void MoveDown(int v) {
            int left = 2 * v + 1;
            int right = 2 * v + 2;
            if (left >= Count)
                return;
            if (right >= Count) {
                if (comparer.Compare(items[v], items[left]) < 0) {
                    items.Swap(v, left);
                }
                return;
            }
            int max = comparer.Compare(items[left], items[right]) < 0 ? right : left;
            if (comparer.Compare(items[v], items[max]) < 0) {
                items.Swap(v, max);
                MoveDown(max);
            }
        }

        void MoveUp(int v) {
            int parent = (v - 1) / 2;
            if (comparer.Compare(items[parent], items[v]) < 0) {
                items.Swap(v, parent);
                MoveUp(parent);
            }
        }

        public IEnumerator<T> GetEnumerator() {
            return items.GetEnumerator();
        }

        IEnumerator IEnumerable.GetEnumerator() {
            throw new NotImplementedException();
        }
    }
    public static class Extensions {
        public static void Swap<T>(this IList<T> arr, int i, int j) {
            T temp = arr[i];
            arr[i] = arr[j];
            arr[j] = temp;
        }

        public static int Max(this int a, int b) {
            return Math.Max(a, b);
        }

        public static int Min(this int a, int b) {
            return Math.Min(a, b);
        }

        public static void Fill(this int[] array, int val) {
            for (int i = 0; i < array.Length; i++) {
                array[i] = val;
            }
        }

        public static int ToInt(this string s) {
            return int.Parse(s);
        }

        public static void Print<T>(this IEnumerable<T> arr) {
            foreach (T t in arr)
                Console.Write("{0} ", t);
        }
    }
}