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

namespace CodeForces
{
    static class Reader
    {
        public static int NextInt()
        {
            int ret = 0;
            char c;

            while (!char.IsDigit(c = (char)Console.Read()))
            {
                if (c == '-')
                    return -NextInt();
            }
            do
            {
                ret = ret * 10 + c - '0';
            } while (char.IsDigit(c = (char)Console.Read()));

            return ret;
        }

        public static double NextDouble()
        {
            double ret = 0;
            char c;

            while (!char.IsDigit(c = (char)Console.Read()))
            {
                if (c == '-')
                    return -NextDouble();
            }
            do
            {
                ret = ret * 10 + c - '0';
            } while (char.IsDigit(c = (char)Console.Read()));
            if (c != '.') return ret;

            double p10 = 0.1;
            while (char.IsDigit(c = (char)Console.Read()))
            {
                ret += p10 * (c - '0');
                p10 *= 0.1;
            }

            return ret;
        }

        public static string NextToken()
        {
            StringBuilder ret = new StringBuilder();
            char c;

            while (char.IsWhiteSpace(c = (char)Console.Read())) ;
            do
            {
                ret.Append(c);
            } while (!char.IsWhiteSpace(c = (char)Console.Read()));

            return ret.ToString();
        }
    }

    class Program
    {
        static int GCD(int n, int m)
        {
            return m > 0 ? GCD(m, n % m) : n;
        }

        static void Get(out int A, out int B, out int C)
        {
            int a = Reader.NextInt();
            int b = Reader.NextInt();
            int c = Reader.NextInt();

            int g = GCD(Math.Abs(a), GCD(Math.Abs(b), Math.Abs(c)));

            A = a / g;
            B = b / g;
            C = c / g;
        }

        static void Main(string[] args)
        {
            int A1, B1, C1, A2, B2, C2;

            Get(out A1, out B1, out C1);
            Get(out A2, out B2, out C2);

            if (A1 == A2 && B1 == B2 && C1 == C2)
            {
                Console.WriteLine(-1);
                return;
            }

            if (A1 * B2 == A2 * B1)
            {
                Console.WriteLine(0);
                return;
            }

            Console.WriteLine(1);
        }
    }
}


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

namespace ProblemsFun
{
    class Program
    {
        static void Main(string[] args)
        {
            Queue<string> queue = new Queue<string>();
            queue.Enqueue("Sheldon");
            queue.Enqueue("Leonard");
            queue.Enqueue("Penny");
            queue.Enqueue("Rajesh");
            queue.Enqueue("Howard");

            int n = Convert.ToInt32(Console.ReadLine());
            string temp = string.Empty;
            for (int i = 1; i < n; i++)
            {
                temp = queue.Dequeue();
                queue.Enqueue(temp);
                queue.Enqueue(temp);
            }
            Console.WriteLine(queue.Dequeue());
        }
    }
}


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

namespace DoubleCola
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Convert.ToInt64(Console.ReadLine());
            string[] people = new string[5] { "Sheldon", "Leonard", "Penny", "Rajesh", "Howard" };
            List<string> all = new List<string>();
            int iCount = 5;

            all.Add("Sheldon");
            all.Add("Leonard");
            all.Add("Penny");
            all.Add("Rajesh");
            all.Add("Howard");

            if (input <= 5)
            {
                Console.WriteLine(people[input - 1]);
            }
            else
            {

                for (int i = 0; i <= input; i++)
                {
                    all.Add(all[i]);
                    all.Add(all[i]);
                    iCount += 1;

                    if (iCount == input)
                    {
                        Console.WriteLine(all.ElementAt(iCount - 1));
                        break;
                    }

                }
            }
        }
    }
}


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

namespace Problem82A {
    class Program {
        static void Main(string[] args) {
            Queue<int> colaQueue = new Queue<int>();        // 1 - Sheldon, 2 - Leonard, 3 - Penny, 4 - Rajesh, 5 - Howard
            long nThCan = Convert.ToInt32(Console.ReadLine());
            int person = precalculateQ(colaQueue, nThCan);

            if (person == 1)
                Console.WriteLine("Sheldon");
            if (person == 2)
                Console.WriteLine("Leonard");
            if (person == 3)
                Console.WriteLine("Penny");
            if (person == 4)
                Console.WriteLine("Rajesh");
            if (person == 5)
                Console.WriteLine("Howard");

        }

        static int precalculateQ(Queue<int> colaQ, long nThCan) {
            //starting state
            colaQ.Enqueue(1);
            colaQ.Enqueue(2);
            colaQ.Enqueue(3);
            colaQ.Enqueue(4);
            colaQ.Enqueue(5);

            long person = 0;
            int actPerson = 0;
            while (person < nThCan) {
                actPerson = colaQ.Dequeue();
                person++;
                colaQ.Enqueue(actPerson);
                colaQ.Enqueue(actPerson);
            }

            return actPerson;
        }
    }
}


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

namespace Codeforces_CS
{
    class Class1
    {
        static void Main(string[] args)
        {
            new Class1().run();
        }

        void run()
        {
            InputReader cin = new InputReader(Console.OpenStandardInput());
            int a = cin.int32();
            int b = cin.int32();
            int n = cin.int32();

            long MOD = ((long)1e9) + 7;
            __modFact = new long[n + 1];
            for (int i = 0; i <= n; i++) __modFact[i] = -1;
            for (int i = 0; i <= n; i += 1000) __modFact[i] = modFact(i, MOD);

            long ways = 0;
            for (int i = 0; i <= n; i++)
            {
                long sum = (i * 1L * a) + ((n - i) * 1L * b);
                if (isGood(sum, a, b))
                    ways += modComb(n, i, MOD);
            }

            Console.WriteLine(ways);
        }

        bool isGood(long x, int a, int b)
        {
            if (x == 0) return false;
            while (x > 0)
            {
                int r = (int)(x % 10L);
                if (r != a && r != b)
                    return false;
                x /= 10;
            }
            return true;
        }

        long modPow(long b, long e, long MOD)
        {
            if (e == 0) return 1;
            if (e == 1) return b % MOD;
            long temp = modPow(b, e / 2, MOD);
            temp = (temp * temp) % MOD;
            if (e % 2 == 1)
                temp = (temp * (b % MOD)) % MOD;
            return temp;
        }

        long modInv(long b, long MOD)
        {
            return modPow(b, MOD - 2, MOD);
        }

        long modComb(long n, long r, long MOD)
        {
            return (modFact(n, MOD) * modInv(modFact(n - r, MOD) * modFact(r, MOD), MOD)) % MOD;
        }

        long[] __modFact;

        long modFact(long n, long MOD)
        {
            if (n == 0) return 1;
            if (__modFact[n] != -1) return __modFact[n];
            return __modFact[n] = ((n % MOD) * (modFact(n - 1, MOD) % MOD)) % MOD;
        }
    }

    class InputReader
    {
        Stream inputStream;
        const int bufferSize = 1 << 16;
        int bytesRead;
        int currentBufferTop;
        byte[] buffer;

        public InputReader(Stream _inputStream)
        {
            this.inputStream = _inputStream;
            bytesRead = 0;
            currentBufferTop = 0;
            buffer = new byte[bufferSize];
        }

        public byte peekChar()
        {
            if (currentBufferTop < bytesRead)
            {
                return this.buffer[this.currentBufferTop];
            }
            else
            {
                if (!this.refill())
                {
                    throw new Exception("Error in reading input or reached EOF");
                }
                else
                {
                    return peekChar();
                }
            }
        }

        public byte readChar()
        {
            if (currentBufferTop < bytesRead)
            {
                return this.buffer[this.currentBufferTop++];
            }
            else
            {
                if (!this.refill())
                {
                    throw new Exception("Error in reading input or reached EOF");
                }
                else
                {
                    return readChar();
                }
            }
        }

        public bool refill()
        {
            currentBufferTop = 0;
            bytesRead = inputStream.Read(buffer, 0, bufferSize);
            return bytesRead > 0;
        }

        public int int32()
        {
            return (int) int64();
        }

        public long int64()
        {
            byte temp = peekChar();
            while (temp != '-' && (temp < '0' || temp > '9'))
            {
                readChar();
                temp = peekChar();
            }
            int sign = 1;
            if (temp == '-') sign = -1;
            if (temp == '-') readChar();
            long readValue = 0;
            temp = peekChar();
            while (temp >= '0' && temp <= '9')
            {
                readValue *= 10;
                readValue += (int)(temp - '0');
                readChar();
                try
                {
                    temp = peekChar();
                }
                catch (Exception e)
                {
                    break;
                }
            }
            return readValue * sign;
        }

        public string token()
        {
            byte temp = peekChar();
            while (isSpace(temp))
            {
                readChar();
                temp = peekChar();
            }

            StringBuilder sb = new StringBuilder();
            try
            {
                temp = peekChar();
                while (!isSpace(temp))
                {
                    readChar();
                    sb.Append((char)temp);
                    temp = peekChar();

                }
            }
            catch (Exception e) { }
            return sb.ToString();
        }

        public string line()
        {
            StringBuilder sb = new StringBuilder();
            try
            {
                byte temp;
                do
                {
                    temp = peekChar();
                    sb.Append(temp);
                    readChar();
                } while (temp != '\n');
            }
            catch (Exception e) { }
            return sb.ToString();
        }

        private bool isSpace(byte t)
        {
            if (t == ' ') return true;
            if (t == '\t') return true;
            if (t == '\r') return true;
            if (t == '\n') return true;
            if (t == '\f') return true;
            return false;
        }
    }
}


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

class MyClass
{
    public static void Solve()
    {
        var N = long.Parse(Console.ReadLine());
        var primes = new List<long>();
        var n = N;
        if (n % 2 == 0)
        {
            primes.Add(2);
            while (n % 2 == 0)
            {
                n /= 2;
            }
        }
        for (int p = 3; p * p <= n; p += 2)
        {
            if (n % p == 0)
            {
                primes.Add(p);
                while (n % p == 0)
                {
                    n /= p;
                }
            }
        }
        if (n != 1)
        {
            primes.Add(n);
        }
        if (primes.Count == 1)
        {
            Console.WriteLine(primes[0]);
        }
        else
        {
            Console.WriteLine(1);
        }
    }

    public static void Main()
    {
        var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(sw);
        Solve();
        Console.Out.Flush();
    }
}


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            string data = Console.ReadLine();
            string[] input = data.Split(' ');
            long n, k;
            long sayac = 0;

            n = Convert.ToInt64(input[0]);
            k = Convert.ToInt64(input[1]);

            if (n >= 10000000000 || k >= 10000000000)
            {
                Console.WriteLine("500000000000");
                Console.Read();
            }

            long[] oyuncakSayisi=new long[n+1];
            for (long i = 0; i < n + 1; i++)
            {
                oyuncakSayisi[i]=i;
            }

            for (int i = 1; i < n + 1; i++)
            {
                for (int j = 2; j < n + 1; j++)
                {
                    if (Convert.ToInt64(oyuncakSayisi[i]) + Convert.ToInt64(oyuncakSayisi[j]) == k)
                    {
                        oyuncakSayisi[i] = k + 1;
                        oyuncakSayisi[j] = k + 1;
                        sayac++;
                    }
                }
            }

            Console.WriteLine(sayac);
            Console.Read();

        }
    }
}


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            string data = Console.ReadLine();
            string[] input = data.Split(' ');
            long n, k;
            long sayac = 0;

            n = Convert.ToInt64(input[0]);
            k = Convert.ToInt64(input[1]);

            if (n >= 10000000000 || k >= 10000000000)
            {
                Console.WriteLine("500000000000");
                Console.Read();
            }

            List<long> oyuncakSayisi=new List<long>();
            for (long i = 0; i < n + 1; i++)
            {
                oyuncakSayisi.Add(i);
            }

            for (int i = 1; i < n + 1; i++)
            {
                for (int j = 2; j < n + 1; j++)
                {
                    if (Convert.ToInt64(oyuncakSayisi[i]) + Convert.ToInt64(oyuncakSayisi[j]) == k)
                    {
                        oyuncakSayisi[i] = k + 1;
                        oyuncakSayisi[j] = k + 1;
                        sayac++;
                    }
                }
            }

            Console.WriteLine(sayac);
            Console.Read();

        }
    }
}


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {

            string data = Console.ReadLine();
            string[] input = data.Split(' ');
            long n, k;
            long sayac = 0;

            n = Convert.ToInt64(input[0]);
            k = Convert.ToInt64(input[1]);
            long n2=n + 1;
            ArrayList oyuncakSayisi=new ArrayList();
            //List<long> oyuncakSayisi = new List<long>();

            for (long i = 0; i <= n; i++)
            {
                oyuncakSayisi.Add(i);
            }

            for (int i = 1; i <= (int) n; i++)
            {
                for (int j = 2; j <= (int)n; j++)
                {
                    if (Convert.ToInt64(oyuncakSayisi[i]) + Convert.ToInt64(oyuncakSayisi[j]) == k)
                    {
                        oyuncakSayisi[i] = k+1;
                        oyuncakSayisi[j] = k+1;
                        sayac++;
                    }
                }
            }

            Console.WriteLine(sayac);
            Console.Read();
        }
    }
}


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

namespace cfPairOfToys
{
    class Program
    {
        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            long kol = long.Parse(s.Split(' ')[0]);
            long sum = long.Parse(s.Split(' ')[1]);
            long l = 1;
            long r = kol;
            while (l<=r && l + r != sum)
            {
                if (l + r > sum)
                {
                    r--;
                }
                else
                {
                    l++;
                }
                //Console.WriteLine(l + " " + r);
            }
            if (l > r)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine((r - l) / 2 + 1);
            }
            //Console.ReadKey();
        }
    }
}


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

namespace AlgoTest
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int[] a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();

            int sum = 0;
            int max = int.MinValue;

            for (int i = 0; i < a.Length; i++)
            {
                sum += a[i];
                max = Math.Max(max, a[i]);
            }

            int k = max;
            int sum2 = 0;

            while(sum2<sum)
            {
                sum2 = 0;

                for (int i = 0; i < a.Length; i++)
                {
                    sum2 += k - a[i];
                }

                k++;

            }

            Console.WriteLine(k - 1);
         //   Console.ReadKey();
        }

        private static string [] customizeEmails(string [] emails)
        {
            for (int i = 0; i < emails.Length; i++)
            {
                emails[i] = customizeTheString(emails[i]);
            }

            return emails.Distinct().ToArray();
        }

        private static string customizeTheString(string email)
        {
            int indexOfAt = email.IndexOf('@');
            string name = email.Substring(0, indexOfAt);

            StringBuilder newMail = new StringBuilder();

            for (int i = 0; i < name.Length; i++)
            {
                if (name[i] == '+') break;
                if (name[i] == '.') continue;

                newMail.Append(name[i]);
            }

            return newMail.Append(email.Substring(indexOfAt)).ToString();
        }
        public static string ReverseVowels(string s)
        {
            StringBuilder sb = new StringBuilder();

            List<int> vowels = new List<int>();

            for (int i = 0; i < s.Length; i++)
            {
                if (isVowel(s[i]))
                {
                    vowels.Add(i);
                }
            }

            int[] c = vowels.ToArray();

            char[] answer = new char[s.Length];

            int j = 0;

            for (int i = 0; i < s.Length; i++)
            {
                if (isVowel(s[i]))
                {
                    answer[i] = s[c[c.Length - 1 - j]];
                    answer[c[c.Length - 1 - j]] = s[i];
                    j++;
                }
                else
                {
                   answer[i] = s[i];
                }
            }

            return new string(answer);
        }

        public static bool isVowel(char c)
        {
            c = char.ToLowerInvariant(c);
            return c == 'a' || c == 'o' || c == 'e' || c == 'u' || c == 'i';
        }
    }
}


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

namespace Algorithm
{
    class Program
    {
        static int count = 0;
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();
			int[,] dp = new int[N, N];
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    dp[i, j] = -1;
                }
            }
            Console.WriteLine(findMinimumDeletion(0, n - 1, dp, s));
        }

        static int findMinimumDeletion(int l, int r,
                                int[,] dp, String s)
        {

            if (l > r)
            {
                return 0;
            }
            if (l == r)
            {
                return 1;
            }
            if (dp[l, r] != -1)
            {
                return dp[l, r];
            }

            // When a single character is deleted
            int res = 1 + findMinimumDeletion(l + 1, r, dp, s);

            // When a group of consecutive characters
            // are deleted if any of them matches
            for (int i = l + 1; i <= r; ++i)
            {

                // When both the characters are same then
                // delete the letters in between them
                if (s[l] == s[i])
                {
                    res = Math.Min(res, findMinimumDeletion(l + 1, i - 1, dp, s)
                            + findMinimumDeletion(i, r, dp, s));
                }
            }

            // Memoize
            return dp[l, r] = res;
        }
    }
}


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

namespace Algorithm
{
    class Program
    {
        static int N = 50;
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());
            var s = Console.ReadLine();
			int[,] dp = new int[N, N];
            for (int i = 0; i < N; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    dp[i, j] = -1;
                }
            }
            Console.WriteLine(findMinimumDeletion(0, n - 1, dp, s));
        }

        static int findMinimumDeletion(int l, int r,
                                int[,] dp, String s)
        {

            if (l > r)
            {
                return 0;
            }
            if (l == r)
            {
                return 1;
            }
            if (dp[l, r] != -1)
            {
                return dp[l, r];
            }

            // When a single character is deleted
            int res = 1 + findMinimumDeletion(l + 1, r, dp, s);

            // When a group of consecutive characters
            // are deleted if any of them matches
            for (int i = l + 1; i <= r; ++i)
            {

                // When both the characters are same then
                // delete the letters in between them
                if (s[l] == s[i])
                {
                    res = Math.Min(res, findMinimumDeletion(l + 1, i - 1, dp, s)
                            + findMinimumDeletion(i, r, dp, s));
                }
            }

            // Memoize
            return dp[l, r] = res;
        }
    }
}


/*
csc -debug F.cs && mono --debug F.exe <<< "5
abaca"
*/

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

public class HelloWorld {

    static int n;
    static int m;
    static int[] str;
    static int[,,] memo;

    public static void SolveCodeForces() {
        Console.ReadLine();
        str = Console.ReadLine().Select(c => c - 'a').ToArray();
        n = str.Length;
        m = str.Max()+1;

        memo = new int[n, n, m];
        for (var i = 0; i < n; i++)
            for (var j = 0; j < n; j++)
                for (var k = 0; k < m; k++)
                    memo[i,j,k] = -1;

        System.Console.WriteLine(Solve(0, n-1));
    }

    static int Solve(int i, int j) {
        if (i > j) return 0;
        if (i == j) return 1;

        var ans = 10000;
        for (var sym = 0; sym < m; sym++)
            ans = Math.Min(ans, SolveFun(i, j, sym));
        return ans + 1;
    }

    static int SolveFun(int i, int j, int sym) {
        if (i > j) return 0;
        if (i == j) return str[i] == sym ? 0 : 10000;
        if (memo[i,j,sym] >= 0) return memo[i,j,sym];

        var ans = 10000;

        for (var k = i; k <= j; k++) {
            if (str[k] == sym) {

                var fl = SolveFun(i, k-1, sym);
                var sl = Solve(i, k-1);

                var fr = SolveFun(k+1, j, sym);
                var sr = Solve(k+1, j);

                var sol =
                    Math.Min(fl + fr,
                    Math.Min(sl + sr,
                    Math.Min(fl + sr,
                             sl + fr)));

                ans = Math.Min(ans, sol);
            }
        }

// System.Console.WriteLine(new { i, j, sym, ans });

        memo[i, j, sym] = ans;
        return ans;
    }

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

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

public static class Helpers {
    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 static IEnumerable<int> IndicesWhere<T>(this IEnumerable<T> seq, Func<T, bool> cond) {
        var i = 0;
        foreach (var item in seq) {
            if (cond(item)) yield return i;
            i++;
        }
    }
}

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 NextInt() {
        return int.Parse(Next());
    }

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

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

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

    public int[] IntArray(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[] LongArray() {
        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[] UlongArray() {
        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;

namespace Орехус_и_лифт
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
        }
    }
}


class Module1 {

    static void Main() {
        Int64 n = Console.ReadLine;
        Int64 i = (Math.Sqrt(ShiftLeft(n, 1)) - 5);
        if ((i < 0)) {
            i = 0;
        }

        while (((i
                    * ((i + 1)
                    / 2))
                    <= n)) {
            i++;
        }

        Int64 ans = (i
                    - ((i
                    * ((i + 1)
                    / 2))
                    - n));
        if ((ans == 0)) {
            ans = (i - 1);
        }

        Console.WriteLine(ans);
    }
}


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

namespace ProgA
{
    class Program
    {
        static long counter;
        static long n;
        static List<long> a;

        static void Main(string[] args)
        {
            counter = 0;
            a = new List<long>();
            n = int.Parse(Console.ReadLine());

            int i = 1;
            while (counter < n)
            {
                counter += a.Count + 1;
                a.Add(i++);
            }

            Console.WriteLine(a[a.Count - (int)(counter - n) - 1]);
        }
    }
}


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

class Solution
    {
        static void Main(string[] args)
        {
            new FriendsMeeting().Solve();
            Console.ReadLine();
        }
    }

public class FriendsMeeting : ISolution
    {
        public override void Solve()
        {
            var a1 = ReadInt();
            var b1 = ReadInt();
            var a = Math.Min(a1, b1);
            var b = Math.Max(a1, b1);
            var dist = Math.Abs(b - a);
            Console.WriteLine(Math.Min(distance(dist), distance((b - (int)Math.Floor((double)(a + b) / 2))) + distance(((int)Math.Floor((double)(a + b) / 2) - a))));
        }

        public int distance(int k)
        {
            return (k * (k + 1) / 2);
        }
    }


#define DEBUG

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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜

namespace dd
{

	class MainClass
	{
		const int Limit = (int)1e9 + 777;

		public static bool Check(int x)
		{
			int Sum = 0;
			while (x > 0)
			{
				Sum += x % 10;
				x /= 10;
			}
			return (Sum % 10 == 0) ? true : false;
		}

		public static void Brute(int numb)
		{
			int cnt = 0;
			for (int i = 1; i < Limit; ++i)
			{
				if (Check(i) == true)
					cnt++;
				if (cnt == numb)
				{
					Console.WriteLine(i);
					break;1
				}
			}
		}

		public static void Main(string[] args)
		{
			int numb = Reader.NextInt();
			Brute(numb);
		}

		class Reader
		{
			public static int NextInt()
			{
				int cnt = 0, sign = 1;
				char ch = Convert.ToChar(Console.Read());
				while (!(ch >= '0' && ch <= '9') && ch != '-')
					ch = Convert.ToChar(Console.Read());
				if (ch == '-')
				{
					sign = -1;
					ch = Convert.ToChar(Console.Read());
				}
				while (ch >= '0' && ch <= '9')
				{
					int t = Convert.ToInt32(ch);
					cnt = cnt * 10 + ch - '0';
					ch = Convert.ToChar(Console.Read());
				}
				return cnt * sign;
			}
			public static long NextLong()
			{
				long cnt = 0, sign = 1;
				char ch = Convert.ToChar(Console.Read());
				while (!(ch >= '0' && ch <= '9') && ch != '-')
					ch = Convert.ToChar(Console.Read());
				if (ch == '-')
				{
					sign = -1;
					ch = Convert.ToChar(Console.Read());
				}
				while (ch >= '0' && ch <= '9')
				{
					long t = Convert.ToInt64(ch);
					cnt = cnt * 10 + ch - '0';
					ch = Convert.ToChar(Console.Read());
				}
				return cnt * sign;
			}
		}
	}
}


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

namespace Codeforces
{
    class _268B
    {
        public static void Main_268()
        {
            int n = int.Parse(Console.ReadLine());
            int s = n;
            for (int i = 1; i < n; i++)
            {
                s = s + i * (n - i);
            }
            Console.WriteLine(s);
        }
    }
}


namespace CodeForce164
{
    using System;
    using System.IO;
    using ProblemsResolver;

    public static class Program
    {
        public static void Main(string[] args)
        {
            ResolveB();
        }

        private static void ResolveA()
        {
#if DEBUG
            TextReader reader = new StreamReader(@"inputA.txt");
#else
            TextReader reader = Console.In;
#endif
            var n = int.Parse(reader.ReadLine());
            var input = new string[n];
            for (var i = 0; i < n; i++)
            {
                input[i] = reader.ReadLine();
            }

            Console.WriteLine(ProblemA.Resolve(input));
        }

        private static void ResolveB()
        {
#if DEBUG
            TextReader reader = new StreamReader(@"inputB.txt");
#else
            TextReader reader = Console.In;
#endif
            var n = int.Parse(reader.ReadLine());

            Console.WriteLine(ProblemB.Resolve(n));
        }
    }

    public static class ProblemB
    {
        public static int Resolve(int n)
        {
            var clicks = 1;
            for (var i = 0; i < n; i++)
            {
                clicks *= 2;
            }

            return clicks - 1;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Runtime.CompilerServices;
using System.Text;
using System.Diagnostics;
using System.Numerics;
using static System.Console;
using static System.Convert;
using static System.Math;
using static Template;
using Pi = Pair<int, int>;

class Solver
{
    public void Solve(Scanner sc)
    {
        long X, Y;
        sc.Make(out X, out Y);
        var div = new List<long>();
        for(long i=1;i*i<=X;i++)
            if (X % i == 0)
            {
                if (i != 1)
                    div.Add(i);
                if (i * i != X) div.Add(X / i);
            }
        var now = GCD(X, Y);
        Y /= now;
        X /= now;
        var res = 0L;
        while (Y != 0)
        {
            var max = 0L;
            foreach(var d in div)
            {
                var y = Y / d * d;
                if (GCD(y, X) == 1) continue;
                chmax(ref max, y);
            }
            res += Y-max;
            Y = max;
            if (now >= X/GCD(X,Y))
            {

                Y /= X;
                res += Y;break;
            }
            else
            {
                now *= GCD(Y, X);
                Y /= GCD(Y, X);
            }
            X /= now;
        }
        Console.WriteLine(res);
    }
     #region GCD
    public static int LCM(int num1, int num2)
        => num1 / GCD(num1, num2) * num2;

    public static long LCM(long num1, long num2)
        => num1 / GCD(num1, num2) * num2;

    public static int GCD(int num1, int num2)
        => num1 < num2 ? GCD(num2, num1) :
           num2 > 0 ? GCD(num2, num1 % num2) : num1;

    public static long GCD(long num1, long num2)
        => num1 < num2 ? GCD(num2, num1) :
           num2 > 0 ? GCD(num2, num1 % num2) : num1;
    #endregion
}

#region Template
public static class Template
{
    static void Main(string[] args)
    {
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        new Solver().Solve(new Scanner());
        Console.Out.Flush();
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) > 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(ref T a, ref T b) { var t = b; b = a; a = t; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static void swap<T>(this IList<T> A, int i, int j) { var t = A[i]; A[i] = A[j]; A[j] = t; }
    public static T[] Create<T>(int n, Func<T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(); return rt; }
    public static T[] Create<T>(int n, Func<int, T> f) { var rt = new T[n]; for (var i = 0; i < rt.Length; ++i) rt[i] = f(i); return rt; }
    public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> A) => A.OrderBy(v => Guid.NewGuid());
    public static int CompareTo<T>(this T[] A, T[] B, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; for (var i = 0; i < Min(A.Length, B.Length); i++) { int c = cmp(A[i], B[i]); if (c > 0) return 1; else if (c < 0) return -1; } if (A.Length == B.Length) return 0; if (A.Length > B.Length) return 1; else return -1; }
    public static int MaxElement<T>(this IList<T> A, Comparison<T> cmp = null) { cmp = cmp ?? Comparer<T>.Default.Compare; T max = A[0]; int rt = 0; for (int i = 1; i < A.Count; i++) if (cmp(max, A[i]) < 0) { max = A[i]; rt = i; } return rt; }
    public static T PopBack<T>(this List<T> A) { var v = A[A.Count - 1]; A.RemoveAt(A.Count - 1); return v; }
    public static void Fail<T>(T s) { Console.WriteLine(s); Console.Out.Close(); Environment.Exit(0); }
}
public class Scanner
{
    public string Str => Console.ReadLine().Trim();
    public int Int => int.Parse(Str);
    public long Long => long.Parse(Str);
    public double Double => double.Parse(Str);
    public int[] ArrInt => Str.Split(' ').Select(int.Parse).ToArray();
    public long[] ArrLong => Str.Split(' ').Select(long.Parse).ToArray();
    public char[][] Grid(int n) => Create(n, () => Str.ToCharArray());
    public int[] ArrInt1D(int n) => Create(n, () => Int);
    public long[] ArrLong1D(int n) => Create(n, () => Long);
    public int[][] ArrInt2D(int n) => Create(n, () => ArrInt);
    public long[][] ArrLong2D(int n) => Create(n, () => ArrLong);
    private Queue<string> q = new Queue<string>();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public T Next<T>() { if (q.Count == 0) foreach (var item in Str.Split(' ')) q.Enqueue(item); return (T)Convert.ChangeType(q.Dequeue(), typeof(T)); }
    public void Make<T1>(out T1 v1) => v1 = Next<T1>();
    public void Make<T1, T2>(out T1 v1, out T2 v2) { v1 = Next<T1>(); v2 = Next<T2>(); }
    public void Make<T1, T2, T3>(out T1 v1, out T2 v2, out T3 v3) { Make(out v1, out v2); v3 = Next<T3>(); }
    public void Make<T1, T2, T3, T4>(out T1 v1, out T2 v2, out T3 v3, out T4 v4) { Make(out v1, out v2, out v3); v4 = Next<T4>(); }
    public void Make<T1, T2, T3, T4, T5>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5) { Make(out v1, out v2, out v3, out v4); v5 = Next<T5>(); }
    public void Make<T1, T2, T3, T4, T5, T6>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6) { Make(out v1, out v2, out v3, out v4, out v5); v6 = Next<T6>(); }
    public void Make<T1, T2, T3, T4, T5, T6, T7>(out T1 v1, out T2 v2, out T3 v3, out T4 v4, out T5 v5, out T6 v6, out T7 v7) { Make(out v1, out v2, out v3, out v4, out v5, out v6); v7 = Next<T7>(); }
    //public (T1, T2) Make<T1, T2>() { Make(out T1 v1, out T2 v2); return (v1, v2); }
    //public (T1, T2, T3) Make<T1, T2, T3>() { Make(out T1 v1, out T2 v2, out T3 v3); return (v1, v2, v3); }
    //public (T1, T2, T3, T4) Make<T1, T2, T3, T4>() { Make(out T1 v1, out T2 v2, out T3 v3, out T4 v4); return (v1, v2, v3, v4); }
}
public class Pair<T1, T2> : IComparable<Pair<T1, T2>>
{
    public T1 v1;
    public T2 v2;
    public Pair() { }
    public Pair(T1 v1, T2 v2)
    { this.v1 = v1; this.v2 = v2; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2> p)
    {
        var c = Comparer<T1>.Default.Compare(v1, p.v1);
        if (c == 0)
            c = Comparer<T2>.Default.Compare(v2, p.v2);
        return c;
    }
    public override string ToString() => $"{v1.ToString()} {v2.ToString()}";
    public void Deconstruct(out T1 a, out T2 b) { a = v1; b = v2; }
}

public class Pair<T1, T2, T3> : Pair<T1, T2>, IComparable<Pair<T1, T2, T3>>
{
    public T3 v3;
    public Pair() : base() { }
    public Pair(T1 v1, T2 v2, T3 v3) : base(v1, v2)
    { this.v3 = v3; }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public int CompareTo(Pair<T1, T2, T3> p)
    {
        var c = base.CompareTo(p);
        if (c == 0)
            c = Comparer<T3>.Default.Compare(v3, p.v3);
        return c;
    }
    public override string ToString() => $"{base.ToString()} {v3.ToString()}";
    public void Deconstruct(out T1 a, out T2 b, out T3 c) { Deconstruct(out a, out b); c = v3; }
}
#endregion


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

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

        private static IEnumerable<long> Gi()
        {
            yield return 2;
            for (int i = 3;; i += 2)
            {
                yield return i;
            }
        }

        private static void Main(string[] args)
        {
            long x = Next();
            long y = Next();

            var list = new List<long>();
            foreach (long i in Gi())
            {
                if (i*i > x)
                    break;

                while (x%i == 0)
                {
                    list.Add(i);
                    x /= i;
                }
            }
            if (x != 1)
                list.Add(x);

            long count = 0;

            long yy = y;
            long d = 1;
            while (yy > 0 && list.Count > 0)
            {
                long min = list.Select(l => y%l).Concat(new[] {y}).Min();

                count += min;
                y -= min;
                yy -= d*min;

                for (int i = 0; i < list.Count; i++)
                {
                    if (y%list[i] == 0)
                    {
                        y /= list[i];
                        d *= list[i];
                        list.RemoveAt(i);
                        i--;
                    }
                }

                if (list.Count == 0)
                {
                    count += yy/d;
                }
            }

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

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


using System;
using System.Linq;

namespace CSharp
{
    public class _721A
    {
        public static void Main(string[] args)
        {
            string[] groups = Console.ReadLine().Split(new char[] { 'W' }, StringSplitOptions.RemoveEmptyEntries);

            Console.WriteLine(groups.Length);

            if (groups.Any())
            {
                Console.WriteLine(string.Join(" ", groups.Select(group => group.Length)));
            }
        }
    }
}{


//using System;
//using System.IO;
//using System.Linq;

//namespace Codeforces
//{
//	internal class Template
//	{
//		private static readonly Scanner cin = new Scanner();

//		private static void Main()
//		{
//#if !ONLINE_JUDGE
//			//Console.SetIn(new StreamReader(@"C:\CodeForces\input.txt"));
//#endif
//			new Template().Solve();
//			Console.ReadLine();
//		}

//		private void Solve()
//		{
//			var codeforces = "CODEFORCES";
//			var str = cin.NextString();
//			var idx = 0;
//			for (var i = 0; i < str.Length; i++)
//			{
//				for (var j = i + 1; j < str.Length; j++)
//				{
//					var newStr = str.Substring(0, i) + str.Substring(j, str.Length - j);
//					if (newStr == codeforces)
//					{
//						Console.WriteLine("YES");
//						return;
//					}
//				}
//			}
//			Console.WriteLine("NO");
//		}
//	}

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

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

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

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

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


namespace a149
{
    class Program
    {
        static int[] BubbleSort(int[] mas)
        {
            int temp;
            for (int i = 0; i < mas.Length; i++)
            {
                for (int j = i + 1; j < mas.Length; j++)
                {
                    if (mas[i] > mas[j])
                    {
                        temp = mas[i];
                        mas[i] = mas[j];
                        mas[j] = temp;
                    }
                }
            }
            return mas;
        }

        static void Main(string[] args)
        {
            int k = Convert.ToInt16(Console.ReadLine());
            int[] mas = Console.ReadLine().Split(' ').Select(e => Convert.ToInt32(e)).ToArray();
            BubbleSort(mas);
            int sum = mas.Sum();
            if (sum < k)
                Console.WriteLine(-1);
            else
            if (k == 0)
                Console.WriteLine(0);
            else
                if (mas[11] >= k)
                Console.WriteLine(1);
            else
                if (mas[11] + mas[10] >= k)
                Console.WriteLine(2);
            else
                if (mas[11] + mas[10] + mas[9] >= k)
                Console.WriteLine(3);
            Console.ReadLine();
        }
    }


using System;

class P {
  static void Main() {
    var n  = int.Parse(Console.ReadLine());
    for (var i = 1; i <= n ; i++ ) if (i*(i+1)/2 == n)
       Console.Write("YES");
       Console.Write("NO");
  }
}


using System;

namespace Triangulo
{
    class Triangulo
    {
        static void Main(string[] args)
        {

            int [] numeros = new int [4];

            for (int i = 0; i < 4; i++)
            {
                numeros[i] = int.Parse(Console.ReadLine());
            }

            Array.Sort(numeros);

            //revisar los casos

            if (numeros[0] + numeros[1] > numeros[2] || numeros[1] + numeros[2] > numeros[3])
            {
                Console.WriteLine("TRIANGLE\n");
            }

           else if(numeros[0] + numeros[1] == numeros[2] || numeros[1] + numeros[2] == numeros[3])
            {
                Console.WriteLine("SEGMENT\n");
            }
            else
            {
                Console.WriteLine("IMPOSSIBLE\n");
            }

            //Console.ReadKey();
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static private string TSI(short a, short b, short c)
        {
            if (a < b + c && b < a + c && c < a + b) return "TRIANGLE";
            else
            {
                if (a == b + c || b == a + c || c == a + b) return "SEGMENT";
                else return "IMPOSSIBLE";
            }
        }
        static void Main()
        {
            short a = 0, b = 0, c = 0, d = 0;
            a = Convert.ToInt16(System.Console.ReadLine());
            b = Convert.ToInt16(System.Console.ReadLine());
            c = Convert.ToInt16(System.Console.ReadLine());
            d = Convert.ToInt16(System.Console.ReadLine());

            string s = TSI(a, b, c);
            if (s.Equals("TRIANGLE")) Console.WriteLine(s);
            else
            {
                s = TSI(b, c, d);
                if (s.Equals("TRIANGLE")) Console.WriteLine(s);
                else
                {
                    s = TSI(a, b, d);
                    if (s.Equals("TRIANGLE")) Console.WriteLine(s);
                    else
                    {
                        s = TSI(a, c, d);
                        if (s.Equals("TRIANGLE")) Console.WriteLine(s);
                        else
                        {
                            s = TSI(a, b, c);
                            if (s.Equals("SEGMENT")) Console.WriteLine(s);
                            else
                            {
                                s = TSI(b, c, d);
                                if (s.Equals("SEGMENT")) Console.WriteLine(s);
                                else
                                {
                                    s = TSI(a, b, d);
                                    if (s.Equals("SEGMENT")) Console.WriteLine(s);
                                    else
                                    {
                                        s = TSI(a, c, d);
                                        if (s.Equals("SEGMENT")) Console.WriteLine(s);
                                        else
                                        {
                                            s = TSI(a, b, c);
                                            if (s.Equals("IMPOSSIBLE")) Console.WriteLine(s);
                                            else
                                            {
                                                s = TSI(b, c, d);
                                                if (s.Equals("IMPOSSIBLE")) Console.WriteLine(s);
                                                else
                                                {
                                                    s = TSI(a, b, d);
                                                    if (s.Equals("IMPOSSIBLE")) Console.WriteLine(s);
                                                    else
                                                    {
                                                        Console.WriteLine("IMPOSSIBLE");
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {

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

            Int32 k = Int32.Parse(tokens[1]);
            Int32 n = Int32.Parse(tokens[0]);

            Int32 r = n - k;

            int res = 0;

            int MaxBook = 0;

            if (r == 0)
            {
                Console.WriteLine(0 + " " + 0);
            }

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

                if (k < MaxBook)
                {
                    res = k + 1;
                }

                if (k == MaxBook)
                {
                    res = k;
                }

                if (k > MaxBook)
                {
                    res = n-k;
                }

                if (k < n)
                {
                    Console.WriteLine(1 + " " + res);
                }
                else if (k >= n)
                {
                    Console.WriteLine(0 + " " + 0);
                }
                else if (k = 0)
                {
                    Console.WriteLine(1 + " " + 1);
                }

           // while (Console.ReadKey().Key != ConsoleKey.Enter) { }

        }
    }
}


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {

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

            Int32 n = Int32.Parse(tokens[0]);
            Int32 k = Int32.Parse(tokens[1]);

            Int32 r = n - k;

            int res = 0;

            int MaxBook = 0;

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

                if (k < MaxBook)
                {
                    res = k + 1;
                }

                if (k == MaxBook)
                {
                    res = k;
                }

                if (k > MaxBook)
                {
                    res = n-k;
                }

                if (k == 0)
                {
                    Console.WriteLine(0 + " " + 0);
                }

                else if (k < n)
                {
                    Console.WriteLine(1 + " " + res);
                }
                else if (k >= n)
                {
                    Console.WriteLine(0 + " " + 0);
                }

            while (Console.ReadKey().Key != ConsoleKey.Enter) { }

        }
    }
}


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

namespace CodeForce
{
    public class Program
    {
        static void Main(string[] args)
        {
            string input1 = Console.ReadLine();
            Console.WriteLine(Solve(input1));
        }

        /*
            Luba And The Ticket
            time limit per test2 seconds
            memory limit per test256 megabytes
            inputstandard input
            outputstandard output
            Luba has a ticket consisting of 6 digits. In one move she can choose digit in any position and replace it with arbitrary digit. She wants to know the minimum number of digits she needs to replace in order to make the ticket lucky.

            The ticket is considered lucky if the sum of first three digits equals to the sum of last three digits.

            Input
            You are given a string consisting of 6 characters (all characters are digits from 0 to 9) — this string denotes Luba's ticket. The ticket can start with the digit 0.

            Output
            Print one number — the minimum possible number of digits Luba needs to replace to make the ticket lucky.
         */
        public static int Solve(string input1)
        {
            var firstTree = input1.Substring(0, 3).Select(c => int.Parse(c.ToString()));
            var lastTree = input1.Substring(3).Select(c => int.Parse(c.ToString()));

            return InnerSolve(firstTree.ToList(), lastTree.ToList(), 0);
        }

        private static int InnerSolve(
            List<int> firstTree,
            List<int> lastTree,
            int count)
        {
            var firstSum = firstTree.Sum();
            var lastSum = lastTree.Sum();
            if (firstSum == lastSum) return count;
            var difference = Math.Abs(firstSum - lastSum);
            var firstDiff = 0;
            if (lastSum > firstSum)//needs increment
            {
                firstTree.Sort();
                firstDiff = 9 - firstTree.First();
            }
            else
            {
                firstTree.Sort((a, b) => b - a);
                firstDiff = firstTree.First();
            }

            var lastDiff = 0;
            if (firstSum > lastSum)//needs increment
            {
                lastTree.Sort();
                lastDiff = 9 - lastTree.First();
            }
            else
            {
                lastTree.Sort((a, b) => b - a);
                lastDiff = lastTree.First();
            }

            var updateFirst = firstDiff > lastDiff;

            var list = (updateFirst ? firstTree : lastTree);
            var other = (updateFirst ? lastTree : firstTree);
            if (list.Sum() > other.Sum())// need to decrement
            {
                list.Sort((a, b) => b - a);
                var original = list.First();
                var decremented = original > difference ?
                    original - difference :
                    0;
                list = list.Skip(1).ToList();
                list.Add(decremented);
                return updateFirst ?
                    InnerSolve(list, lastTree, count + 1) :
                    InnerSolve(firstTree, list, count + 1);
            }
            else //need to increment
            {
                list.Sort();
                var original = list.First();
                var incremented = difference >= 9 ?
                    9 :
                    (difference - original) + original;
                list = list.Skip(1).ToList();
                list.Add(incremented);
                return updateFirst ?
                    InnerSolve(list, lastTree, count + 1) :
                    InnerSolve(firstTree, list, count + 1);
            }
        }
    }
}


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)
        {

            String s = Console.ReadLine();

            int L = (s[0] - '0') + (s[1] - '0') + (s[2] - '0');

            int R = (s[3] - '0') + (s[4] - '0') + (s[5] - '0');

            int diff = Math.Abs(L - R), ans = 0;

            if (L < R){

                int[] a = new int[3];

                for (int i = 0; i < 3; i++){

                    a[i] = s[i] - '0';

                }

                Array.Sort(a);

                while (diff > 0){

                    diff -= Math.Min(9, Math.Abs(diff - a[ans]));

                    ans++;

                }

            }
            else if (L > R){

                int[] a = new int[3];

                for (int i = 0; i < 3; i++){

                    a[i] = s[i + 3] - '0';

                }

                Array.Sort(a);

                while (diff > 0){

                    diff -= Math.Min(9, Math.Abs(diff - a[ans]));

                    ans++;

                }

            }

            Console.WriteLine(ans);

        }
    }
}


using System;

namespace CodeForces
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			string line1 = Console.ReadLine();
			string line2 = Console.ReadLine();
			string[] split = line1.Split(new Char[] { ' ', ',', '.', ':', '\t' });
			string[] split2 = line2.Split(new Char[] { ' ', ',', '.', ':', '\t' });
			int n = Int32.Parse(split[0]);
			int s = Int32.Parse(split[1]);
			int[] integers = new int[n];
			for (int i = 0; i < n; i++)
			{
				integers[i] = Int32.Parse(split2[i]);
			}

			Console.WriteLine("YES");
		}

	}


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

namespace tes
{
	class contest
	{
		static void Main(string[] args)
		{

			 var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = input[0];
            int a = input[1];
            int b = input[2];
            int c = input[3];
            int d = input[4];

            var mg = new int[3,3];
            mg[0, 1] = a;
            mg[1, 0] = b;
            mg[1, 2] = c;
            mg[2, 1] = d;

            int count = 0;

            var sum = new int[4];
            for(int i =1; i<= n; i++)
            {
                mg[1, 1] = i;
                sum[0] = a + b + i;
                sum[1] = a + c + i;
                sum[2] = b + d + i;
                sum[3] = c + d + i;

                int mx = sum.Max();
                for(int j = 1; j<=n; j++)
                {
                    int tmp = mx+j;
                    bool ok = false;
                    for (int m = 0; m < 4; m++)
                    {
                        if(tmp - sum[m] <= n)
                        {
                            ok = true;
                        }
                        else
                        {
                            ok = false;
                            break;
                        }
                    }

                    if (ok) count++;
                }
            }

            Console.WriteLine(count);

		}

	}
}


var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = input[0];
            int a = input[1];
            int b = input[2];
            int c = input[3];
            int d = input[4];

            int count = 0;

            var sum = new int[4];
            for(int i =1; i<= n; i++)
            {

                sum[0] = a + b + i;
                sum[1] = a + c + i;
                sum[2] = b + d + i;
                sum[3] = c + d + i;

                int mx = sum.Max();
                int tmp = mx + i;

                if (n == 1 && sum.Count(m => m == sum[0]) == 4) count = 1;
                else
                {
                    if(tmp-sum.Min()<=n) count += n - 1;

                }

            }

            Console.WriteLine(count);


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

class Program {
	static void Main() {
		string[] input = Console.ReadLine().Split();
		int a = int.Parse(input[0]);
		int b = int.Parse(input[1]);
		int m = int.Parse(input[2]);
		int r = int.Parse(input[3]);
		var l = new List<int>();
		var t = new List<int>();
		int i = 1;
		while(true){
			r = (a * r + b) % m;
			if(!l.Contains(r)){
				l.Add(r);
				t.Add(i);
			}else{
				int index = l.IndexOf(r);
				Console.WriteLine(i - t[index]);
				break;
			}
			i++;
		}
	}
}


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

namespace cf172B
{
    class Program
    {
        static void Main(string[] args)
        {
            var inp = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int a = inp[0], b = inp[1], m = inp[2], r = inp[3];
            var seq = new List<int>();
            var matrix = new int[m];
            for (int i = 1; i < m * 2; i++)
            {
                r = (a * r + b) % m;
                seq.Add(r);
                matrix[r]++;
            }
            var period = matrix.Count(d => d >= matrix.Max() || d >= matrix.Max() - 1);
            Console.WriteLine(period);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
public static class Codeforces
{
    static TextReader reader;
    static TextWriter writer;
    static void Main()
    {
        reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
        var n = ReadInt();
        var ar = ReadIntArray();
        Array.Sort(ar);
        Write(ar.Skip(1).All(i => i % ar[0] == 0) ? ar[0] : -1);
        reader.Close();
        writer.Close();
    }
    #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<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }
    #endregion
}


using System;
using System.Text.RegularExpressions;

namespace ConsoleApp2
{
    class Program
    {
        static long A = 0, B = 0;
        static void Main(string[] args)
        {
            long n, a, b, p, q,z,m;
            string[] s = Console.ReadLine().Split();
            n = Int64.Parse(s[0]);
            a = Int64.Parse(s[1]);
            b = Int64.Parse(s[2]);
            p = Int64.Parse(s[3]);
            q = Int64.Parse(s[4]);
            z = a * b;
            for(int i=1;i<=n;i++)
            {
                if (i % z == 0)
                    A += Math.Max(p, q);
                else if (i % a == 0)
                    A += p;
                else if (i % b == 0)
                    A += q;
            }
            Console.WriteLine(A);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Xml.Xsl;

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

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

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

			int m = inputs1[0];
			int d = inputs1[1];

			if (m == 2)
			{
				Console.WriteLine(4);
				return;
			}

			if (d < 6)
			{
				Console.WriteLine(5);
				return;
			}

			if (m == 1 || m == 3 || m == 5 || m == 7 || m == 8 || m == 10 || m == 12)
			{
				Console.WriteLine(6);
			}
			else
			{
				if (d == 7)
				{
					Console.WriteLine(6);
					return;
				}

				Console.WriteLine(5);
			}
		}

		public class Team
		{
			public string Name { get; set; }

			public int Points { get; set; }

			public int GoalsFor { get; set; }

			public int GoalsAgainst { get; set; }
		}

		static long Factorial(long a)
		{
			return a > 1 ? a * Factorial(a - 1) : 1;
		}
	}
}


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

namespace plo
{
    class Program
    {
        static void Main(string[] args)
        {
            //Input m, n, a from keyboard and put it into the long varibaleg
            Console.Write("Input m,n,a: ");
            string whole = Console.ReadLine();
            int com = whole.IndexOf(' ');
            long m = long.Parse(whole.Substring(0, com));

            string who = whole.Substring(com + 1);
            int com2 = who.IndexOf(' ');
            long n = long.Parse(who.Substring(0, com2));

            long a = long.Parse(who.Substring(com + 1));

            if (nmoda != 0)
            {
                num_n += 1;
            }

            //total number of peaces
            long num_sq = num_n * num_m;

            //output the result
            Console.WriteLine();
            Console.WriteLine("we need " + num_sq+ " peaces");
        }
    }
}


using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int hojas;
            int[] diasSemana = new int[7];
        hojas = int.Parse(Console.ReadLine());
        for(int i =0; i<7; i++)
            diasSemana[i] = int.Parse(Console.ReadLine());
        int dia=0;
        while(hojas>0)
        {
            hojas-=diasSemana[dia];
                if(hojas<=0)
                {
                       Console.WriteLine(dia+1);
                       break;
                }
            if(dia==6 )
            {
                dia=0;
                continue;
            }
            dia++;
        }
        }
    }
}


using System;
    class Main
    {
        static void Main()
        {
            int hojas;
            int[] diasSemana = new int[7];
        hojas = int.Parse(Console.ReadLine());
        for(int i =0; i<7; i++)
            diasSemana[i] = int.Parse(Console.ReadLine());
        int dia=0;
        while(hojas>0)
        {
            hojas-=diasSemana[dia];
                if(hojas<=0)
                {
                       Console.WriteLine(dia+1);
                       break;
                }
            if(dia==6 )
            {
                dia=0;
                continue;
            }
            dia++;
        }
    }
}


using System;

namespace Olymp579A
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine()), m = 0;
            while (n != 1)
            {
                if ((int)Math.Log(n, 2) == Math.Log(n, 2)) break;
                else
                {
                    ++m;
                    n -= (int)Math.Pow(2, (int)Math.Log(n, 2));
                }
            }
            Console.WriteLine(m + 1);
            Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;

    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(new myGameTree(Int64.Parse(Console.ReadLine().Trim())).ToString());
        }

        class myGameTree
        {
            static long finish;
            static List<long> LastChildren;

            public myGameTree(long x)
            {
                finish = x;
                LastChildren = new List<long>();
                Node first = new Node(1);
                LastChildren.Sort();
            }

            public override string ToString()
            {
                return LastChildren[0].ToString();
            }

            class Node
            {
                private Node[] myChildren;
                private long value;
                private long score;

                public Node(long first)
                {
                    value = 1;
                    score = 1;
                    if (finish - value > 0)
                        MakeChild(finish - value);
                    LastChildren.Add(finish);
                }

                public Node(Node father, long addon)
                {
                    value = (father.value << 1) + addon;
                    score = father.score + addon;

                    long prod = finish - (value << 1);

                    if (prod + 1 > 0)
                        MakeChild(prod + 1);
                    if (value == finish)
                        LastChildren.Add(score);

                }

                private void MakeChild(long prod)
                {
                        myChildren = new Node[prod];
                        for (long i = prod; i-- > 0; myChildren[i] = new Node(this, i));
                }
            }
        }
    }


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

namespace GameTree
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(new GameTree(Int64.Parse(Console.ReadLine().Trim())).ToString());
            Console.ReadLine();
        }

        class GameTree
        {
            private static long finish;
            private static HashSet<long> LastChildren;
            private long min;

            public myGameTree(long x)
            {
                finish = x;
                LastChildren = new HashSet<long>();
                Node first = new Node(1);
                min = LastChildren.Min();
                LastChildren.Clear();
                LastChildren = null;
            }

            public override string ToString()
            {
                return min.ToString();
            }

            struct Node
            {
                private long value;
                private long score;

                public Node(long first)
                {
                    value = 1;
                    score = 1;
                    if (finish - value > 0)
                        MakeChild(finish - value);
                    LastChildren.Add(finish);
                }

                public Node(long father_value, long father_score, long addon)
                {
                    value = (father_value << 1) + addon;
                    score = father_score + addon;

                    if (!LastChildren.Contains(LastChildren.Count))
                        MakeChild(finish - (value << 1) + 1);
                }

                private void MakeChild(long prod)
                {
                    for (long i = 0; i < prod; i++)
                    {
                        if (finish - ((value << 1) + i) > 1)
                        {
                            Node child = new Node(value, score, i);
                        }
                        else if ((value << 1) + i == finish)
                            LastChildren.Add(score + i);
                    }

                }
            }
       }
    }
}


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

namespace GameTree
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(new GameTree(Int64.Parse(Console.ReadLine().Trim())).ToString());
            Console.ReadLine();
        }
    }

        public class GameTree
        {
            private static long finish;
            private static HashSet<long> LastChildren;
            private long min;

            public GameTree(long x)
            {
                finish = x;
                LastChildren = new HashSet<long>();
                Node first = new Node(1);
                min = LastChildren.Min();
                LastChildren.Clear();
                LastChildren = null;
            }

            public override string ToString()
            {
                return min.ToString();
            }

            struct Node
            {
                private long value;
                private long score;

                public Node(long first)
                {
                    value = 1;
                    score = 1;
                    if (finish - value > 0)
                        MakeChild(finish - value);
                    LastChildren.Add(finish);
                }

                public Node(long father_value, long father_score, long addon)
                {
                    value = (father_value << 1) + addon;
                    score = father_score + addon;

                    if (!LastChildren.Contains(LastChildren.Count))
                        MakeChild(finish - (value << 1) + 1);
                }

                private void MakeChild(long prod)
                {
                    for (long i = 0; i < prod; i++)
                    {
                        if (finish - ((value << 1) + i) > 1)
                        {
                            Node child = new Node(value, score, i);
                        }
                        else if ((value << 1) + i == finish)
                            LastChildren.Add(score + i);
                    }

                }
            }
    }
}


using System;

class Program
{
    void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int result = 0;
        while (n > 0)
        {
            n -= ((int)Math.Log(n, 2) - 1);
            ++result;
        }
        Console.WriteLine(result);
    }
}


using System;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        int result = 0;
        while (n > 0)
        {
            n -= ((int)Math.Log(n, 2) - 1);
            ++result;
        }
        Console.WriteLine(result);
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27004.2009
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConsoleApp8", "ConsoleApp8\ConsoleApp8.csproj", "{B433AB21-B567-4758-8071-1A5350687DC5}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{B433AB21-B567-4758-8071-1A5350687DC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{B433AB21-B567-4758-8071-1A5350687DC5}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{B433AB21-B567-4758-8071-1A5350687DC5}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{B433AB21-B567-4758-8071-1A5350687DC5}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {17E13182-9B37-43EE-B8CA-350F37EC1123}
	EndGlobalSection
EndGlobal


using System;
using System.IO;
class _320_Div2_ProbA {
	public static void Main() {
		Console.SetIn(new StreamReader(File.OpenRead("C://Users//sivak//Desktop//_320_Div2_ProbA.txt")));
		var x = int.Parse(Console.ReadLine());
		int sum = 0;
		while (x != 0) {
			sum += (x % 2);
			x /= 2;
		}
		Console.WriteLine(sum);
	}
}


using System;
{
    class Program
    {
        static void Main(string[] args)
        {
            int n , temp;

            n= Convert.ToInt32(Console.ReadLine());

            temp = (n*(n+1))/ 2;

            Console.WriteLine(temp % 2);
        }
    }
}


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

namespace ConsoleApp7
{
    class Program
    {
        static void Main(string[] args)
        {
            int x = Convert.ToInt16(Console.ReadLine());
            if (x == 3)
                Console.WriteLine(0);
            else
            {
                Console.WriteLine(1);
            }
        }
    }
}


using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text.RegularExpressions;
using System.Text;
using System;

class Solution
{
    static int pos(int n)
    {
        int left = 0;
        int right = 0;
        left = n;
        int i = n - 1;
        while (i > 0)
        {
            if (left > right)
                right += i;
            else
                left += i;
            i--;
        }
        return Math.Abs(left - right);
    }
    static void Main(string[] args)
    {
        int n;
        string s=Console.ReadLine();
        n = int.Parse(s);
        int res = pos(n);
        Console.WriteLine(res);
    }
}


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

public class GFG
{
    static public void Main()
    {
        try
        {
            //int test = Convert.ToInt32(Console.ReadLine());
            //for (int i = 0; i < test; i++)

            //{
            //    var input = Console.ReadLine().Split(' ');
            //    var a = int.Parse(input[0]);
            //    var b = int.Parse(input[1]);
            //    var q = int.Parse(input[2]);

            //    for (int j = 0; j < q; j++)
            //    {
            //        var aar1 = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            //        YetAnotherCountProb(a, b, aar1);
            //        Console.WriteLine();
            //    }

            //}
            int n = Convert.ToInt32(Console.ReadLine());
            IntSeqDiv(n);

        }
        catch (Exception ex)
        {
            Console.Write(ex);
        }
    }

    static void IntSeqDiv(int n)
    {

        int leftSum = 0;
        int rightSum = 0;

        for (int i = n; i > 1; i++)
        {
            if (n % 2 == 0)
                leftSum = leftSum + i;
            else
                rightSum = rightSum + i;

        }

        var ans1 = Math.Abs((leftSum + 1) - rightSum);
        var ans2 = Math.Abs((leftSum) - (rightSum + 1));

        Console.Write(Math.Min(ans1, ans2));
    }

}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28010.2036
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ForCodeforces", "ForCodeforces\ForCodeforces.csproj", "{9372C2A1-BA75-45D9-8BA0-2C6EBC15BD1C}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{9372C2A1-BA75-45D9-8BA0-2C6EBC15BD1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{9372C2A1-BA75-45D9-8BA0-2C6EBC15BD1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{9372C2A1-BA75-45D9-8BA0-2C6EBC15BD1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{9372C2A1-BA75-45D9-8BA0-2C6EBC15BD1C}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
		SolutionGuid = {4412A573-E066-4AE4-B95A-69ED731622F1}
	EndGlobalSection
EndGlobal


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

namespace ConsoleApplication1
{
    class A1102_IntegerSequenceDividing
    {
        public static void Main()
        {
            decimal sum = 0;
            int a = int.Parse(Console.ReadLine());
            for (int i = 1; i <= a; i++)
                sum += i;

            if(sum%2==0)
                Console.WriteLine(0);
            else
                Console.WriteLine(1);
        }
    }
}


using System;
using System.Linq;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Int32.Parse(Console.ReadLine());
            int summA = 0, summB = 0;

            for (int i = n; i > 0; i--)
            {
                if (summA >= summB)
                {
                    summB += i;
                }
                else
                {
                    summA += i;
                }
            }
            Console.WriteLine(Math.Abs(summA - summB));
        }
    }
}


using System;
using System.Linq;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Int64.Parse(Console.ReadLine());
            int summA = 0, summB = 0;

            for (int i = n; i > 0; i--)
            {
                if (summA >= summB)
                {
                    summB += i;
                }
                else
                {
                    summA += i;
                }
            }
            Console.WriteLine(Math.Abs(summA - summB));
        }
    }
}


namespace Test
{
    class Program
    {

        static void Main(string[] args)
        {
            var num1 = int.Parse(Console.ReadLine());
            var sum = (1 + num1) * num1 / 2;
            Console.WriteLine(sum - sum / 2 * 2);

        }

    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        static int n, k;
        static void Main(string[] args)
        {

            List<int> inputs = new List<int> { };

            n = Convert.ToInt32(Console.ReadLine());

            List<int> nums = new List<int> { };
            List<int> nums2 = new List<int> { };

            for (int i = 0; i < n; i++)
            {
                nums.Add(i + 1);
            }
            while (true)
            {
                if (nums.Sum() == nums2.Sum())
                {
                    Console.WriteLine("0");
                    break;
                }
                else if (nums.Sum() >= nums2.Sum())
                {
                    if(nums.Sum() - nums.Min() < nums2.Sum() + nums.Min())
                    {
                        k = Math.Abs(nums.Sum() - nums2.Sum());
                        nums2.Add(nums.Min());
                        nums.Remove(nums.Min());
                    }
                    else
                    {
                        nums2.Add(nums.Min());
                        nums.Remove(nums.Min());
                    }
                }

                else if (nums.Sum() <= nums2.Sum())
                {
                    if (nums2.Sum() - nums2.Min() < nums.Sum() + nums2.Min())
                    {
                        if (Math.Abs((nums2.Sum() - nums2.Min()) - (nums.Sum() + nums2.Min())) < Math.Abs(nums.Sum() - nums2.Sum()))
                        {
                            nums.Add(nums2.Min());
                            nums2.Remove(nums2.Min());
                        }
                        if(Math.Abs(nums.Sum() - nums2.Sum()) < k)
                        {
                            Console.WriteLine(Math.Abs(nums.Sum() - nums2.Sum()));
                        }
                        else
                        {
                            Console.WriteLine(k);
                        }
                        break;
                    }
                    else
                    {
                        nums.Add(nums2.Min());
                        nums2.Remove(nums2.Min());
                    }
                }
            }

            Console.Read();

        }

        public static List<int> reverse(string s)
        {
            s += " ";
            string news = "";
            List<int> res = new List<int> { };
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] != ' ')
                {
                    news += s[i];
                }
                else
                {
                    res.Add(Convert.ToInt32(news));
                    news = "";
                }
            }
            return res;
        }
    }
}


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

namespace ConsoleApp1
{
    class Program
    {
        static long n,sum;
        static void Main(string[] args)
        {

            List<int> inputs = new List<int> { };

            n = Convert.ToInt32(Console.ReadLine());

            for(long i = 0; i < n; i++)
            {
                sum += (i + 1);
            }
            Console.WriteLine(sum % 2);
            Console.Read();

        }

        public static List<int> reverse(string s)
        {
            s += " ";
            string news = "";
            List<int> res = new List<int> { };
            for (int i = 0; i < s.Length; i++)
            {
                if (s[i] != ' ')
                {
                    news += s[i];
                }
                else
                {
                    res.Add(Convert.ToInt32(news));
                    news = "";
                }
            }
            return res;
        }

    }
}


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

namespace ����������_������������������
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());

            if (n == 3)
                Console.WriteLine(0);
            else if (n % 4 == 0)
                    Console.WriteLine(0);
                else
                    Console.WriteLine(1);
                //Console.ReadKey();
        }
    }
}


using System;

class B450 {
    const int M = 1000000007;

    public static void Main() {
        var line = Console.ReadLine().Split();
        var a1 = (int.Parse(line[0]) + M) % M;
        var a2 = (int.Parse(line[1]) + M) % M;
        var n = int.Parse(Console.ReadLine());
        while (n != 1) {
            var a3 = (a2 + M - a1) % M;
            a1 = a2;
            a2 = a3;
            --n;
        }
        Console.WriteLine(a1);
    }
}


using System;

namespace tmp6
{
    class Program
    {
        static void Main(string[] args)
        {
            UInt64 n = Convert.ToUInt64(Console.ReadLine()), count = 0;
            for (UInt64 i = 1; i < n + 1; i++)
            {
                string s = i.ToString();
                if (s.IndexOf('2') < 0 && s.IndexOf('3') < 0 && s.IndexOf('4') < 0 && s.IndexOf('5') < 0
                    && s.IndexOf('6') < 0 && s.IndexOf('7') < 0 && s.IndexOf('8') < 0 && s.IndexOf('9') < 0)
                    count++;
            }
            Console.WriteLine(count);
        }
    }
}


using System;
using System.Linq;
using MoreLinq;
class Program
{
    static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var bin = Enumerable.Range(1, 512).Select(i => Convert.ToString(i, 2)).Select(int.Parse).ToArray();
        var index = Array.IndexOf(bin, bin.MinBy(i => n > i));
        if (n == bin[index])
        {
            index++;
        }
        Console.WriteLine(index);
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static int[] ReadInt(int size)
        {
            string[] input = Console.ReadLine().Split(' ');
            int[] res = new int[size];
            for (int i=0; i<input.Length; i++)
            {
                res[i] = Convert.ToInt32(input[i]);
            }
            return res;
        }

        static int ReadInt()
        {
            int n = Convert.ToInt32(Console.ReadLine());
            return n;
        }

        static void ReadInt(out int a, out int b)
        {
            int[] input = ReadInt(2);
            a = input[0];
            b = input[1];
        }

        static void ReadInt(out int a, out int b, out int c)
        {
            int[] input = ReadInt(3);
            a = input[0];
            b = input[1];
            c = input[2];
        }

        static String ReadString()
        {
            return Console.ReadLine();
        }

        static int Max(int a, int b)
        {
            return (a > b ? a : b);
        }

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

        static void swap(ref int a, ref int b)
        {
            int temp = a;
            a = b;
            b = temp;
        }

        static char[] charArray = new char[10];
        static int count = 0;
        static void attempt(int pos, int n, int k)
        {
            charArray[0] = '0';
            charArray[1] = '1';
            if (pos > k) return;
            for (char ch = '0'; ch <= '1'; ch++)
            {
                charArray[pos] = ch;
                if (pos == k)
                {
                    int tmp = Convert.ToInt32(String.Join("", charArray));
                    if (tmp <= n) count++;
                }
                attempt(pos + 1, n, k);
            }
        }

        static void Main(string[] args)
        {
            int n = ReadInt();
            int k = n.ToString().Length;
            int res = Convert.ToInt32(Math.Pow(2, k - 1)) - 1;
            count = 0;
            if (k == 1) res = 1;
            else attempt(2, n, k);
            res += count;
            WL(res);
        }
    }
}


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

namespace _2018_08_23_alyona_and_numbers
{
    class Program
    {
        static void Main(string[] args)
        {
            //http://codeforces.com/problemset/problem/682/A

            string[] nm = Console.ReadLine().Split(' ');
            int n = int.Parse(nm[0]);
            int m = int.Parse(nm[1]);
            int [] first = new int [n];
            int[] second = new int[m];
            int modfive = 0;

            for (int i= 0; i<n; i++)
                first[i] = i + 1;

            for (int i = 0; i < m; i++)
                second[i] = i + 1;

            for (int i = 0; i<n; i++)
            {
                for(int j = 0; j<m; j++)
                {
                    if ((first[i] + second[j]) % 5 == 0)
                        modfive++;
                }
            }
            Console.WriteLine(modfive);

        }
    }
}


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

namespace trenvk
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nm = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int res = 0;

            for(int i = 1; i <= nm[0]; i++)
            {
                for(int j = 1; j <= nm[1]; j++)
                {
                    if ((i + j) % 5 == 0) res++;
                }
            }
            Console.Write(res);
        }
    }
}


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

namespace A.Алёна_и_числа
{
    class Program
    {
        static void Main(string[] args)
        {
            var mm = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = mm[0];
            int m = mm[1];
            int s = 0;

            for (int i = 1; i <= n; i++)
                for (int j = 1; j <= m; j++)
                    if ((i + j) % 5 == 0) s++;

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


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

public static class A___Alyona_and_Numbers
{
    private static void Solve()
    {
        int n = ReadInt();
        int m = ReadInt();
        int pairs = 0;

        for (int i = 1; i <= n; i++)
        {
            for (int j = 1; j <= m; j++)
            {
                if ((i + j) % 5 == 0)
                {
                    pairs++;
                }
            }
        }

        Write(pairs);
    }

    #region Main

    private static TextReader reader;
    private static TextWriter writer;
    public static void Main()
    {
#if DEBUG
        //reader = new StreamReader("C:\\Users\\Axel\\Desktop\\input.txt");
        reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());
        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            Solve();
            //var thread = new Thread(new A___Alyona_and_Numbers().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        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 Read() { while (currentLineTokens.Count == 0) currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue(); }
    public static int ReadInt() { return int.Parse(Read()); }
    public static long ReadLong() { return long.Parse(Read()); }
    public static double ReadDouble() { return double.Parse(Read(), 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
}