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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        long w = ReadLong();
        long m = ReadLong();
        long k = ReadLong();

        int n = m.ToString().Length;
        if (n * k > w)
        {
            Write(0);
            return;
        }
        w -= n * k;

        n = (m + 1).ToString().Length;

        long d = 0;
        while (d <= m)
            d = d * 10 + 9;

        long x = m;
        while (true)
        {
            if (w < n * k)
                break;
            long v = Math.Min(d - x, w / n / k);
            w -= v * n * k;
            x += v;
            d = d * 10 + 9;
            n++;
        }

        Write(x - m + 1);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

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

    #endregion

    #region Read / Write

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

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

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

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

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

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

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

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

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

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

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

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

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

    public static void Write(params object[] array)
    {
        WriteArray(array);
    }

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

    class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }

    #endregion
}


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

namespace FixedPoints
{
    class Even_Odds
    {
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(' ');

            Int64 num = Int64.Parse(input[0]);
            Int64 i = Int64.Parse(input[1]);

            if (num % 2 != 0)
                num++;

            if (i <= num / 2)
                Console.WriteLine((2 * i) - 1);
            else
                Console.WriteLine(-num + (2 * i));
        }
    }
}


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

namespace codeforces386
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            string[] inx = Console.ReadLine().Split(' ');
            int[] data = new int[n];
            for (int i = 0; i < n; i++)
            {
                data[i] = Convert.ToInt32(inx[i]);
            }
            int t = Convert.ToInt32(Console.ReadLine());
            if (n == 1)
            {
                Console.WriteLine(1);
                return;
            }
            Array.Sort(data);
            int a, b, max, curr;
            a = 0; b = 0;
            max = 0;
            curr = 0;
            while (b < n)
            {
                while (b < n && Math.Abs(data[a] - data[b]) <= t)
                {
                    b++;
                    curr++;
                    if (curr > max) max = curr;
                }
                if (b == n) break;
                while (Math.Abs(data[a] - data[b]) > t)
                {
                    a++;
                    curr--;
                }
            }
            Console.WriteLine(max);
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            string stroka = ""; long[] strochenka = { 0, 0 }; string konec = ""; long itog = 0; long i = 0; int u = 0; long l = 1; string konec2 = "";
            stroka = Console.ReadLine();
            i = Convert.ToInt64(stroka);
      gg:      for (u = 0; u <= 17; u++)
            {
                if (i >= l)
                {
                    konec = (u + 1).ToString() + " ";
                }
                if (i < l)
                {
                    konec2 = konec2 + " " + konec;
                    break;
                }
                l = l * 2;

            }
            i=i-l/2;
            l = 1;
            if (i > 0)
                goto gg;
            Console.Write(konec2.Substring(1));
        }
    }
}


/* Date: 22.10.2020 *  Time: 22:45 */
//
// CF 677 A
//
//

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

class Example
{
# if ( ! ONLINE_JUDGE )
	public static StreamReader sr = new StreamReader ("C:\\TRR\\2020\\Task\\07 Codeforces\\050\\A.TXT");
	public static StreamWriter sw = new StreamWriter ("C:\\TRR\\2020\\Task\\07 Codeforces\\050\\OUTPUT.OUT");
# endif

# if ( ! ONLINE_JUDGE )
	public static void Print (int [] a, string title)
	{
		sw.WriteLine ("*** " + title);
		sw.Write ("***");
		for ( int i=0; i < a.Length; i++ )
			sw.Write (" " + a [i]);
		sw.WriteLine ();
	}
# endif
	public static void Main (string[] args)
	{
		NumberFormatInfo nfi = NumberFormatInfo.InvariantInfo;

		int q;

# if ( ONLINE_JUDGE )
		q = int.Parse (Console.ReadLine ());
# else
		q = int.Parse (sr.ReadLine ());
		sw.WriteLine ("*** TEST = " + q);
# endif

		for ( int _q=0; _q < q; _q++ )
		{
			int n;

# if ( ONLINE_JUDGE )
			n = int.Parse (Console.ReadLine ());
# else
			sw.WriteLine ("*** # " + _q);
			n = int.Parse (sr.ReadLine ());
# endif

# if ( ! ONLINE_JUDGE )
			sw.WriteLine ("*** n = " + n);
# endif

			int dig = n % 10, kold = 0;
			while ( n > 0 )
			{
				n /= 10;
				kold++;
			}

			int d = (dig - 1) * 10;
			switch ( kold )
			{
				case 1 : d += 1; break;
				case 2 : d += 3; break;
				case 3 : d += 6; break;
				case 4 : d += 10; break;
			}

# if ( ONLINE_JUDGE )
			Console.WriteLine (d);
# else
			sw.WriteLine (d);
# endif
		}

# if ( ! ONLINE_JUDGE )
		sw.Close ();
# endif
	}
}


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

namespace ProgrammingContest.Codeforces.Round70
{
    class E
    {
        static int t,n;
        static int[,] dist, dist2;
        static string[] b1, b2;

        const int INF = 100000;

        static void bfs(int x, int y, bool chk)
        {
            int[] dx = new int[4] { 1, 0, -1, 0 },
                  dy = new int[4] { 0, -1, 0, 1 };
            bool[,] visited = new bool[n, n];
            Queue<int> q = new Queue<int>();
            q.Enqueue(x * n + y);
            visited[x, y] = true;
            for (int a = 0; a < n; a++)
                for (int b = 0; b < n; b++)
                    dist[a, b] = INF;
            dist[x, y] = 0;
            while (q.Any())
            {
                int v = q.Dequeue();
                x = v / n; y = v % n;
                for (int i = 0; i < 4; i++)
                    if (InRange(x + dx[i]) && InRange(y + dy[i]))
                    {
                        int d = dist[x, y] + 1;
                        if (visited[x + dx[i], y + dy[i]] || d > t || !char.IsDigit(b1[y + dy[i]][x + dx[i]]))
                        {
                            continue;
                        }
                        visited[x + dx[i], y + dy[i]] = true;
                        if (!chk)
                        {
                            dist[x + dx[i], y + dy[i]] = d;
                            q.Enqueue((x + dx[i]) * n + (y + dy[i])); ;
                        }
                        else
                        {
                            char b = b2[y + dy[i]][x + dx[i]];
                            if (d < dist2[x + dx[i], y + dy[i]])
                            {
                                q.Enqueue((x + dx[i]) * n + (y + dy[i]));
                                dist[x + dx[i], y + dy[i]] = d;
                            }
                            else if ('1' <= b && b <= '9' && d == dist2[x + dx[i], y + dy[i]])
                                dist[x + dx[i], y + dy[i]] = d;
                        }
                    }
            }
        }

        static bool InRange(int v) { return 0 <= v && v < n; }

        public static void Main()
        {
            var xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss => int.Parse(sss));
            n = xs[0];
            t = xs[1];
            dist = new int[n, n];
            b1 = new string[n];
            b2 = new string[n];
            for (int y = 0; y < n; y++)
                b1[y] = Console.ReadLine();
            Console.ReadLine();
            for (int y = 0; y < n; y++)
                b2[y] = Console.ReadLine();
            Dinic dinic = new Dinic(2000);
            int scnt = 2;
            for (int y = 0; y < n; y++)
                for (int x = 0; x < n; x++)
                    if (b1[y][x] == 'Z')
                    {
                        bfs(x,y,false);
                        dist2 = (int[,])dist.Clone();
                    }
            for (int y = 0; y < n; y++)
                for (int x = 0; x < n; x++)
                {
                    if (!('1' <= b1[y][x] && b1[y][x] <= '9'))
                        continue;
                    bfs(x, y, true);
                    int scientists = b1[y][x] - '0';
                    for (int j = 0; j < scientists; j++)
                        dinic.AddEdge(0, scnt + j, 1);
                    int idx = 1000;
                    for (int a = 0; a < n; a++)
                        for (int b = 0; b < n; b++)
                        {
                            if (!('1' <= b2[a][b] && b2[a][b] <= '9'))
                                continue;
                            int cnt = b2[a][b] - '0';
                            for (int i = 0; i < cnt; i++, idx++)
                                if (dist[b, a] < INF)
                                {
                                    //Console.WriteLine("{0} {1} -> {2} {3}", x, y, b, a);
                                    for (int j = 0; j < scientists; j++)
                                        dinic.AddEdge(scnt + j, idx, 1);
                                }
                        }
                    scnt += scientists;
                }
            for (int y = 0, k = 1000; y < n; y++)
                for (int x = 0; x < n; x++)
                    if ('1' <= b2[y][x] && b2[y][x] <= '9')
                    {
                        int cnt = b2[y][x] - '0';
                        for (int i = 0; i < cnt; i++, k++)
                            dinic.AddEdge(k, 1, 1);
                    }
            Console.WriteLine(dinic.BipartiteMatching(0,1));
        }

        #region MaximumFlow
        class Dinic
        {
            const int INF = 1 << 29;

            class Edge
            {
                public int to, cap, rev;
                public Edge(int to_, int cap_, int rev_) { to = to_; cap = cap_; rev = rev_; }
            }

            List<Edge>[] G;
            int[] level, iter;

            void bfs(int s)
            {
                for (int i = 0; i < level.Length; i++) level[i] = -1;
                Queue<int> q = new Queue<int>();
                level[s] = 0;
                q.Enqueue(s);
                while (q.Count > 0)
                {
                    int v = q.Dequeue();
                    for (int i = 0; i < G[v].Count; i++)
                    {
                        Edge e = G[v][i];
                        if (e.cap > 0 && level[e.to] < 0)
                        {
                            level[e.to] = level[v] + 1;
                            q.Enqueue(e.to);
                        }
                    }
                }
            }

            int dfs(int v, int t, int f)
            {
                if (v == t) return f;
                for (int i = iter[v]; i < G[v].Count; i++, iter[v]++)
                {
                    Edge e = G[v][i];
                    if (e.cap > 0 && level[v] < level[e.to])
                    {
                        int d = dfs(e.to, t, Math.Min(f, e.cap));
                        if (d > 0)
                        {
                            e.cap -= d;
                            G[e.to][e.rev].cap += d;
                            return d;
                        }
                    }
                }
                return 0;
            }

            public void AddEdge(int from, int to, int cap)
            {
                G[from].Add(new Edge(to, cap, G[to].Count));
                G[to].Add(new Edge(from, 0, G[from].Count - 1));
            }

            public int MaxFlow(int s, int t)
            {
                int flow = 0;
                for (; ; )
                {
                    bfs(s);
                    if (level[t] < 0) return flow;
                    for (int i = 0; i < iter.Length; i++) iter[i] = 0;
                    for (int f = 0; (f = dfs(s, t, INF)) > 0; )
                        flow += f;
                }
            }

            public int BipartiteMatching(int s, int t)
            {
                return MaxFlow(s, t);
            }

            public Dinic(int size)
            {
                level = new int[size];
                iter = new int[size];
                G = new List<Edge>[size];
                for (int i = 0; i < size; i++)
                    G[i] = new List<Edge>();
            }
        }
        #endregion
    }
}


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

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

            solve_helvetic2019A1_improved();
            //solve_262A();
        }

        /*
        In the tutorial it is mentioned that
        we are solving linear equation with one variable.

        Although it looks like a quadratic equation at first sight
        in reality it is a hidden linear equation.
        we just need to carefully analyse it and figure out
        that we don't always have equations in a clean canonical ways.
        like ax + b = 0.

        in the given equation:
        r = x^2 + 2xy + x + 1
        we could ajust it like that:
        r - x^2 - x - 1 = 2xy

        And this part brings confusion. Because the right part 2xy
        is not just y but also multiplied by 2x.
        TODO: Make description cleaner

         */
        public static void solve_helvetic2019A1_improved()
        {
            long r = Convert.ToInt64(Console.ReadLine());

            for (int x = 1; x < Math.Sqrt(r); x++)
            {
                long y = r - x * x - x - 1;

                if (y > 0 && y % 2 * x == 0)
                {
                    Console.WriteLine("{0} {1}", x, y / 2 * x);

                    return;
                }
            }

            Console.WriteLine("NO");
        }

        /*
        В первом варианте, я пытался тупо двойным циклом найти одновременно
        x и y. Но даже если учесть что в первом цикле у нас будет sqrt(r) итераций
        для нахождения x, то вторым циклом мы не сможем в рамках ограничения по времени задачи
        найти y.
         */
        public static void solve_helvetic2019A1()
        {
            long r = Convert.ToInt64(Console.ReadLine());

            bool found = false;
            long x = 0;
            long y = 0;
            long xLen = (int)Math.Sqrt(r);
            for (x = 1; x < xLen; x++)
            {
                long yLen = r <= 100000 ? r : r / (2 * xLen);
                for (y = 2 * x + 1; y < yLen; y++)
                {
                    long h = x * x + 2 * x * y + x + 1;
                    if (h > r)
                    {
                        break;
                    }

                    if (r == h)
                    {
                        found = true;
                        break;
                    }
                }

                if (found)
                {
                    break;
                }
            }

            if (found)
            {
                Console.Write("{0} {1}", x, y);
            }
            else
            {
                Console.Write("NO");
            }
        }

        public static void solve_262A()
        {
            string[] nm = Console.ReadLine().Split(' ');

            int n = Convert.ToInt32(nm[0]);
            int m = Convert.ToInt32(nm[1]);

            int bought = n;
            int max = n;
            while (bought > 0)
            {
                bought = max % m == 0 ? (bought + m - 1) / m : bought / m;
                max += bought;
            }
            Console.WriteLine(max);
        }

        /*
1)4
2)1 + (1 + 1) + (1 + 1)
3)1 + (1 + 1 + 1)
4)1

1 1

2 3

3 7

4 14

5 25

1)5
2)1 + (1 + 1) + (1 + 1) + (1 + 1)
3)1 + (1 + 1 + 1) + (1 + 1 + 1)
4)1 + (1 + 1 + 1 + 1)
5)1

(0) + 1 => (1) + 2 => (1 + 3) + 3 => (3 + 7) + 4 => (7 + 14) + 5
         */
        public static void solve_164B()
        {
            int n = Convert.ToInt32(Console.ReadLine());

            int total = 0;
            int prev = 0;
            int prevPrev = 0;
            for (int i = 1; i <= n; i++)
            {
                total = prevPrev + prev + i;

                prevPrev = prev;
                prev = total;
            }

            Console.WriteLine(total);
        }

        /*
        Внимание: в данной задаче если крот нажал на кнопку q и было смещение вправо.
        То есть надо восстановить, сместив букву влево, то у нас будет исключение.
        Потомучто в строке keyboard q это первая буква строки. И левее нее у нас ничего нет.
        НО! По условию у нас нигде не сказано, что если крот нажал на самую левую клавишу, то
        мы должны восстановить сообщение взяв самую правую букву. Циклический сдвиг замкнутость.
        То есть такой кейс не рассматривается.

        Для ускорения алгоритма, можно избавиться от встроенной проверки символа IndexOf и запихать
        все буквы в словарь. Где буквы будут ключами, а их значение индексом в строке.
         */
        public static void solve_271A()
        {
            string direction = Console.ReadLine();
            string text = Console.ReadLine();

            string keyboard = "qwertyuiopasdfghjkl;zxcvbnm,./";

            string answer = String.Empty;
            if (direction == "R")
            {
                for (int i = 0; i < text.Length; i++)
                {
                    answer += keyboard[keyboard.IndexOf(text[i]) - 1];
                }
            }
            else
            {
                for (int i = 0; i < text.Length; i++)
                {
                    answer += keyboard[keyboard.IndexOf(text[i]) + 1];
                }
            }

            Console.WriteLine(answer);
        }

        /*
        Данный алгоритм можно еще улучшить, если избавиться от встроенной провекри на символ
        String.Contains.
        и использовать встроенную структуру данных dictionary с проверокой значения за хотя бы
        log(n)
         */
        public static void solve_368A()
        {
            string[] nm = Console.ReadLine().Split(' ');

            int n = Convert.ToInt32(nm[0]);
            int m = Convert.ToInt32(nm[1]);

            int count = 0;
            string noir = "WBG";
            for (int i = 0; i < n; i++)
            {
                string[] row = Console.ReadLine().Split(' ');

                for (int j = 0; j < m; j++)
                {
                    if (noir.Contains(row[j]))
                    {
                        count++;
                    }
                }
            }

            string answer =  (count == n * m) ? "#Black&White" : "#Color";

            Console.WriteLine(answer);
        }

        public static void solve_90A()
        {
            string[] abn = Console.ReadLine().Split(' ');

            int a = Convert.ToInt32(abn[0]);
            int b = Convert.ToInt32(abn[1]);
            int n = Convert.ToInt32(abn[2]);

            int count = 1;
            while (n > 0)
            {
                if (count % 2 == 0)
                {
                    n -= gcd(n, b);
                }
                else
                {
                    n -= gcd(n, a);
                }

                count++;
            }

            int answer = (--count % 2 == 0) ? 1 : 0;

            Console.WriteLine(answer);
        }

        public static int gcd(int a, int b)
        {
            if (b == 0)
            {
                return a;
            }

            return gcd(b, a % b);
        }
    }
}


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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        int n = ReadInt();
        long m = ReadLong() - 1;
        int l = 0, r = n - 1;
        var a = new int[n];
        for (int i = n - 2, j = 1; i >= 0; i--, j++)
        {
            if ((m >> i & 1) == 1)
                a[r--] = j;
            else
                a[l++] = j;
        }
        a[l] = n;
        WriteArray(a);
    }

    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;

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

    #endregion

    #region Read / Write

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

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

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

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

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

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

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

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

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

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

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

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

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

    public static void Write(params object[] array)
    {
        WriteArray(array);
    }

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

    #endregion
}


using System;
using CompLib.Util;

public class Program
{
    private long N, P;
    private int D, W;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextLong();
        P = sc.NextLong();
        W = sc.NextInt();
        D = sc.NextInt();

        // 勝ったチームにWポイント 負けに0ポイント
        // 引き分けなら 両方にDポイント

        // N回の試合して得点がPポイント

        // (勝ち、引き分け、負け) = (x,y,z)
        // 一つ出力

        // 無いなら-1

        // 引き分け回数をW回まで調べる

        for (long draw = 0; draw < W; draw++)
        {
            long m = P - draw * D;

            if (m >= 0 && m % W == 0)
            {
                long win = m / W;
                if (win >= 0 && draw + win <= N)
                {
                    Console.WriteLine($"{win} {draw} {N - win - draw}");
                    return;
                }
            }
        }

        Console.WriteLine("-1");
    }

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

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

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

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

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

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

            return _line[_index++];
        }

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

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

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


using System;
using System.Linq;

namespace _460A
{
    class Program
    {
        static void Main()
        {
            var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int counter = 1;
            for (; input[0]-- > 0; counter++)
            {
                if (counter % input[1] == 0) input[0]++;
            }
            Console.WriteLine(counter-1);
        }
    }
}


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

namespace ProgrammingContest.Codeforces.Round53
{
    class A
    {
        public static void Main()
        {
            int[] xs = Array.ConvertAll(Console.ReadLine().Split(' '), sss=>int.Parse(sss));
            int[] dx = new int[] { 0, 1, 0, -1 },
                  dy = new int[] { 1, 0, -1, 0 };
            int n = xs[0];
            int[,] dist = new int[n + 1, n + 1];
            bool[,] visited = new bool[n + 1, n + 1];
            for (int y = 1; y < n; y++)
                for (int x = 1; x < n; x++)
                    visited[x, y] = true;

            Queue<int> qx = new Queue<int>(), qy = new Queue<int>();
            qx.Enqueue(xs[1]); qy.Enqueue(xs[2]);
            while (true)
            {
                int xx = qx.Dequeue(),
                    yy = qy.Dequeue();
                if (xx == xs[3] && yy == xs[4]) break;
                for (int i = 0; i < 4; i++)
                {
                    int x = xx + dx[i],
                       y = yy + dy[i];
                    if (0 <= x && x <= n && 0 <= y && y <= n && !visited[x, y])
                    {
                        visited[x, y] = true;
                        qx.Enqueue(x);
                        qy.Enqueue(y);
                        dist[x, y] = dist[xx, yy] + 1;
                    }
                }
            }

            Console.WriteLine(dist[xs[3], xs[4]]);
        }
    }
}


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

namespace cs_console
{
    class _73_2_B
    {
        public static void Main(string[] args)
        {
            Console.WriteLine(test());
        }
        static string test()
        {
            string[] ss = Console.ReadLine().Split(' ');
            int[] c = new int[3];
            for (int i = 0; i < 3; i++)
            {
                c[i] = ch(ss[i]);
            }
            string[] ans = { "major", "minor", "strange" };

            Array.Sort(c);
            if (c[0] == c[1] - 4 && c[1] == c[2] - 3)
            {
                return ans[0];
            }
            if (c[0] == c[1] - 3 && c[1] == c[2] - 4)
            {
                return ans[1];
            }

            c[0] += 12;
            Array.Sort(c);
            if (c[0] == c[1] - 4 && c[1] == c[2] - 3)
            {
                return ans[0];
            }
            if (c[0] == c[1] - 3 && c[1] == c[2] - 4)
            {
                return ans[1];
            }

            c[0] += 12;
            Array.Sort(c);
            if (c[0] == c[1] - 4 && c[1] == c[2] - 3)
            {
                return ans[0];
            }
            if (c[0] == c[1] - 3 && c[1] == c[2] - 4)
            {
                return ans[1];
            }

            return ans[2];
        }

        private static int ch(string p)
        {
            string[] keys = new string[] { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "B", "H" };
            for (int i = 0; i < keys.Length; i++)
            {
                if (keys[i] == p)
                    return i;
            }
            return -1;
        }

    }
}


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

namespace Test
{
    class Program
    {
        static void Main()
        {
            int n = Int32.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            int ans = 0;
            for (int begin = 0; begin < n; begin++)
                for (int end = begin; end < n; end++)
                {
                    int x = 0, y = 0;
                    for (int i = begin; i <= end; i++)
                        switch (s[i])
                        {
                            case 'R':
                                x++;
                                break;

                            case 'L':
                                x--;
                                break;

                            case 'U':
                                y++;
                                break;

                            case 'D':
                                y--;
                                break;
                        }
                    if (x == 0 && y == 0)
                        ans++;
                }
            Console.Write(ans);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
public class Codeforces
{
    protected static TextReader reader;
    protected static TextWriter writer;
    static object Solve()
    {
        var number = reader.ReadLine();
        var a = "NO";
        var m = new string[125];
        for (int i = 0; i < 125; i++)
        {
            m[i] = (8 * i).ToString();
        }
        foreach (var item in m)
        {
            var pos = 0;
            foreach (var subitem in item)
            {
                pos = number.IndexOf(subitem, pos);
                if (pos < 0)
                {
                    break;
                }
                else
                {
                    pos++;
                }
            }
            if (pos > -1)
            {
                writer.WriteLine("YES\n" + item);
                return null;
            }
        }
        writer.WriteLine(a);
        return null;
    }
    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);
        try
        {
            object result = Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            throw;
        }
        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);
    }
    static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c != '-' && (c < '0' || c > '9'));
        int sign = 1;
        if (c == '-')
        {
            sign = -1;
            c = reader.Read();
        }
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res * sign;
            res *= 10;
            res += c - '0';
        }
    }
    #endregion
}


using System;
using System.Text.RegularExpressions;

class Solution
{
    public static void Main(String[] args)
    {
        String s = Console.ReadLine();
        Regex rg = new Regex(@"^(?>[A-Z0-9_]{1,16}@(?<hostname>[A-Z0-9_]{1,16}(\.[A-Z0-9_]{1,16})*)(/[A-Z0-9_]{1,16})?)$",
            RegexOptions.IgnoreCase);
        Match m = rg.Match(s);
        if (m.Success && m.Groups["hostname"].Value.Length > 0 && m.Groups["hostname"].Value.Length <= 32)
            Console.WriteLine("YES");
        else
            Console.WriteLine("NO");
    }
}


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

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

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve() ? "Yes" : "No");
            writer.Flush();
        }

        private static bool Solve()
        {
            int n = Next();

            var nn = new int[n];
            for (int i = 0; i < n; i++)
            {
                nn[i] = Next(true);
            }

            int sum = nn.Sum();
            for (int i = 2; i <= n; i++)
            {
                if (sum%i == 0)
                {
                    int d = sum/i;
                    int s = 0;
                    bool ok = true;
                    foreach (int k in nn)
                    {
                        s += k;
                        if (s < d)
                            continue;
                        if (s == d)
                        {
                            s = 0;
                        }
                        else if (s > d)
                        {
                            ok = false;
                            break;
                        }
                    }
                    if (ok)
                        return true;
                }
            }

            return false;
        }

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


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

namespace LearningC_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            long val1 = 1, val2 = 1;
            for (int i = 0; i < n; i++)
            {
                val1 = val1 * 27;
                val2 = val2 * 7;
                val1 %= 1000000007;
                val2 %= 1000000007;
            }
            long res = (val1 - val2 + 1000000007) % 1000000007;
            Console.WriteLine(res);
        }
    }
}


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

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

        private static void Main(string[] args)
        {
            long n = Next();
            long k = Next();

            int ans = 1;
            while (true)
            {
                if ((k & 1) == 1)
                    break;
                k >>= 1;
                ans++;
            }

            writer.WriteLine(ans);
            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';
            }
        }
    }
}


// ac 218ms

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

namespace sar_cs
{
    static class Helpers
    {
        public static string Join<T>(this IEnumerable<T> objs, string sep)
        {
            var sb = new StringBuilder();
            foreach (var s in objs) { if (sb.Length != 0) sb.Append(sep); sb.Append(s); }
            return sb.ToString();
        }

        public static string AsString(this double a, int digits)
        {
            return a.ToString("F" + digits, CultureInfo.InvariantCulture);
        }

        public static T[] Copy<T>(this T[] a)
        {
            var b = new T[a.Length]; a.CopyTo(b, 0); return b;
        }

        public static T[][] Copy<T>(this T[][] a)
        {
            return a.Select(z => z.Copy()).ToArray();
        }

        public static IEnumerable<T> Shuffle<T>(this IEnumerable<T> collection)
        {
            if (collection.Take(11).Count() <= 10) return collection;
            var a = collection is T[] ? (T[])collection : collection.ToArray();
            int N = a.Length;
            for (int i = 0, p1 = 0, p2 = 1; i < N / 2; i++)
            {
                p1 += 3; if (p1 >= N) p1 -= N;
                p2 -= 7; if (p2 < 0) p2 += N;
                T t = a[p1]; a[p1] = a[p2]; a[p2] = t;
            }
            return a;
        }

        public static string AsString<T>(this T[,] a, string separator)
        {
            var sb = new StringBuilder();
            int n0 = a.GetLength(0);
            int n1 = a.GetLength(1);
            for (int r = 0; r < n0; r++)
            {
                for (int c = 0; c < n1; c++)
                {
                    if (c != 0) sb.Append(separator); sb.Append(a[r, c]);
                }
                sb.AppendLine();
            }
            //sb.AppendLine();
            return sb.ToString();
        }

        public static Stopwatch SW = Stopwatch.StartNew();
    }

    public class Program
    {
        #region Helpers

        public class Parser
        {
            const int BufSize = 8000;
            TextReader s;
            char[] buf = new char[BufSize];
            int bufPos;
            int bufDataSize;
            bool eos;   // eos read to buffer
            int lastChar = -2;
            int nextChar = -2;
            StringBuilder sb = new StringBuilder();

            void FillBuf()
            {
                if (eos) return;
                bufDataSize = s.Read(buf, 0, BufSize);
                if (bufDataSize == 0) eos = true;
                bufPos = 0;
            }

            int Read()
            {
                if (nextChar != -2)
                {
                    lastChar = nextChar;
                    nextChar = -2;
                }
                else
                {
                    if (bufPos == bufDataSize) FillBuf();
                    if (eos) lastChar = -1; else lastChar = buf[bufPos++];
                }
                return lastChar;
            }

            void Back()
            {
                if (lastChar == -2) throw new Exception();  // no chars were ever read
                nextChar = lastChar;
            }

            public Parser()
            {
                s = Console.In;
            }

            public int ReadInt()
            {
                int res = 0;
                int sign = -1;
                int c;
                do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));
                if (c == '-') { sign = 1; c = Read(); }
                int len = 0;
                while (c >= 0 && !char.IsWhiteSpace((char)c))
                {
                    if ((uint)(c -= 48) >= 10) throw new FormatException();
                    len++;
                    res = checked(res * 10 - c);
                    c = Read();
                }
                if (len == 0) throw new FormatException();
                Back();
                return checked(res * sign);
            }

            public long ReadLong()
            {
                long res = 0;
                int sign = -1;
                int c;
                do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));
                if (c == '-') { sign = 1; c = Read(); }
                int len = 0;
                while (c >= 0 && !char.IsWhiteSpace((char)c))
                {
                    if ((uint)(c -= 48) >= 10) throw new FormatException();
                    len++;
                    res = checked(res * 10 - c);
                    c = Read();
                }
                if (len == 0) throw new FormatException();
                Back();
                return checked(res * sign);
            }

            public int ReadLnInt()
            {
                int res = ReadInt(); ReadLine(); return res;
            }

            public long ReadLnLong()
            {
                long res = ReadLong(); ReadLine(); return res;
            }

            public double ReadDouble()
            {
                int c;
                do { c = Read(); } while (c >= 0 && char.IsWhiteSpace((char)c));

                int sign = 1;
                if (c == '-') { sign = -1; c = Read(); }

                sb.Length = 0;
                while (c >= 0 && !char.IsWhiteSpace((char)c))
                {
                    sb.Append((char)c); c = Read();
                }

                Back();
                var res = double.Parse(sb.ToString(), CultureInfo.InvariantCulture);
                return res * sign;
            }

            public string ReadLine()
            {
                int c = Read();
                sb.Length = 0;
                while (c != -1 && c != 13 && c != 10)
                {
                    sb.Append((char)c); c = Read();
                }
                if (c == 13) { c = Read(); if (c != 10) Back(); }
                return sb.ToString();
            }

            public bool SeekEOF
            {
                get
                {
                L0:
                    int c = Read();
                    if (c == -1) return true;
                    if (char.IsWhiteSpace((char)c)) goto L0;
                    Back();
                    return false;
                }
            }

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

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

        class Writer
        {
            const int BufSize = 32000;
            char[] buf = new char[BufSize];
            int bufPos = 0;
            TextWriter output = Console.Out;
            Stack<char> st = new Stack<char>();

            public void Flush()
            {
                output.Write(buf, 0, bufPos); bufPos = 0;
                output.Flush();
            }

            void BufSpaceNeeded(int n)
            {
                if (n > BufSize) throw new ArgumentOutOfRangeException("n");
                if (bufPos + n > BufSize) { output.Write(buf, 0, bufPos); bufPos = 0; }
            }

            public void Write(char a)
            {
                BufSpaceNeeded(1);
                buf[bufPos++] = a;
            }

            public void Write(string s)
            {
                int l = s.Length;
                for (int x = 0; x < l; )
                {
                    int t = Math.Min(l - x, BufSize - bufPos);
                    s.CopyTo(x, buf, bufPos, t); bufPos += t; x += t;
                    if (x < l) BufSpaceNeeded(1);   // force flush
                }
            }

            public void WriteLine()
            {
                BufSpaceNeeded(2);
                buf[bufPos++] = '\r'; buf[bufPos++] = '\n';
            }

            public void Write(object o) { Write(o.ToString()); }

            public void Write(uint a)
            {
                BufSpaceNeeded(10);
                do { st.Push((char)(a % 10 + 48)); a /= 10; } while (a != 0);
                while (st.Count != 0) buf[bufPos++] = st.Pop();
            }

            public void Write(ulong a)
            {
                BufSpaceNeeded(20);
                do { st.Push((char)(a % 10 + 48)); a /= 10; } while (a != 0);
                while (st.Count != 0) buf[bufPos++] = st.Pop();
            }

            public void Write(int a)
            {
                BufSpaceNeeded(11);
                if (a < 0) { buf[bufPos++] = '-'; a = -a; }
                Write((uint)a);
            }

            public void Write(long a)
            {
                BufSpaceNeeded(21);
                if (a < 0) { buf[bufPos++] = '-'; a = -a; }
                Write((ulong)a);
            }

            public void Write(double a, int digits)
            {
                Write(a.AsString(digits));
            }

            public void WriteLine(int a) { Write(a); WriteLine(); }
            public void WriteLine(long a) { Write(a); WriteLine(); }
            public void WriteLine(uint a) { Write(a); WriteLine(); }
            public void WriteLine(ulong a) { Write(a); WriteLine(); }
            public void WriteLine(string s) { Write(s); WriteLine(); }
            public void WriteLine(object o) { Write(o); WriteLine(); }
        }

        static void pe() { Console.WriteLine("???"); Environment.Exit(0); }
        static void re() { throw new Exception(); }
        static void Swap<T>(ref T a, ref T b) { T t = a; a = b; b = t; }
        static int Sqr(int a) { return a * a; }
        static long SqrL(int a) { return (long)a * a; }
        static long Sqr(long a) { return a * a; }
        static double Sqr(double a) { return a * a; }
        static double Sqrt(double a) { return Math.Sqrt(a); }
        static int abs(int a) { return Math.Abs(a); }
        static long abs(long a) { return Math.Abs(a); }
        static double abs(double a) { return Math.Abs(a); }

        static StringBuilder sb = new StringBuilder();
        static Random rnd = new Random(5);

        #endregion Helpers

        #region Direction

        struct Direction
        {
            public int dx, dy;

            public Direction(int dx, int dy)
            {
                this.dx = dx;
                this.dy = dy;
            }

            public void Apply(ref int x, ref int y)
            {
                x += dx;
                y += dy;
            }

            public void ApplyOrThrow(ref int x, ref int y, int w, int h)
            {
                Apply(ref x, ref y);
                if ((uint)x >= w && (uint)y >= h) throw new Exception();
            }

            public bool Applyable(int x, int y, int w, int h)
            {
                Apply(ref x, ref y);
                return (uint)x < w && (uint)y < h;
            }

            public int DistanceToBoundary(int x, int y, int w, int h)
            {
                int res = 0;
                while (Applyable(x, y, w, h))
                {
                    Apply(ref x, ref y);
                    res++;
                }
                return res;
            }

            public override string ToString()
            {
                return string.Format("dx={0}, dy={1}", dx, dy);
            }

            public static readonly Direction[] N =
            {
                new Direction( 1, 0),
                new Direction( 0, 1),
                new Direction(-1, 0),
                new Direction( 0,-1)
            };
        }

        #endregion Direction

        struct State
        {
            public int Y, X, os;

            public int ID
            {
                get
                {
                    return ((Y * 20 + X) * 256 + os);
                }
            }
        }

        struct Object
        {
            const int dx = 50, dy = 51;
            public char Type;
            public int N;

            private int x1, y1;
            private int x2, y2;

            public Object(int x0, int y0, char type, int n)
            {
                this.x1 = x0;
                this.y1 = y0;
                x2 = x1 + dx;
                y2 = y1 + dx;
                this.Type = type;
                this.N = n;
            }

            public bool Intersects(int x0, int y0, Direction dir)
            {
                if (dir.dx == 0)
                {
                    if (dir.dy == -1)
                        y0--;

                    if (x0 < this.x1 || x0 > this.x2) return false;
                    if (y0 == this.y1) return true;
                    return false;
                }
                else
                {
                    if (dir.dx == -1)
                        x0--;

                    return false;
                }
            }
        }

        static void Main()
        {
            checked
            {
#if !ONLINE_JUDGE
                Console.SetIn(File.OpenText("_input"));
#endif
                //Console.SetOut(File.CreateText("_output"));
                var parser = new Parser();
                var o = new Writer();
                try
                {
                    while (!parser.SeekEOF)
                    {
                        var objs = new List<Object>();

                        int H = parser.ReadInt();
                        int W = parser.ReadInt(); parser.ReadLine();
                        var map = new char[H][];
                        int sx = -1, sy = -1;
                        int tcount = 0;
                        for (int y = 0; y < H; y++)
                        {
                            var l = parser.ReadLine();
                            if (l.Contains('S'))
                            {
                                sy = y;
                                sx = l.IndexOf('S');
                                l = l.Replace('S', '.');
                            }
                            tcount += l.Count(c => char.IsDigit(c));
                            map[y] = l.ToCharArray();
                        }

                        var tprice = new int[tcount];
                        for (int i = 0; i < tcount; i++)
                            tprice[i] = parser.ReadInt();

                        int bn = 0;
                        for (int y = 0; y < H; y++)
                            for (int x = 0; x < W; x++)
                                if (map[y][x] != '.' && map[y][x] != '#')
                                {
                                    if (map[y][x] == 'B')
                                    {
                                        objs.Add(new Object(x, y, 'B', tcount + bn));
                                        bn++;
                                    }
                                    else
                                    {
                                        int t = map[y][x] - '1';
                                        objs.Add(new Object(x, y, 'T', t));
                                    }
                                }

                        var d = new int[20 * 20 * 256];
                        for (int i = 0; i < d.Length; i++)
                            d[i] = int.MaxValue / 2;
                        var q = new Queue<State>();
                        var s = new State { X = sx, Y = sy, os = 0 };
                        q.Enqueue(s);
                        d[s.ID] = 0;
                        while (q.Count > 0)
                        {
                            s = q.Dequeue();
                            foreach (var dir in Direction.N)
                            {
                                if (dir.Applyable(s.X, s.Y, W, H))
                                {
                                    var ns = s;
                                    dir.Apply(ref ns.X, ref ns.Y);
                                    var c = map[ns.Y][ns.X];
                                    if (c == '#' || c == 'B' || char.IsDigit(c)) continue;
                                    foreach (var obj in objs)
                                        if (obj.Intersects(s.X, s.Y, dir))
                                        {
                                            ns.os ^= (1 << obj.N);
                                        }

                                    if (d[ns.ID] < int.MaxValue / 2) continue;
                                    d[ns.ID] = d[s.ID] + 1;
                                    q.Enqueue(ns);
                                }
                            }
                        }

                        int best = 0;
                        for (int tmask = 0; tmask < (1 << tcount); tmask++)
                        {
                            s = new State { X = sx, Y = sy, os = tmask + 0/*no bombs*/};
                            if (d[s.ID] >= int.MaxValue / 2) continue;
                            int profit = 0;
                            for (int t = 0; t < tcount; t++)
                                if ((tmask >> t & 1) == 1)
                                    profit += tprice[t];

                            profit -= d[s.ID];
                            best = Math.Max(best, profit);
                        }

                        Console.WriteLine(best);
                    }
                }
                finally
                {
                    o.Flush();
                }
            }
        }

        //static void Main()
        //{
        //    new Thread(Main2, 50 << 20).Start();
        //}
    }
}


using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    ReadData re;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        re = new ReadData();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        int N = re.i();
        long[] A = re.la();
        Compression Comp = new Compression(A);
        for(int i=0;i<N;i++){
            int p = Comp.ToPoint(A[i])+1;
            if(p == N){
                p = 0;
            }
            sb.Append(Comp.A[p]);
            if(i == N-1){
                sb.Append("\n");
            }
            else{
                sb.Append(" ");
            }
        }
    }
}
class Compression{
    public int size;
    public long[] A;
    public Compression(long[] a){
        long[] b = new long[a.Length];
        for(int i=0;i<a.Length;i++){
            b[i] = a[i];
        }
        a = b;
        Array.Sort(a);
        List<long> AL = new List<long>();
        AL.Add(a[0]);
        for(int i=1;i<a.Length;i++){
            if(a[i] != a[i-1]){
                AL.Add(a[i]);
            }
        }
        A = AL.ToArray();
        size = A.Length;
    }
    public int ToPoint(long X){
        int bf = 0;
        int bl = size-1;
        while(bf != bl){
            int bc = (bf+bl)/2;
            if(A[bc] >= X){
                bl = bc;
            }
            else{
                bf = bc+1;
            }
        }
        return bf;
    }
    public long Value(int i){
        return A[i];
    }
}
class ReadData{
    string[] str;
    int counter;
    public ReadData(){
        counter = 0;
    }
    public string s(){
        if(counter == 0){
            str = Console.ReadLine().Split(' ');
            counter = str.Length;
        }
        counter--;
        return str[str.Length-counter-1];
    }
    public int i(){
        return int.Parse(s());
    }
    public long l(){
        return long.Parse(s());
    }
    public double d(){
        return double.Parse(s());
    }
    public int[] ia(int N){
        int[] ans = new int[N];
        for(int j=0;j<N;j++){
            ans[j] = i();
        }
        return ans;
    }
    public int[] ia(){
        str = Console.ReadLine().Split(' ');
        counter = 0;
        int[] ans = new int[str.Length];
        for(int j=0;j<str.Length;j++){
            ans[j] = int.Parse(str[j]);
        }
        return ans;
    }
    public long[] la(int N){
        long[] ans = new long[N];
        for(int j=0;j<N;j++){
            ans[j] = l();
        }
        return ans;
    }
    public long[] la(){
        str = Console.ReadLine().Split(' ');
        counter = 0;
        long[] ans = new long[str.Length];
        for(int j=0;j<str.Length;j++){
            ans[j] = long.Parse(str[j]);
        }
        return ans;
    }
    public double[] da(int N){
        double[] ans = new double[N];
        for(int j=0;j<N;j++){
            ans[j] = d();
        }
        return ans;
    }
    public double[] da(){
        str = Console.ReadLine().Split(' ');
        counter = 0;
        double[] ans = new double[str.Length];
        for(int j=0;j<str.Length;j++){
            ans[j] = double.Parse(str[j]);
        }
        return ans;
    }
    public List<int>[] g(int N,int[] f,int[] t){
        List<int>[] ans = new List<int>[N];
        for(int j=0;j<N;j++){
            ans[j] = new List<int>();
        }
        for(int j=0;j<f.Length;j++){
            ans[f[j]].Add(t[j]);
            ans[t[j]].Add(f[j]);
        }
        return ans;
    }
    public List<int>[] g(int N,int M){
        List<int>[] ans = new List<int>[N];
        for(int j=0;j<N;j++){
            ans[j] = new List<int>();
        }
        for(int j=0;j<M;j++){
            int f = i()-1;
            int t = i()-1;
            ans[f].Add(t);
            ans[t].Add(f);
        }
        return ans;
    }
    public List<int>[] g(){
        int N = i();
        int M = i();
        List<int>[] ans = new List<int>[N];
        for(int j=0;j<N;j++){
            ans[j] = new List<int>();
        }
        for(int j=0;j<M;j++){
            int f = i()-1;
            int t = i()-1;
            ans[f].Add(t);
            ans[t].Add(f);
        }
        return ans;
    }
}
public static class Define{
    public const long mod = 1000000007;
}
public static class Debug{
    public static void Print(double[,,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                for(int l=0;l<k.GetLength(2);l++){
                    Console.Write(k[i,j,l]+" ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
    public static void Print(double[,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                Console.Write(k[i,j]+" ");
            }
            Console.WriteLine();
        }
    }
    public static void Print(double[] k){
        for(int i=0;i<k.Length;i++){
            Console.WriteLine(k[i]);
        }
    }
    public static void Print(long[,,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                for(int l=0;l<k.GetLength(2);l++){
                    Console.Write(k[i,j,l]+" ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
    public static void Print(long[,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                Console.Write(k[i,j]+" ");
            }
            Console.WriteLine();
        }
    }
    public static void Print(long[] k){
        for(int i=0;i<k.Length;i++){
            Console.WriteLine(k[i]);
        }
    }
    public static void Print(int[,,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                for(int l=0;l<k.GetLength(2);l++){
                    Console.Write(k[i,j,l]+" ");
                }
                Console.WriteLine();
            }
            Console.WriteLine();
        }
    }
    public static void Print(int[,] k){
        for(int i=0;i<k.GetLength(0);i++){
            for(int j=0;j<k.GetLength(1);j++){
                Console.Write(k[i,j]+" ");
            }
            Console.WriteLine();
        }
    }
    public static void Print(int[] k){
        for(int i=0;i<k.Length;i++){
            Console.WriteLine(k[i]);
        }
    }
}


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

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

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve() ? "YES" : "NO");
            writer.Flush();
        }

        private static bool Solve()
        {
            long a = Next();
            long b = Next();

            if (a == b)
                return true;

            string s = Convert.ToString(a, 2);
            string t = Convert.ToString(b, 2);

            if (Subs(t, s.TrimEnd('0')))
                return true;

            if (Subs(t, new string(s.TrimEnd('0').Reverse().ToArray())))
                return true;

            if (Subs(t, s + "1"))
                return true;

            if (Subs(t, new string((s + "1").Reverse().ToArray())))
                return true;

            return false;
        }

        private static bool Subs(string t, string s)
        {
            int p = 0;
            while (true)
            {
                int index = t.IndexOf(s, p);
                if (index >= 0)
                {
                    bool ok = true;
                    for (int i = 0; i < index; i++)
                    {
                        if (t[i] != '1')
                        {
                            ok = false;
                            break;
                        }
                    }

                    if (ok)
                        for (int i = index + s.Length; i < t.Length; i++)
                        {
                            if (t[i] != '1')
                            {
                                ok = false;
                                break;
                            }
                        }

                    if (ok)
                        return true;

                    p = index + 1;
                }
                else break;
            }
            return false;
        }

        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;

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

            int x = int.Parse(numbers[0]);
            int y = int.Parse(numbers[1]);
            int s = int.Parse(numbers[2]);

            int w = Math.Abs(x)+Math.Abs(y);

            if ((s - w) % 2 != 0 || w>s)
            {
                Console.WriteLine("No");
            }
            else
            {
                Console.WriteLine("Yes");
            }
        }
    }
}


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

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            var matrix = ReadIntMatrix(5);
            long sum = long.MinValue;
            HashSet<int> k = new HashSet<int>();
            for (int a = 0; a < 5; a++)
            {
                for (int b = 0; b < 5; b++)
                {
                    for (int c = 0; c < 5; c++)
                    {
                        for (int d = 0; d < 5; d++)
                        {
                            for (int e = 0; e < 5; e++)
                            {
                                k.Clear();
                                k.Add(a);
                                k.Add(b);
                                k.Add(c);
                                k.Add(d);
                                k.Add(e);
                                if (k.Count < 5)
                                    continue;
                                sum = Math.Max(sum, 2 * (matrix[d][e] + matrix[e][d] + matrix[c][d] + matrix[d][c]) + matrix[a][b] + matrix[b][a] + matrix[b][c] + matrix[c][b]);
                            }
                        }
                    }
                }
            }

            Console.Write(sum);
           // Console.ReadKey();
        }

        static int Find(int n, int[] a)
        {
            for (int i = 0; i < a.Length; i++)
            {
                if (a[i] == n)
                    return i;
            }
            return -1;
        }
        static bool isPrime(int n)
        {
            for (int i = 2; i <= Math.Sqrt(n); i++)
            {
                if (n % i == 0)
                    return false;
            }
            return true;
        }
        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }
        static int[] ReadIntArray()
        {
            return Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
        }
        static int[][] ReadIntMatrix(int rows)
        {
            int[][] result = new int[rows][];
            for (int i = 0; i < rows; i++)
            {
                result[i] = ReadIntArray();
            }
            return result;
        }
        static int GCD(int a, int b)
        {
            if (Max(a,b) % Min(a,b) == 0)
                return Min(a,b);
            return GCD(Min(a,b), Max(a,b) % Min(a,b));
        }
        static int Min(int a, int b)
        {
            return a <= b ? a : b;
        }
        static int Max(int a, int b)
        {
            return a >= b ? a : b;
        }
        static double Distance(Point a, Point b)
        {
            return Math.Sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
        }
    }
    struct Point
    {
        public double x, y;
        public Point(int x, int y)
        {
            this.x = x;
            this.y = y;
        }
    }
}


using System;
class Lucky_Division
{
    static void Main()
    {
        int inputInt = Convert.ToInt32(Console.ReadLine());
        int[] lucky = { 4, 7, 47, 74, 447, 474, 477, 744, 747, 774 };
        for (int i = 0; i < lucky.Length; i++)
        {
            if (inputInt % lucky[i] == 0)
            {
                Console.WriteLine("YES");
                return;
            }
        }

        Console.WriteLine("NO");

    }
}


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

namespace CodeJam
{
    class Solution2
    {
        static void Main()
        {
            new Thread(new Solution2().run, 64 * 1024 * 1024).Start();
        }

        int a, b, x;
        string answer;

        void ReadData()
        {
            a = NextInt();
            b = NextInt();
            x = NextInt();

        }

        void Solve()
        {
            StringBuilder stringBuilder = new StringBuilder();
            char firstChar = a>b? '0': '1';
            char secondChar = a > b ? '1' : '0';
            int smallLength = a > b ? b: a;
            int bigLength = a > b ? a : b;
            if (x==0)
            {
                answer = new string(firstChar, a + b);
                return;
            }
            if (x==1)
            {
                stringBuilder.Append('0', a);
                stringBuilder.Append('1', b);
                answer = stringBuilder.ToString();
                return;
            }
            if (x%2 ==0)
            {
                for (int i=0; i<x/2; i++)
                {
                    stringBuilder.Append(firstChar);
                    stringBuilder.Append(secondChar);
                }
                stringBuilder.Append(secondChar, smallLength- (x/2));
            }
            else
            {
                int numberOfPairs = (x + 1) / 2;
                stringBuilder.Append(secondChar, smallLength - numberOfPairs);
                for (int i = 0; i < numberOfPairs; i++)
                {
                    stringBuilder.Append(secondChar);
                    stringBuilder.Append(firstChar);
                }

            }

            stringBuilder.Append(firstChar, a+b - stringBuilder.Length);
            answer = stringBuilder.ToString();
        }

        void WriteAnswer()
        {
            _outputStream.Write(answer);
        }

        #region ...

        void run()
        {
            //Console.SetIn(new StreamReader(Console.OpenStandardInput(), Console.InputEncoding, false, bufferSize: 100024));
            //_inputStream = new StreamReader(File.OpenRead(@"C:\Users\v.lukiantsev\Downloads\progresspie.in"));
            //_outputStream = new StreamWriter(File.OpenWrite(@"C:\Users\v.lukiantsev\Downloads\progress_pie.out"));

            _inputStream = Console.In;
            _outputStream = Console.Out;

            int testsCount = 1;
            var solvers = new Solution2[testsCount];
            for (int i = 0; i < testsCount; ++i)
            {
                solvers[i] = new Solution2();
                solvers[i].ReadData();
            }

            int done = 0;
            for (int i = 0; i < testsCount; ++i)
            {
                solvers[i].Solve();
                Console.Title = (++done).ToString() + " of " + testsCount;
            }
            for (int i = 0; i < testsCount; ++i)
            {
                //Out.Write(string.Format("Case #{0}: ", i + 1));
                solvers[i].WriteAnswer();
            }
            Out.Flush();
            Out.Close();
        }

        static TextWriter Out { get { return _outputStream; } }

        private static TextReader _inputStream;
        private static TextWriter _outputStream;

        public double NextDouble()
        {
            var token = NextToken();
            if (string.IsNullOrEmpty(token)) throw new ApplicationException("Input data missing");
            return double.Parse(token, CultureInfo.InvariantCulture);
        }

        public long NextLong()
        {
            var token = NextToken();
            if (string.IsNullOrEmpty(token)) throw new ApplicationException("Input data missing");
            return long.Parse(token);
        }

        public int NextInt()
        {
            var token = NextToken();
            if (string.IsNullOrEmpty(token)) throw new ApplicationException("Input data missing");
            return int.Parse(token);
        }

        private static readonly Queue<string> Tokens = new Queue<string>();
        public string NextToken()
        {
            if (Tokens.Count > 0)
            {
                return Tokens.Dequeue();
            }
            while (Tokens.Count == 0)
            {
                var line = _inputStream.ReadLine();
                if (line == null) return null;
                foreach (var token in line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries))
                {
                    Tokens.Enqueue(token);
                }
            }
            return Tokens.Count == 0 ? null : Tokens.Dequeue();
        }

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

        #endregion
    }
}


using System;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            n *= 2;
            int k = (int)Math.Sqrt(n);
            bool found = false;
            for (int i = 1; i < k; i++)
            {
                int r = n - i * i - i;
                int x = (int)Math.Sqrt(r);
                if (x * (x + 1) == r)
                {
                    found = true;
                    break;
                }
            }
            if (found)
            {
                Console.Write("YES");
            }
            else
            {
                Console.Write("NO");
            }
            //Console.ReadLine();
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using SB = System.Text.StringBuilder;
//using System.Threading.Tasks;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
using System.Numerics;
using static System.Math;
using pair = Pair<int, int>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    readonly Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    readonly int dom = 998244353;
    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void solve()
    {
        int N = cin.nextint;
        int M = cin.nextint;

        int W = Max(N, M);
        var dp = new ModInt[W + 1, W + 1];

        for (int j = 0; j <= W; j++)
        {
            dp[0, j] = 1;
        }
        for (int i = 1; i <= W; i++)
        {
            for (int j = i; j <= W; j++)
            {
                dp[i, j] = dp[i - 1, j] + dp[i, j - 1];
            }
        }

        var ans = new ModInt(0);

        for (int i = 1; i <= N; i++)
        {
            for (int j = 0; j <= M; j++)
            {
                if (i <= j) break;

                // (i - 1, j)から遷移してきた
                var ret = new ModInt(i - j);
                ret *= dp[j, i - 1];
                ret *= dp[N - i, M - j];

                ans += ret;
            }
        }
        WriteLine(ans);
    }

}

/// <summary>
/// [0,<see cref="Mod"/>) までの値を取るような数
/// </summary>
/// <OriginalAuthor>camypaper</OriginalAuthor>
struct ModInt
{
    /// <summary>
    /// 剰余を取る値．
    /// </summary>
    public static long Mod = (int)998244853;

    /// <summary>
    /// 実際の数値．
    /// </summary>
    public long num;
    /// <summary>
    /// 値が <paramref name="n"/> であるようなインスタンスを構築します．
    /// </summary>
    /// <param name="n">インスタンスが持つ値</param>
    /// <remarks>パフォーマンスの問題上，コンストラクタ内では剰余を取りません．そのため，<paramref name="n"/> ∈ [0,<see cref="Mod"/>) を満たすような <paramref name="n"/> を渡してください．このコンストラクタは O(1) で実行されます．</remarks>
    public ModInt(long n) { num = n; }
    /// <summary>
    /// このインスタンスの数値を文字列に変換します．
    /// </summary>
    /// <returns>[0,<see cref="Mod"/>) の範囲内の整数を 10 進表記したもの．</returns>
    public override string ToString() { return num.ToString(); }
    public static ModInt operator +(ModInt l, ModInt r) { l.num += r.num; if (l.num >= Mod) l.num -= Mod; return l; }
    public static ModInt operator -(ModInt l, ModInt r) { l.num -= r.num; if (l.num < 0) l.num += Mod; return l; }
    public static ModInt operator *(ModInt l, ModInt r) { return new ModInt(l.num * r.num % Mod); }
    public static implicit operator ModInt(long n) { n %= Mod; if (n < 0) n += Mod; return new ModInt(n); }

    /// <summary>
    /// 与えられた 2 つの数値からべき剰余を計算します．
    /// </summary>
    /// <param name="v">べき乗の底</param>
    /// <param name="k">べき指数</param>
    /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
    public static ModInt Pow(ModInt v, long k) => Pow(v.num, k);

    /// <summary>
    /// 与えられた 2 つの数値からべき剰余を計算します．
    /// </summary>
    /// <param name="v">べき乗の底</param>
    /// <param name="k">べき指数</param>
    /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
    public static ModInt Pow(long v, long k)
    {
        long ret = 1;
        for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
            if ((k & 1) == 1) ret = ret * v % Mod;
        return new ModInt(ret);
    }
    /// <summary>
    /// 与えられた数の逆元を計算します．
    /// </summary>
    /// <param name="v">逆元を取る対象となる数</param>
    /// <returns>逆元となるような値</returns>
    /// <remarks>法が素数であることを仮定して，フェルマーの小定理に従って逆元を O(log N) で計算します．</remarks>
    public static ModInt Inverse(ModInt v) => Pow(v, Mod - 2);
}

class BinomialCoefficient
{
    public ModInt[] fact, ifact;
    /// <summary>
    /// <paramref name="n"/>は <paramref name="Mod"/>未満でお願いします。
    /// </summary>
    /// <param name="n"></param>
    public BinomialCoefficient(ModInt _n)
    {
        int n = (int)_n.num;
        fact = new ModInt[n + 1];
        ifact = new ModInt[n + 1];
        fact[0] = 1;
        for (int i = 1; i <= n; i++)
            fact[i] = fact[i - 1] * i;
        ifact[n] = ModInt.Inverse(fact[n]);
        for (int i = n - 1; i >= 0; i--)
            ifact[i] = ifact[i + 1] * (i + 1);
        ifact[0] = ifact[1];
    }
    public ModInt this[int n, int r]
    {
        get
        {
            if (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;
            return fact[n] * ifact[n - r] * ifact[r];
        }
    }
    public ModInt RepeatedCombination(int n, int k)
    {
        if (k == 0) return 1;
        return this[n + k - 1, k];
    }
}

static class Ex
{
    public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values));
    public static string concat<T>(this IEnumerable<T> values) => string.Concat(values);
    public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); }

    public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) < 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
    public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) <= 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
}

class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U>
{
    public T f; public U s;
    public Pair(T f, U s) { this.f = f; this.s = s; }
    public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);
    public override string ToString() => $"{f} {s}";
}

class Scanner
{
    string[] s; int i;
    readonly char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan => ReadLine().Split();
    public int[] scanint => Array.ConvertAll(scan, int.Parse);
    public long[] scanlong => Array.ConvertAll(scan, long.Parse);
    public double[] scandouble => Array.ConvertAll(scan, double.Parse);
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint => int.Parse(next);
    public long nextlong => long.Parse(next);
    public double nextdouble => double.Parse(next);
}


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

namespace A.I_Wanna_Be_the_Guy
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string name="";
            for (int i = 0; i < 500; i++)
            {
                name += Convert.ToString(i);
            }
            Console.WriteLine(name[n]);
        }
    }
}


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

    class Program
    {
        static void Main(string[] args)
        {
            string x = Console.ReadLine().ToLower() ;

            if (x.Contains("a") || x.Contains("o") || x.Contains("y") || x.Contains("e") || x.Contains("u") || x.Contains("i"))
            {
                x = x.Replace("o", "");
                x = x.Replace("a", "");
                x = x.Replace("y", "");
                x = x.Replace("e", "");
                x = x.Replace("u", "");
                x = x.Replace("i", "");

            }

           for (int i = 0 ; i < x.Length; i+=2)
           {
               x=x.Insert(i,".");

          }

            Console.WriteLine(x);

      }
    }


using System;
using System.Linq;
using System.Text;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            long[] nk = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
            long n = nk[0];
            long k = nk[1] - 1;
            string s = Convert.ToString(n, 2);
            StringBuilder strB = new StringBuilder(s);
            bool start = false;
            for (int i = 0; i < s.Length; i++)
            {
                if (strB[i] == '1' && !start) {
                    start = true;
                    continue;
                }
                if(k > 0) strB[i] = '1';
            }
            s = strB.ToString();
            long ans = Convert.ToInt64(s, 2);
            Console.WriteLine(ans);
        }
    }
}