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

class ProblemC
{
    static long GCD(long a, long b)
    {
        if (b > a)
        {
            long temp = a;
            a = b;
            b = temp;
        }
        while (true)
        {
            a = a % b;
            long temp = a;
            a = b;
            b = temp;
            if (b == 0)
                return a;
        }
    }

    static void Main(string[] args)
    {
        int[] tokens = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
        long lcm = tokens[0] * tokens[1] / GCD(tokens[0], tokens[1]);
        long diff = (lcm / tokens[0]) - (lcm / tokens[1]);
        if (diff == 1 || diff == -1)
            Console.WriteLine("Equal");
        else if (diff > 0)
            Console.WriteLine("Dasha");
        else if (diff < 0)
            Console.WriteLine("Masha");
    }
}


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        var d = new Dictionary<string, int>();
        d["A221033"] = 21;
        d["A223635"] = 22;
        d["A232726"] = 23;

        string s = ReadToken();
        if (!d.ContainsKey(s))
           Write(0);
        Write(d[s]);
    }

    #region Main

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

    #endregion

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


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        var d = new Dictionary<string, int>();
        d["A221033"] = 21;
        d["A223635"] = 22;
        d["A232726"] = 23;

        string s = ReadToken();
        if (!d.ContainsKey(s))
            throw new Exception();
        Write(d[s]);
    }

    #region Main

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

    #endregion

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


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

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

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

            int sum = 1;
            for (int i = 1; i < s.Length; i++)
            {
                if (s[i] > '1')
                    sum += s[i] - '0';
                else
                {
                    sum += 10;
                    i ++;
                }
            }

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


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        var d = new Dictionary<string, int>();
        d["A221033"] = 23;
        d["A223635"] = 22;
        d["A232726"] = 23;

        string s = ReadToken();
        if (!d.ContainsKey(s))
            throw new Exception();
        Write(d[s]);
    }

    #region Main

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

    #endregion

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


using System;
using System.Collections.Generic;
using System.Linq;
using Solver.Ex;
using Debug = System.Diagnostics.Debug;
using Watch = System.Diagnostics.Stopwatch;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Solver
{
    public class Solver
    {
        public void Solve()
        {
            var n = sc.Integer();
            var d = sc.Integer();
            x = sc.Long();
            var a = new int[n];
            var b = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = i + 1;
            for (int i = 0; i < n; i++)
            {
                nextX();
                var tmp = a[i];
                a[i] = a[x % (i + 1)];
                a[x % (i + 1)] = tmp;
            }
            for (int i = 0; i < n; i++)
            {
                if (i < d) b[i] = 1;
                else b[i] = 0;
            }
            for (int i = 0; i < n; i++)
            {
                nextX();
                var tmp = b[i];
                b[i] = b[x % (i + 1)];
                b[x % (i + 1)] = tmp;
            }

            if (d <= 1000)
            {
                var position = new List<int>();
                for (int i = 0; i < n; i++)
                    if (b[i] == 1) position.Add(i);
                for (int i = 0; i < n; i++)
                {
                    var max = 0;
                    foreach (var p in position)
                    {
                        if (p <= i)
                            max = Math.Max(max, a[i - p]);
                    }
                    IO.Printer.Out.WriteLine(max);
                }

            }

            else
            {
                var position = new int[n];
                for (int i = 0; i < n; i++)
                    position[a[i] - 1] = i;
                for (int i = 0; i < n; i++)
                {
                    var f = false;
                    for (int j = n - 1; j >= n - 1000; j--)
                    {
                        if (position[j] > i) continue;
                        if (b[i - position[j]] > 0)
                        {
                            IO.Printer.Out.WriteLine(j + 1);
                            f = true;
                            break;
                        }
                    }
                    if (f) continue;
                    var max = 0;
                    foreach (var p in position)
                    {
                        if (p > i) break;
                        max = Math.Max(max, a[i - p]);
                    }

                }

            }
        }
        long x;
        long nextX()
        {
            return x = (x * 37 + 10007) % 1000000007;
        }

        internal IO.StreamScanner sc;
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }
    }

    #region Main and Settings
    static class Program
    {
        static void Main(string[] arg)
        {
#if DEBUG
            var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
            Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream"));
            Debug.AutoFlush = false;
            var sw = new Watch(); sw.Start();
            IO.Printer.Out.AutoFlush = true;
            try
            {
#endif

                var solver = new Solver();
                solver.sc = new IO.StreamScanner(Console.OpenStandardInput());
                solver.Solve();
                IO.Printer.Out.Flush();
#if DEBUG
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
            }
            finally
            {
                sw.Stop();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds);
                Debug.Close();
                System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            }
#endif
        }

    }
    #endregion
}

#region IO Helper
namespace Solver.IO
{
    public class Printer : System.IO.StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
#if DEBUG
            Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };
#else
            Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };
#endif
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(System.IO.Stream stream) { iStream = stream; }
        private readonly System.IO.Stream iStream;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private bool eof = false;
        public bool IsEndOfStream { get { return eof; } }
        const byte lb = 33, ub = 126, el = 10, cr = 13;
        public byte read()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }
        public string Scan()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            StringBuilder sb = null;
            var enc = System.Text.UTF8Encoding.Default;
            do
            {
                for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;
                if (ptr < len) break;
                ptr = 0;
                if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return ""; }
            } while (true);
            do
            {
                var f = ptr;
                for (; ptr < len; ptr++)
                    if (buf[ptr] < lb || ub < buf[ptr])
                    //if (buf[ptr] == cr || buf[ptr] == el)
                    {
                        string s;
                        if (sb == null) s = enc.GetString(buf, f, ptr - f);
                        else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }
                        ptr++; return s;
                    }
                if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));
                else sb.Append(enc.GetChars(buf, f, len - f));
                ptr = 0;

            }
            while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true; return (sb != null) ? sb.ToString() : "";
        }
        public long Long()
        {
            long ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public int Integer()
        {
            int ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }
        public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }
        public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }
        public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }
        public void Flush() { iStream.Flush(); }
    }
}
#endregion
#region Extension
namespace Solver.Ex
{
    static public partial class EnumerableEx
    {
        static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
        static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }

    }
}
#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using Solver.Ex;
using Debug = System.Diagnostics.Debug;
using Watch = System.Diagnostics.Stopwatch;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Solver
{
    public class Solver
    {
        public void Solve()
        {
            var n = sc.Integer();
            var d = sc.Integer();
            x = sc.Long();
            var a = new int[n];
            var b = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = i + 1;
            for (int i = 0; i < n; i++)
            {
                nextX();
                var tmp = a[i];
                a[i] = a[x % (i + 1)];
                a[x % (i + 1)] = tmp;
            }
            for (int i = 0; i < n; i++)
            {
                if (i < d) b[i] = 1;
                else b[i] = 0;
            }
            for (int i = 0; i < n; i++)
            {
                nextX();
                var tmp = b[i];
                b[i] = b[x % (i + 1)];
                b[x % (i + 1)] = tmp;
            }

            var ans = new int[n];
            if (d <= 1000)
            {
                var position = new List<int>();
                for (int i = 0; i < n; i++)
                    if (b[i] == 1) position.Add(i);
                for (int i = 0; i < n; i++)
                {
                    foreach (var p in position)
                    {
                        var k = i + p;
                        if (k < n)
                            ans[k] = Math.Max(ans[k], a[i]);
                    }
                }
                for (int i = 0; i < n; i++)
                {
                    IO.Printer.Out.WriteLine(ans[i]);
                }
            }

            {
                var position = new int[n];
                for (int i = 0; i < n; i++)
                    position[a[i] - 1] = i;
                for (int i = 0; i < n; i++)
                {
                    var f = false;
                    for (int j = n - 1; j >= n - 1000; j--)
                    {
                        if (position[j] > i) continue;
                        if (b[i - position[j]] > 0)
                        {
                            IO.Printer.Out.WriteLine(j + 1);
                            f = true;
                            break;
                        }
                    }
                    if (f) continue;
                    foreach (var p in position)
                    {
                        if (p > i) continue;
                        var k = i + p;
                        if (k < n)
                            ans[k] = Math.Max(ans[k], a[i]);
                    }

                }

            }
        }
        long x;
        long nextX()
        {
            return x = (x * 37 + 10007) % 1000000007;
        }

        internal IO.StreamScanner sc;
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }
    }

    #region Main and Settings
    static class Program
    {
        static void Main(string[] arg)
        {
#if DEBUG
            var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
            Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream"));
            Debug.AutoFlush = false;
            var sw = new Watch(); sw.Start();
            IO.Printer.Out.AutoFlush = true;
            try
            {
#endif

                var solver = new Solver();
                solver.sc = new IO.StreamScanner(Console.OpenStandardInput());
                solver.Solve();
                IO.Printer.Out.Flush();
#if DEBUG
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
            }
            finally
            {
                sw.Stop();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds);
                Debug.Close();
                System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            }
#endif
        }

    }
    #endregion
}

#region IO Helper
namespace Solver.IO
{
    public class Printer : System.IO.StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
#if DEBUG
            Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };
#else
            Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };
#endif
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(System.IO.Stream stream) { iStream = stream; }
        private readonly System.IO.Stream iStream;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private bool eof = false;
        public bool IsEndOfStream { get { return eof; } }
        const byte lb = 33, ub = 126, el = 10, cr = 13;
        public byte read()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }
        public string Scan()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            StringBuilder sb = null;
            var enc = System.Text.UTF8Encoding.Default;
            do
            {
                for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;
                if (ptr < len) break;
                ptr = 0;
                if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return ""; }
            } while (true);
            do
            {
                var f = ptr;
                for (; ptr < len; ptr++)
                    if (buf[ptr] < lb || ub < buf[ptr])
                    //if (buf[ptr] == cr || buf[ptr] == el)
                    {
                        string s;
                        if (sb == null) s = enc.GetString(buf, f, ptr - f);
                        else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }
                        ptr++; return s;
                    }
                if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));
                else sb.Append(enc.GetChars(buf, f, len - f));
                ptr = 0;

            }
            while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true; return (sb != null) ? sb.ToString() : "";
        }
        public long Long()
        {
            long ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public int Integer()
        {
            int ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }
        public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }
        public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }
        public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }
        public void Flush() { iStream.Flush(); }
    }
}
#endregion
#region Extension
namespace Solver.Ex
{
    static public partial class EnumerableEx
    {
        static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
        static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }

    }
}
#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using Solver.Ex;
using Debug = System.Diagnostics.Debug;
using Watch = System.Diagnostics.Stopwatch;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Solver
{
    public class Solver
    {
        public void Solve()
        {
            var n = sc.Integer();
            var d = sc.Integer();
            x = sc.Long();
            var a = new int[n];
            var b = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = i + 1;
            for (int i = 0; i < n; i++)
            {
                nextX();
                var tmp = a[i];
                a[i] = a[x % (i + 1)];
                a[x % (i + 1)] = tmp;
            }
            for (int i = 0; i < n; i++)
            {
                if (i < d) b[i] = 1;
                else b[i] = 0;
            }
            for (int i = 0; i < n; i++)
            {
                nextX();
                var tmp = b[i];
                b[i] = b[x % (i + 1)];
                b[x % (i + 1)] = tmp;
            }

            var ans = new int[n];
            if (d <= 1000)
            {
                var position = new List<int>();
                for (int i = 0; i < n; i++)
                    if (b[i] == 1) position.Add(i);
                for (int i = 0; i < n; i++)
                {
                    foreach (var p in position)
                    {
                        var k = i + p;
                        if (k < n)
                            ans[k] = Math.Max(ans[k], a[i]);
                    }
                }
                for (int i = 0; i < n; i++)
                {
                    IO.Printer.Out.WriteLine(ans[i]);
                }
            }

            else {
                var position = new int[n];
                for (int i = 0; i < n; i++)
                    position[a[i] - 1] = i;
                for (int i = 0; i < n; i++)
                {
                    var f = false;
                    for (int j = n - 1; j >= n - 1000; j--)
                    {
                        if (position[j] > i) continue;
                        if (b[i - position[j]] > 0)
                        {
                            IO.Printer.Out.WriteLine(j + 1);
                            f = true;
                            break;
                        }
                    }
                    if (f) continue;
                    foreach (var p in position)
                    {
                        if (p > i) continue;
                        var k = i + p;
                        if (k < n)
                            ans[k] = Math.Max(ans[k], a[i]);
                    }

                }

            }
        }
        long x;
        long nextX()
        {
            return x = (x * 37 + 10007) % 1000000007;
        }

        internal IO.StreamScanner sc;
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }
    }

    #region Main and Settings
    static class Program
    {
        static void Main(string[] arg)
        {
#if DEBUG
            var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
            Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream"));
            Debug.AutoFlush = false;
            var sw = new Watch(); sw.Start();
            IO.Printer.Out.AutoFlush = true;
            try
            {
#endif

                var solver = new Solver();
                solver.sc = new IO.StreamScanner(Console.OpenStandardInput());
                solver.Solve();
                IO.Printer.Out.Flush();
#if DEBUG
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
            }
            finally
            {
                sw.Stop();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds);
                Debug.Close();
                System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            }
#endif
        }

    }
    #endregion
}

#region IO Helper
namespace Solver.IO
{
    public class Printer : System.IO.StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
#if DEBUG
            Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };
#else
            Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };
#endif
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(System.IO.Stream stream) { iStream = stream; }
        private readonly System.IO.Stream iStream;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private bool eof = false;
        public bool IsEndOfStream { get { return eof; } }
        const byte lb = 33, ub = 126, el = 10, cr = 13;
        public byte read()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }
        public string Scan()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            StringBuilder sb = null;
            var enc = System.Text.UTF8Encoding.Default;
            do
            {
                for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;
                if (ptr < len) break;
                ptr = 0;
                if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return ""; }
            } while (true);
            do
            {
                var f = ptr;
                for (; ptr < len; ptr++)
                    if (buf[ptr] < lb || ub < buf[ptr])
                    //if (buf[ptr] == cr || buf[ptr] == el)
                    {
                        string s;
                        if (sb == null) s = enc.GetString(buf, f, ptr - f);
                        else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }
                        ptr++; return s;
                    }
                if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));
                else sb.Append(enc.GetChars(buf, f, len - f));
                ptr = 0;

            }
            while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true; return (sb != null) ? sb.ToString() : "";
        }
        public long Long()
        {
            long ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public int Integer()
        {
            int ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }
        public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }
        public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }
        public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }
        public void Flush() { iStream.Flush(); }
    }
}
#endregion
#region Extension
namespace Solver.Ex
{
    static public partial class EnumerableEx
    {
        static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
        static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }

    }
}
#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using Solver.Ex;
using Debug = System.Diagnostics.Debug;
using Watch = System.Diagnostics.Stopwatch;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Solver
{
    public class Solver
    {
        public void Solve()
        {
            var n = sc.Integer();
            var d = sc.Integer();
            x = sc.Long();
            var a = new int[n];
            var b = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = i + 1;
            for (int i = 0; i < n; i++)
            {
                nextX();
                var tmp = a[i];
                a[i] = a[x % (i + 1)];
                a[x % (i + 1)] = tmp;
            }
            for (int i = 0; i < n; i++)
            {
                if (i < d) b[i] = 1;
                else b[i] = 0;
            }
            for (int i = 0; i < n; i++)
            {
                nextX();
                var tmp = b[i];
                b[i] = b[x % (i + 1)];
                b[x % (i + 1)] = tmp;
            }

            if (d <= 1000)
            {
                var position = new List<int>();
                for (int i = 0; i < n; i++)
                    if (b[i] == 1) position.Add(i);
                for (int i = 0; i < n; i++)
                {
                    var max = 0;
                    foreach (var p in position)
                    {
                        if (p <= i)
                            max = Math.Max(max, a[i - p]);
                    }
                    IO.Printer.Out.WriteLine(max);
                }

            }

            else
            {
                var position = new int[n];
                for (int i = 0; i < n; i++)
                    position[a[i] - 1] = i;
                for (int i = 0; i < n; i++)
                {
                    var f = false;
                    for (int j = n - 1; j >= n - 1000; j--)
                    {
                        if (position[j] > i) continue;
                        if (b[i - position[j]] > 0)
                        {
                            IO.Printer.Out.WriteLine(j + 1);
                            f = true;
                            break;
                        }
                    }
                    if (f) continue;
                    var max = 0;
                    foreach (var p in position)
                    {
                        if (p > i) break;
                        max = Math.Max(max, a[i - p]);
                    }
                    IO.Printer.Out.WriteLine(max);
                }

            }
        }
        long x;
        long nextX()
        {
            return x = (x * 37 + 10007) % 1000000007;
        }

        internal IO.StreamScanner sc;
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }
    }

    #region Main and Settings
    static class Program
    {
        static void Main(string[] arg)
        {
#if DEBUG
            var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
            Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream"));
            Debug.AutoFlush = false;
            var sw = new Watch(); sw.Start();
            IO.Printer.Out.AutoFlush = true;
            try
            {
#endif

                var solver = new Solver();
                solver.sc = new IO.StreamScanner(Console.OpenStandardInput());
                solver.Solve();
                IO.Printer.Out.Flush();
#if DEBUG
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
            }
            finally
            {
                sw.Stop();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds);
                Debug.Close();
                System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            }
#endif
        }

    }
    #endregion
}

#region IO Helper
namespace Solver.IO
{
    public class Printer : System.IO.StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
#if DEBUG
            Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };
#else
            Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };
#endif
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(System.IO.Stream stream) { iStream = stream; }
        private readonly System.IO.Stream iStream;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private bool eof = false;
        public bool IsEndOfStream { get { return eof; } }
        const byte lb = 33, ub = 126, el = 10, cr = 13;
        public byte read()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }
        public string Scan()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            StringBuilder sb = null;
            var enc = System.Text.UTF8Encoding.Default;
            do
            {
                for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;
                if (ptr < len) break;
                ptr = 0;
                if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return ""; }
            } while (true);
            do
            {
                var f = ptr;
                for (; ptr < len; ptr++)
                    if (buf[ptr] < lb || ub < buf[ptr])
                    //if (buf[ptr] == cr || buf[ptr] == el)
                    {
                        string s;
                        if (sb == null) s = enc.GetString(buf, f, ptr - f);
                        else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }
                        ptr++; return s;
                    }
                if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));
                else sb.Append(enc.GetChars(buf, f, len - f));
                ptr = 0;

            }
            while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true; return (sb != null) ? sb.ToString() : "";
        }
        public long Long()
        {
            long ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public int Integer()
        {
            int ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }
        public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }
        public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }
        public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }
        public void Flush() { iStream.Flush(); }
    }
}
#endregion
#region Extension
namespace Solver.Ex
{
    static public partial class EnumerableEx
    {
        static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
        static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }

    }
}
#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using Solver.Ex;
using Debug = System.Diagnostics.Debug;
using Watch = System.Diagnostics.Stopwatch;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Solver
{
    public class Solver
    {
        public void Solve()
        {
            var n = sc.Integer();
            var d = sc.Integer();
            x = sc.Long();
            var a = new int[n];
            var b = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = i + 1;
            for (int i = 0; i < n; i++)
            {
                nextX();
                var tmp = a[i];
                a[i] = a[x % (i + 1)];
                a[x % (i + 1)] = tmp;
            }
            for (int i = 0; i < n; i++)
            {
                if (i < d) b[i] = 1;
                else b[i] = 0;
            }
            for (int i = 0; i < n; i++)
            {
                nextX();
                var tmp = b[i];
                b[i] = b[x % (i + 1)];
                b[x % (i + 1)] = tmp;
            }

            if (d <= 1000)
            {
                var position = new List<int>();
                for (int i = 0; i < n; i++)
                    if (b[i] == 1) position.Add(i);
                for (int i = 0; i < n; i++)
                {
                    var max = 0;
                    foreach (var p in position)
                    {
                        if (p <= i)
                            max = Math.Max(max, a[i - p]);
                    }
                    IO.Printer.Out.WriteLine(max);
                }

            }

            else
            {
                var position = new int[n];
                for (int i = 0; i < n; i++)
                    position[a[i] - 1] = i;
                var pos = new List<int>();
                for (int i = 0; i < n; i++)
                    if (b[i] == 1) pos.Add(i);
                for (int i = 0; i < n; i++)
                {
                    var f = false;
                    for (int j = n - 1; j >= n - 1000; j--)
                    {
                        if (position[j] > i) continue;
                        if (b[i - position[j]] > 0)
                        {
                            IO.Printer.Out.WriteLine(j + 1);
                            f = true;
                            break;
                        }
                    }
                    if (f) continue;
                    var max = 0;
                    foreach (var p in pos)
                    {
                        if (p > i) break;
                        max = Math.Max(max, a[i - p]);
                    }
                    IO.Printer.Out.WriteLine(max);
                }

            }
        }
        long x;
        long nextX()
        {
            return x = (x * 37 + 10007) % 1000000007;
        }

        internal IO.StreamScanner sc;
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; i++) a[i] = f(i); return a; }
    }

    #region Main and Settings
    static class Program
    {
        static void Main(string[] arg)
        {
#if DEBUG
            var errStream = new System.IO.FileStream(@"..\..\dbg.out", System.IO.FileMode.Create, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
            Debug.Listeners.Add(new System.Diagnostics.TextWriterTraceListener(errStream, "debugStream"));
            Debug.AutoFlush = false;
            var sw = new Watch(); sw.Start();
            IO.Printer.Out.AutoFlush = true;
            try
            {
#endif

                var solver = new Solver();
                solver.sc = new IO.StreamScanner(Console.OpenStandardInput());
                solver.Solve();
                IO.Printer.Out.Flush();
#if DEBUG
            }
            catch (Exception ex)
            {
                Console.Error.WriteLine(ex.Message);
                Console.Error.WriteLine(ex.StackTrace);
            }
            finally
            {
                sw.Stop();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.Error.WriteLine("Time:{0}ms", sw.ElapsedMilliseconds);
                Debug.Close();
                System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
            }
#endif
        }

    }
    #endregion
}

#region IO Helper
namespace Solver.IO
{
    public class Printer : System.IO.StreamWriter
    {
        static Printer()
        {
            Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false };
#if DEBUG
            Error = new Printer(Console.OpenStandardError()) { AutoFlush = true };
#else
            Error = new Printer(System.IO.Stream.Null) { AutoFlush = false };
#endif
        }
        public static Printer Out { get; set; }
        public static Printer Error { get; set; }
        public override IFormatProvider FormatProvider { get { return System.Globalization.CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new System.Text.UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, System.Text.Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, IEnumerable<T> source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, IEnumerable<T> source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(System.IO.Stream stream) { iStream = stream; }
        private readonly System.IO.Stream iStream;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        private bool eof = false;
        public bool IsEndOfStream { get { return eof; } }
        const byte lb = 33, ub = 126, el = 10, cr = 13;
        public byte read()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            if (ptr >= len) { ptr = 0; if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while (b < lb || ub < b); return (char)b; }
        public char[] Char(int n) { var a = new char[n]; for (int i = 0; i < n; i++) a[i] = Char(); return a; }
        public char[][] Char(int n, int m) { var a = new char[n][]; for (int i = 0; i < n; i++) a[i] = Char(m); return a; }
        public string Scan()
        {
            if (eof) throw new System.IO.EndOfStreamException();
            StringBuilder sb = null;
            var enc = System.Text.UTF8Encoding.Default;
            do
            {
                for (; ptr < len && (buf[ptr] < lb || ub < buf[ptr]); ptr++) ;
                if (ptr < len) break;
                ptr = 0;
                if ((len = iStream.Read(buf, 0, 1024)) <= 0) { eof = true; return ""; }
            } while (true);
            do
            {
                var f = ptr;
                for (; ptr < len; ptr++)
                    if (buf[ptr] < lb || ub < buf[ptr])
                    //if (buf[ptr] == cr || buf[ptr] == el)
                    {
                        string s;
                        if (sb == null) s = enc.GetString(buf, f, ptr - f);
                        else { sb.Append(enc.GetChars(buf, f, ptr - f)); s = sb.ToString(); }
                        ptr++; return s;
                    }
                if (sb == null) sb = new StringBuilder(enc.GetString(buf, f, len - f));
                else sb.Append(enc.GetChars(buf, f, len - f));
                ptr = 0;

            }
            while (!eof && (len = iStream.Read(buf, 0, 1024)) > 0);
            eof = true; return (sb != null) ? sb.ToString() : "";
        }
        public long Long()
        {
            long ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public int Integer()
        {
            int ret = 0; byte b = 0; bool isMynus = false;
            const byte zr = 48, nn = 57, my = 45;
            do b = read();
            while (b != my && (b < zr || nn < b));
            if (b == my) { isMynus = true; b = read(); }
            for (; true; b = read())
                if (b < zr || nn < b)
                    return isMynus ? -ret : ret;
                else ret = ret * 10 + b - zr;
        }
        public double Double() { return double.Parse(Scan(), System.Globalization.CultureInfo.InvariantCulture); }
        public string[] Scan(int n) { var a = new string[n]; for (int i = 0; i < n; i++) a[i] = Scan(); return a; }
        public double[] Double(int n) { var a = new double[n]; for (int i = 0; i < n; i++) a[i] = Double(); return a; }
        public int[] Integer(int n) { var a = new int[n]; for (int i = 0; i < n; i++) a[i] = Integer(); return a; }
        public long[] Long(int n) { var a = new long[n]; for (int i = 0; i < n; i++)a[i] = Long(); return a; }
        public void Flush() { iStream.Flush(); }
    }
}
#endregion
#region Extension
namespace Solver.Ex
{
    static public partial class EnumerableEx
    {
        static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
        static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }

    }
}
#endregion


using System;

namespace Task_D
{
    class Solution
    {
        static void Main(string[] args)
        {
            new Solution().Solve();
        }

        private int n;
        private int d;
        private long x;
        private int[] a;
        private int[] b;
        private int[] c;

        private void Solve()
        {
            var parts = Console.ReadLine().Split();
            n = int.Parse(parts[0]);
            d = int.Parse(parts[1]);
            x = long.Parse(parts[2]);

            a = new int[n];
            b = new int[n];
            c = new int[n];

            initAB();

            var bCount = 0;
            var bPos = new int[n];
            for (int i = 0; i < n; i++)
            {
                if (b[i] == 1)
                {
                    bPos[bCount++] = i;
                }
            }

            var aOrder = new int[n];
            for (int i = 0; i < n; i++)
            {
                aOrder[a[i] - 1] = i;
            }

            int s = 50;

            for (int i = 0; i < n; i++)
            {
                for (int q = 0; q < s && q < n; q++)
                {
                    int j = aOrder[n - q - 1];
                    if (i - j >= 0 && b[i - j] == 1)
                    {
                        c[i] = a[j];
                        break;
                    }
                }

                if (c[i] != 0)
                {
                    continue;
                }

                for (int z = 0; z < bCount; z++)
                {
                    var bIndex = bPos[z];
                    var j = i - bIndex;
                    if (j >= 0)
                    {
                        c[i] = Math.Max(c[i], a[j]);
                    }
                }
            }

            for (int i = 0; i < n; i++)
            {
                Console.WriteLine(c[i]);
            }
        }

        private long getNextX()
        {
            x = (x * 37 + 10007) % 1000000007;
            return x;
        }

        private void initAB()
        {
            for (int i = 0; i < n; i = i + 1)
            {
                a[i] = i + 1;
            }

            for (int i = 0; i < n; i = i + 1)
            {
                swap(ref a[i], ref a[getNextX() % (i + 1)]);
            }

            for (int i = 0; i < n; i = i + 1)
            {
                if (i < d)
                    b[i] = 1;
                else
                    b[i] = 0;
            }

            for (int i = 0; i < n; i = i + 1)
            {
                swap(ref b[i], ref b[getNextX() % (i + 1)]);
            }
        }

        private void swap<T>(ref T first, ref T second)
        {
            T tmp = first;
            first = second;
            second = tmp;
        }
    }
}


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

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

        private static void Main(string[] args)
        {
            int xp = Next(), yp = Next(), xv = Next(), yv = Next();

            if (xp <= xv && yp <= yv || xp + yp <= Math.Max(xv, yv))
                writer.WriteLine("Polycarp");
            else
                writer.WriteLine("Vasiliy");
            writer.Flush();
        }

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


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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        int x1 = ReadInt();
        int y1 = ReadInt();
        int x2 = ReadInt();
        int y2 = ReadInt();

        int d1 = x1 + y1;
        int d2 = Math.Max(x2, y2);
        if (d1 <= d2 || x1 < x2 && y1 <= y2 || y1 < y2 && x1 <= x2)
            Write("Polycarp");
        else
            Write("Vasiliy");
    }

    #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)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion

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


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

namespace Codeforces
{
    class C
    {
        private static ThreadStart s_threadStart = new C().Go;
        private static bool s_time = false;
        private static double s_eps = 1e-16;

        private void Go()
        {
            int px = GetInt();
            int py = GetInt();
            int vx = GetInt();
            int vy = GetInt();

            if (px <= vx && py <= vy)
            {
                Wl("Polycarp"); return;
            }
            if(vx <= px && vy <= py)
            {
                Wl("Vasiliy"); return;
            }

            if (px > vx)
            {
                if (px <= vy - py)
                {
                    Wl("Polycarp"); return;
                }
                Wl("Vasiliy"); return;
            }

            if (py <= vx - px)
            {
                Wl("Polycarp"); return;
            }
            Wl("Vasiliy"); return;
        }

        #region Template

        public static void Main(string[] args)
        {
            System.Diagnostics.Stopwatch timer = new System.Diagnostics.Stopwatch();
            Thread main = new Thread(new ThreadStart(s_threadStart), 200 * 1024 * 1024);
            timer.Start();
            main.Start();
            main.Join();
            timer.Stop();
            if (s_time)
                Wl(timer.ElapsedMilliseconds);
        }

        private static IEnumerator<string> ioEnum;
        private static string GetString()
        {
            while (ioEnum == null || !ioEnum.MoveNext())
            {
                ioEnum = Console.ReadLine().Split().AsEnumerable().GetEnumerator();
            }

            return ioEnum.Current;
        }

        private static int GetInt()
        {
            return int.Parse(GetString(), CultureInfo.InvariantCulture);
        }

        private static long GetLong()
        {
            return long.Parse(GetString(), CultureInfo.InvariantCulture);
        }

        private static double GetDouble()
        {
            return double.Parse(GetString(), CultureInfo.InvariantCulture);
        }

        private static List<int> GetIntArr(int n)
        {
            List<int> ret = new List<int>(n);
            for (int i = 0; i < n; i++)
            {
                ret.Add(GetInt());
            }
            return ret;
        }

        private static void Wl<T>(T o)
        {
            if (o is double)
            {
                Wld((o as double?).Value, "");
            }
            else if (o is float)
            {
                Wld((o as float?).Value, "");
            }
            else
                Console.WriteLine(o.ToString());
        }

        private static void Wl<T>(IEnumerable<T> enumerable)
        {
            Wl(string.Join(" ", enumerable.Select(e => e.ToString()).ToArray()));
        }

        private static void Wld(double d, string format)
        {
            Wl(d.ToString(format, CultureInfo.InvariantCulture));
        }

        #endregion
    }
}


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

namespace vkcup
{
	class Program
	{
		public static int n, m, h, w;

		public static int x1, x2, y1, y2;

		public static int[] arr;
		private static String s1;
		private static String s2;
		static void Main(string[] args)
		{
			ParseAll(true);
			Solve();
			Console.ReadKey();
		}

		static void Solve()
		{
			if ((x2 <= x1 && y2 <= y1) ||
				(y2 < y1 && x2 - x1 < y1) ||
				(x2 < x1 && y2 - y1 < x1))
			{
				Console.WriteLine("Vasiliy");
			}
			else
			{
				Console.WriteLine("Polycarp");
			}
			return;
		}

		static void ParseAll(bool console)
		{
			if (console)
			{
				ParseFirstLine(Console.ReadLine());
				//ParseArray(2);
			}
		}

		static void ParseFirstLine(String line)
		{
			int[] arr = line.Split(' ').Select(int.Parse).ToArray();
			x1 = arr[0];
			y1 = arr[1];
			x2 = arr[2];
			y2 = arr[3];
		}

		static void ParseSecondLine(String line)
		{
			int[] array = line.Split(' ').Select(int.Parse).ToArray();

		}

		static void ParseThirdLine(String line)
		{
			int[] array = line.Split(' ').Select(int.Parse).ToArray();

		}

		static void ParseArray(int count)
		{
			s1 = Console.ReadLine();
			s2 = Console.ReadLine();

		}

	}
}


using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int zobmieCount = Convert.ToInt32(Console.ReadLine());

            int brainCount;

            if (zobmieCount % 2 != 0)
                if (zobmieCount == 1)
                {
                    Console.WriteLine("1");
                    return;
                }
                else
                    brainCount = (int)(zobmieCount / 2) + 1;
            else
                brainCount = zobmieCount / 2;

            Console.WriteLine(brainCount);
            //Console.ReadKey();
        }
    }
}


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

class Program
{
    static void Main()
    {
        int int_input = int.Parse(Console.ReadLine());
        int int_result;

        int_result = int_input / 2;
        if (int_input % 2 == 1 ){
            int_result++;
        }

        Console.WriteLine(int_result);
    }
}


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

namespace ConsoleApp17
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            Console.WriteLine((n+1)/2);

        }
    }
}


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    public void Solve()
    {
        int n = ReadInt();
        Write((n + 1) / 2);
    }

    #region Main

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

    #endregion

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


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

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

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

            writer.WriteLine((n + 1)/2);
            writer.Flush();
        }
    }
}


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

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

            if(N -1 > 0)
            {
                Console.WriteLine(Math.Ceiling((double)N/2));
            }else
            {
                Console.WriteLine("1");
            }
        }
    }
}


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

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

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

            writer.WriteLine((n - 2)/2 + 1);
            writer.Flush();
        }
    }
}


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

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

            if(N -1 > 0)
            {
                Console.WriteLine(N / 2);
            }else
            {
                Console.WriteLine("1");
            }
        }
    }
}


Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25123.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Heidi and Zombies", "Heidi and Zombies\Heidi and Zombies.csproj", "{B7B14A36-F617-4DFF-9848-00FAC61FD305}"
EndProject
Global
	GlobalSection(SolutionConfigurationPlatforms) = preSolution
		Debug|Any CPU = Debug|Any CPU
		Release|Any CPU = Release|Any CPU
	EndGlobalSection
	GlobalSection(ProjectConfigurationPlatforms) = postSolution
		{B7B14A36-F617-4DFF-9848-00FAC61FD305}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
		{B7B14A36-F617-4DFF-9848-00FAC61FD305}.Debug|Any CPU.Build.0 = Debug|Any CPU
		{B7B14A36-F617-4DFF-9848-00FAC61FD305}.Release|Any CPU.ActiveCfg = Release|Any CPU
		{B7B14A36-F617-4DFF-9848-00FAC61FD305}.Release|Any CPU.Build.0 = Release|Any CPU
	EndGlobalSection
	GlobalSection(SolutionProperties) = preSolution
		HideSolutionNode = FALSE
	EndGlobalSection
EndGlobal


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

namespace Taxis
{
    class Program
    {
        static void Main(string[] args)
        {
            int count1s = 0, count2s = 0, count3s = 0, count4s = 0;
            int numberOfTaxis = 0;
            int remOf1s = 0;
            int x = int.Parse(Console.ReadLine());
            string y = Console.ReadLine();
            string[] arr = y.Split(' ');
            int[] intArray = new int[arr.Length];
            for(int i = 0; i < arr.Length; i++)
            {
                intArray[i] = int.Parse(arr[i]);
                if (intArray[i] == 1) count1s++;
                else if (intArray[i] == 2) count2s++;
                else if (intArray[i] == 3) count3s++;
                else if (intArray[i] == 4) count4s++;
            }
            numberOfTaxis += count4s;
            numberOfTaxis += count2s / 2;
            count2s = count2s % 2;
            numberOfTaxis += count3s;
            if (count1s == count3s)
            {
                count3s = 0;
                count1s = 0;
            }
            else if (count1s > count3s)
            {
                count1s -= count3s;
            }
            else
            {
                count1s = 0;
            }

            if (count1s == count2s * 2)
            {
                numberOfTaxis += count2s;
                count1s = 0;
            }else if (count1s > count2s * 2)
            {
                numberOfTaxis += count2s;
                count1s -= count2s * 2;
                numberOfTaxis += count1s / 4;
                count1s = count1s % 4;
            }else
            {
                numberOfTaxis += count2s;
                count1s = 0;
            }
            if (count1s != 0)
            {
                if (count1s < 4)
                {
                    numberOfTaxis++;
                }
                else
                {
                    count1s -= 4;
                    numberOfTaxis += count1s / 4;
                }
            }

            Console.WriteLine(numberOfTaxis);
        }
    }
}


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

namespace Magnum_Opus
{
    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)
        {
            var ing = new[] {1, 1, 2, 7, 4};

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

            int max = int.MaxValue;

            for (int i = 0; i < 5; i++)
            {
                max = Math.Min(max, nn[i]/ing[i]);
            }

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

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


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            input[2] /= 2;
            input[3] /= 7;
            input[4] /= 4;
            Array.Sort(input);
            Console.WriteLine(input[0]);
        }
    }
}


using System;
class C
{
				static void Main()
				{
								string input = Console.ReadLine();
								string[] split = input.Split(' ');
								int[] have = new int [5];
								int[] intr = {1,1,2,7,4};
								int[] set = new int [5];
								for(int i = 0; i<5; i++)
								{
												have[i] = int.Parse(split[i]);
												set[i] = have[i]/intr[i];
								}
								int max = 101;
								int index = 6;
								for(int i = 0; i<5; i++)
								{
												if(set[i]<max)
												{
																max = set[i];
																index = i;
												}
								}
								Console.WriteLine(set[index]);
				}
}


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

namespace Main
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] A = Console.ReadLine().Split(' ');
            int[] B = new int[A.Count()];
            for (int i = 0; i < B.Count(); i++)
                B[i] = Int32.Parse(A[i]);
            int ans = B[0];
            if (B[1] < B[0]) ans = B[1];
            if (B[2] / 2 < ans) ans = B[2] / 2;
            if (B[3] / 7 < ans) ans = B[3] / 7;
            if (B[4] / 4 < ans) ans = B[4] / 4;
            Console.WriteLine(ans);
        }
    }
}


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

namespace WorldGame
{
    class Program
    {
        static void Main(string[] args)
        {
            string line = Console.ReadLine();

            string[] values = line.Split(' ');
            int[] numbers = { 1, 1, 2, 7, 4 };
            int ans = 100;
            for (int i = 0; i < values.Length; i++) {
                ans = Math.Min(int.Parse(values[i]) / numbers[i], ans);
            }

            Console.WriteLine(ans);
        }
    }
}


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

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            double[] n = Console.ReadLine().Split(' ').Select(double.Parse).ToArray();
            double[] na = new double[n.Length];
            na[0] = Math.Floor(n[0] / 1);
            na[1] = Math.Floor(n[1] / 1);
            na[2] = Math.Floor(n[2] / 2);
            na[3] = Math.Floor(n[3] / 7);
            na[4] = Math.Floor(n[4] / 4);
            Console.Write(na.Min());
        }
    }
}


//#define LOCAL

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

namespace test06
{
    class Program
    {
        static void Main(string[] args)
        {
            new Solve().run();
#if LOCAL
            Console.Write("===============\nPause..."); Console.Read();
#endif
        }

    }
    class Solve
    {
        Scanner cin = new Scanner();
        public void run()
        {
            int[] c = { 1, 1, 2, 7, 4 };
            int[] a = cin.NextIntArray();
            int[] ans = new int[5];
            for (int i = 0; i < 5; i++)
            {
                ans[i] = a[i] / c[i];
            }
            Console.WriteLine(ans.Min());

        }

    }

    class Scanner
    {
        Queue<string> buffer;

        ///构造函数？它不需要构造函数，构造函数也没有参数。
        public Scanner() { }

        ///清除输入流缓冲。如果本行被读出一部分，此方法会清除这行的其他部分。
        public void Ignore()
        {
            buffer.Clear();
        }
        protected void eat(string s)
        {
            string[] tempInput = new System.Text.RegularExpressions.Regex("(\\s+)").Split(s);
            buffer = new Queue<string>(tempInput);
            buffer.Enqueue("");
        }
        ///
        ///
        ///     从输入流中读取下一行，如果本行已经被读出一部分，此方法将直接读出其余的所有内容。
        ///     此方法执行后会清空流缓冲，所以不需要再执行<c>Ignore()</c>方法。
        ///
        public string NextLine()
        {
            if (buffer == null || buffer.Count == 0) return Console.ReadLine();
            else
            {
                StringBuilder temp = new StringBuilder();
                foreach (string k in buffer)
                {
                    temp.Append(k);
                }
                buffer.Clear();
                return temp.ToString();
            }
        }
        ///
        ///
        ///     该方法返回一个布尔值，表示输入流是否结束。
        ///     在输入流中没有其他内容时会返回false
        ///
        public bool HasNext()
        {
            if (buffer == null || buffer.Count == 0)
            {
                string s = Console.ReadLine();
                if (s == null) return false;
                eat(s);
            }
            return true;
        }
        ///
        ///
        ///     该方法返回下一个字符串。由任意可能的空白符号分隔。
        ///
        public String Next()
        {
            HasNext();
            string t = buffer.Dequeue();
            buffer.Dequeue();
            return t;
        }
        ///
        ///
        ///     该方法返回输入流中接下来的一个32位整数。如果接下来的字符不能表示一个整数，将抛出FormatException异常。
        ///
        ///<exception cref="System.FormatException">字符串不能解析为数字</exception>
        public int NextInt()
        {
            return int.Parse(Next());
        }
        ///
        ///
        ///     该方法返回输入流中接下来的一个64位整数。如果接下来的字符不能表示一个整数，将抛出FormatException异常。
        ///
        ///<exception cref="System.FormatException">字符串不能解析为数字</exception>
        public long NextLong()
        {
            return long.Parse(Next());
        }
        ///
        ///
        ///     该方法返回输入流中接下来的一个浮点数。如果接下来的字符不能表示一个数，将抛出FormatException异常。
        ///
        ///<exception cref="System.FormatException">字符串不能解析为数字</exception>
        public double NextDouble()
        {
            return double.Parse(Next());
        }
        ///
        ///
        ///     该方法将下一行按空白字符分隔，并以字符串数组形式返回。
        ///     如果输入流中一行已经被读出一部分，该方法将解析并返回剩余的部分。
        ///
        public string[] NextArray()
        {
            return new System.Text.RegularExpressions.Regex("\\s+").Split(NextLine());
        }
        ///
        ///
        ///     该方法将下一行按空白字符分隔的整数解析成32位整型数组并返回。
        ///     如果输入流中一行已经被读出一部分，该方法将解析并返回剩余的部分。如果存在字符不能表示一个数，将抛出FormatException异常。
        ///
        ///<exception cref="System.FormatException">字符串不能解析为数字</exception>
        public int[] NextIntArray()
        {
            string[] s = NextArray();
            int[] n = new int[s.Length];
            for (int i = 0; i < s.Length; i++)
            {
                n[i] = int.Parse(s[i]);
            }
            return n;
        }
        ///
        ///
        ///     该方法将下一行按空白字符分隔的整数解析成64位整型数组并返回。
        ///     如果输入流中一行已经被读出一部分，该方法将解析并返回剩余的部分。如果存在字符不能表示一个数，将抛出FormatException异常。
        ///
        ///<exception cref="System.FormatException">字符串不能解析为数字</exception>
        public long[] NextLongArray()
        {
            string[] s = NextArray();
            long[] n = new long[s.Length];
            for (int i = 0; i < s.Length; i++)
            {
                n[i] = long.Parse(s[i]);
            }
            return n;
        }
        ///
        ///
        ///     该方法将下一行按空白字符分隔的数字解析成浮点数组并返回。
        ///     如果输入流中一行已经被读出一部分，该方法将解析并返回剩余的部分。如果存在字符不能表示一个数，将抛出FormatException异常。
        ///
        ///<exception cref="System.FormatException">字符串不能解析为数字</exception>
        public double[] NextDoubleArray()
        {
            string[] s = NextArray();
            double[] n = new double[s.Length];
            for (int i = 0; i < s.Length; i++)
            {
                n[i] = double.Parse(s[i]);
            }
            return n;
        }
    }

}


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

public class Solver
{
    #region I/O
    protected static TextReader reader;
    protected static TextWriter writer;

    static void Main()
    {
        #if ONLINE_JUDGE
        reader = Console.In;
        writer = Console.Out;
        #else
        reader = new StreamReader("..\\..\\input.txt");
        writer = new StreamWriter("..\\..\\output.txt");
        #endif
        Solver solver = new Solver();

        try
        {
            object result = solver.Solve();
            if (result != null)
            {
                writer.WriteLine(result);
                Console.Error.WriteLine(result);
            }
        }
        catch (Exception ex)
        {
            Console.Error.WriteLine(ex);
        }
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read helpers

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

    public static string ReadToken()
    {
        if (currentLineTokens.Count == 0)
        {
            currentLineTokens = new Queue<string>(reader.ReadLine().Trim().Split(' '));
        }
        return currentLineTokens.Dequeue();
    }

    public static string[] ReadTokens(bool fromCurrentLine = false)
    {
        string[] split;
        if (fromCurrentLine)
        {
            if (currentLineTokens.Count == 0)
                return new string[0];
            split = currentLineTokens.ToArray();
            currentLineTokens.Clear();
        }
        else
        {
            split = reader.ReadLine().Trim().Split(' ');
        }
        return split;
    }

    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(bool fromCurrentLine = false)
    {
        string[] tokens = ReadTokens(fromCurrentLine);
        return tokens.Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray(bool fromCurrentLine = false)
    {
        string[] tokens = ReadTokens(fromCurrentLine);
        return tokens.Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray(bool fromCurrentLine = false)
    {
        string[] tokens = ReadTokens(fromCurrentLine);
        return tokens.Select(double.Parse).ToArray();
    }

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

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

    #endregion

    public object Solve()
    {
        int[] a = ReadIntArray();
        int[] b = new int[] {1, 1, 2, 7, 4};

        int ans = int.MaxValue;
        for (int i = 0; i < 5; i++)
            ans = Math.Min(ans, a[i] / b[i]);

        return ans;
    }
}


using System;
using System.Linq;

namespace ConsoleApplication5
{
    public class Program
    {
        public static void Main()
        {
            var data = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToList();
            data[2] /= 2;
            data[3] /= 7;
            data[4] /= 4;
            Console.WriteLine(data.Min());
        }
    }
}


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

class TEST{
	static void Main(){

		var d=Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));
		int cnt=(int)1e9;

		cnt=Math.Min(cnt,d[0]/1);
		cnt=Math.Min(cnt,d[1]/1);
		cnt=Math.Min(cnt,d[2]/2);
		cnt=Math.Min(cnt,d[3]/7);
		cnt=Math.Min(cnt,d[4]/4);

		Console.WriteLine(cnt);

	}
}


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

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

            int a1 = int.Parse(s[0]);
            int a2 = int.Parse(s[1]);

            int p = a2 - a1;

            for (int i = 2; i < s.Count(); i++)
            {
                int t = int.Parse(s[i]);
                if (a2 + p != t)
                {
                    System.Console.Write(0);
                    return;
                }
                a2 = t;
            }

            System.Console.Write(1);
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine(1);
        }
    }
}


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

class TEST{
	static void Main(){

		var d=Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));
		int cnt=0;
		Dictionary<int,int> D=new Dictionary<int,int>();
		D.Add(1,0);
		D.Add(2,0);
		D.Add(7,0);
		D.Add(9,0);
		for(int i=0;i<d.Length;i++){
			if(!D.ContainsKey(d[i]))D.Add(d[i],0);
			D[d[i]]++;
		}

		cnt+=Math.Min(2,D[1]);
		cnt+=Math.Min(1,D[2]);
		cnt+=Math.Min(1,D[7]);
		cnt+=Math.Min(1,D[9]);
		Console.WriteLine(cnt);

	}
}


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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            input[2] /= 2;
            input[3] /= 7;
            input[4] /= 4;
            Array.Sort(input);
            Console.WriteLine(input[4]);
        }
    }
}