class Program
    {
        static void Main(string[] args)
        {
                string str = Console.ReadLine();
                string[] s = str.Split(" ");
                int n = Convert.ToInt32(s[0]);
                int k = Convert.ToInt32(s[1]);

                int time = 240 - k;
                int i;
                for (i = 1; i <= n; i++)
                {
                    int task = i * 5;
                    if (time - task < 0)
                    {
                        break;
                    }

                    else
                    {
                        time -= task;

                    }
                }
                i--;
                Console.WriteLine(i);
        }
    }


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

namespace Application
{
    class Program
    {
        static void Main(string[] args)
        {
            string lev = Console.ReadLine();
            int n = 0;
            char l ;
            int level = 1;
            int count1 = 1;
            int count2 = 1;

            l = lev[0];
            level = int.Parse(l.ToString());
            count1 = Con(level, count1);
            l = lev[1];
            level = int.Parse(l.ToString());
            count2 = Con(level, count2);
            n = count1 * count2;

            Console.Write(n);
            lev = Console.ReadLine();

        }

        private static int Con(int level, int count1)
        {
            switch (level10)
            {
                case 0:
                    count1 = 2;
                    break;
                case 1:
                    count1 = 7;
                    break;
                case 2:
                    count1 = 2;
                    break;
                case 3:
                    count1 = 3;
                    break;
                case 4:
                    count1 = 3;
                    break;
                case 5:
                    count1 = 4;
                    break;
                case 6:
                    count1 = 2;
                    break;
                case 7:
                    count1 = 5;
                    break;
                case 8:
                    count1 = 1;
                    break;
                case 9:
                    count1 = 2;
                    break;
                default:
                    Console.WriteLine("Default case");
                    break;
            }
            return count1;
        }

    }
}


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

namespace A
{
    class Program
    {
        static void Main(string[] args)
        {
            string s;
            s = Console.ReadLine();
            char d, f;
            d = s[0];
            f = s[1];
            int a = (int)Char.GetNumericValue(d);
            int b = (int)Char.GetNumericValue(f);
            if (a == b)
            {
                if (a == 0) a = 2;
                else if (a == 1) a = 7;
                else if (a == 2) a = 2;
                else if (a == 3) a = 3;
                else if (a == 4) a = 3;
                else if (a == 5) a = 4;
                else if (a == 6) a = 2;
                else if (a == 7) a = 5;
                else if (a == 8) a = 1;
                else if (a == 9) a = 2;
                Console.WriteLine(a*a);
            }
            else
            {
                if (a == 0) a = 2;
                else if (a == 1) a = 7;
                else if (a == 2) a = 2;
                else if (a == 3) a = 3;
                else if (a == 4) a = 3;
                else if (a == 5) a = 4;
                else if (a == 6) a = 2;
                else if (a == 7) a = 5;
                else if (a == 8) a = 1;
                else if (a == 9) a = 2;
                if (b == 0) b = 2;
                else if (b == 1) b = 7;
                else if (b == 2) b = 2;
                else if (b == 3) b = 3;
                else if (b == 4) b = 3;
                else if (b == 5) b = 4;
                else if (b == 6) b = 2;
                else if (b == 7) b = 5;
                else if (b == 8) b = 1;
                else if (b == 9) b = 2;
                Console.WriteLine(a*b);
            }

        }
    }


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

class Modular
{
    private const int M = 998244353;
    private long value;
    public Modular(long value) { this.value = value; }
    public static implicit operator Modular(long a)
    {
        var m = a % M;
        return new Modular((m < 0) ? m + M : m);
    }
    public static Modular operator +(Modular a, Modular b)
    {
        return a.value + b.value;
    }
    public static Modular operator -(Modular a, Modular b)
    {
        return a.value - b.value;
    }
    public static Modular operator *(Modular a, Modular b)
    {
        return a.value * b.value;
    }
    public static Modular Pow(Modular a, int n)
    {
        switch (n)
        {
            case 0:
                return 1;
            case 1:
                return a;
            default:
                var p = Pow(a, n / 2);
                return p * p * Pow(a, n % 2);
        }
    }
    public static Modular operator /(Modular a, Modular b)
    {
        return a * Pow(b, M - 2);
    }
    private static readonly List<int> facs = new List<int> { 1 };
    public static Modular Fac(int n)
    {
        for (int i = facs.Count; i <= n; ++i)
        {
            facs.Add((int)(Math.BigMul(facs.Last(), i) % M));
        }
        return facs[n];
    }
    public static Modular Ncr(int n, int r)
    {
        return (n < r) ? 0
        : (n == r) ? 1
        : Fac(n) / (Fac(r) * Fac(n - r));
    }
    public static explicit operator int(Modular a)
    {
        return (int)a.value;
    }
}

class MyClass
{
    public static void Solve()
    {
        var input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        Modular n = input[0];
        Modular m = input[1];
        var k = input[2];
        if (input[0] == 1)
        {
            Console.WriteLine((int)Modular.Pow(m, k));
            return;
        }
        var dp = new Modular[k + 1];
        var poly = new Modular[k + 1];
        for (int i = 0; i < k + 1; i++)
        {
            poly[i] = 0;
        }
        poly[1] = 1;
        for (int i = 1; i < k + 1; i++)
        {
            var num = Modular.Pow(n / (n - 1), (int)(m - i)) * Modular.Pow(1 / (n - 1), (int)i);
            for (int j = 0; j < i; j++)
            {
                num *= m - j;
            }
            for (int j = 1; j < i; j++)
            {
                num -= poly[j] * dp[j];
            }
            dp[i] = num;
            if (i == k)
            {
                break;
            }
            poly[i + 1] = 1;
            for (int j = i; j >= 1; j--)
            {
                poly[j] = -i * poly[j] + poly[j - 1];
            }
        }
        Console.WriteLine((int)(dp[k] * Modular.Pow((n - 1) / n, (int)m)));
    }

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


using System;
using System.Collections.Generic;
using System.Linq;
using static System.Console;
using static System.Convert;
using static System.Math;
//using Debug;
//using static System.Globalization.CultureInfo;
//using Edge = Pair<long, int>;
using System.Text;
class Program
{
    static void Main(string[] args)
    {
        Solve();
        //WriteLine(Solve());
    }
    static void Solve()
    {
        var num = Input.num;
        var th = new bool[num + 1];var res = 1L;var q = 0;
        for(var i = num; i >= 1; i--)
        {
            var dic = Calculation.Factorize(i);
            if (dic.Keys.Any(v => th[v])) continue;
            foreach (var c in dic.Keys)
                th[c] = true;
            res *=i;q++;if (q == 3) break;
        }
        WriteLine(res);
    }
}

public class Input
{
    public static string read => ReadLine().Trim();
    public static int[] ar => read.Split(' ').Select(int.Parse).ToArray();
    public  static int num => ToInt32(read);
    public static long[] arL => read.Split(' ').Select(long.Parse).ToArray();
    public  static long numL => ToInt64(read);
    public static char[][] gred(int h)
        => Enumerable.Repeat(0, h).Select(_ => read.ToCharArray()).ToArray();
    public static int[][] ar2D(int num)
        => Enumerable.Repeat(0, num).Select(_ => ar).ToArray();
    public static long[][] arL2D(int num)
        => Enumerable.Repeat(0, num).Select(_ => arL).ToArray();
    public static T getValue<T>(string g)
    {
        var t = typeof(T);
        if (t == typeof(int))
            return (T)(object)int.Parse(g);
        if (t == typeof(long))
            return (T)(object)long.Parse(g);
        if (t == typeof(string))
            return (T)(object)g;
        if (t == typeof(char))
            return (T)(object)char.Parse(g);
        if (t == typeof(double))
            return (T)(object)double.Parse(g);
        if (t == typeof(bool))
            return (T)(object)bool.Parse(g);
        return default(T);
    }
    public const long Inf = (long)1e18;
    public const double eps = 1e-6;
    public  const string Alfa = "abcdefghijklmnopqrstuvwxyz";
    public  const int MOD = 1000000007;
}


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

namespace N
{
    class Program
    {
        static void Main(string[] args)
        {
            long n = Convert.ToInt32(Console.ReadLine());
            if (n > 3)
            {
                if (n % 2 == 1)
                {
                    long u = n * (n - 1) * (n - 2);
                    Console.WriteLine(u);
                }
                else
                {
                    long max = 1;
                    for (long i = n - 101; i < n - 3; i+=2)
                    {

                        long u = i * (i + 1) * (i + 2);
                        if (u > max)
                        {
                            max = u;
                        }
                        long u = i * (i + 3) * (i + 2);
                        if (u > max)
                        {
                            max = u;
                        }
                    }
                    //if (n == 508)
                    //    max = 130065780;
                    Console.WriteLine(max);
                }
            }
            else
            {
                if (n == 3)
                {
                    Console.WriteLine(6);
                }
                if (n == 2)
                {
                    Console.WriteLine(2);
                }
                if (n == 1)
                {
                    Console.WriteLine(1);
                }
            }
        }
    }
}


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

namespace ConsoleApplication1
{
    class examples
    {
        static void Main(string[] args)
        {
            int r, m, a, b, f, g;
            string[] rick = Console.ReadLine().Split();
            string[] morty = Console.ReadLine().Split();
            r = int.Parse(rick[0]);
            a = int.Parse(rick[1]);
            m = int.Parse(morty[0]);
            b = int.Parse(morty[1]);
            for (int i = 0; i < 1000; i++)
            {
                f = a + i * r;
                for (int j = 0; j < 1000; j++)
                {
                    g = b + j * m;
                    if (g == f)
                    {
                        Console.Write(f);
                        goto A;
                    }
                }
            }

            Console.Write(-1);
        A:
        }
    }
}


#define Online

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

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    class Team : IComparable<Team>
    {
        public string name;
        public int goal;
        public int miss;
        public int point;
        public int cnt;
        public int CompareTo(Team y)
        {
            if (this.point > y.point)
            {
                return 1;
            }
            else
            {
                if (this.point == y.point)
                {
                    if (this.goal - this.miss > y.goal - y.miss)
                    {
                        return 1;
                    }
                    else
                    {
                        if (this.goal - this.miss == y.goal - y.miss)
                        {
                            if (this.goal > y.goal)
                            {
                                return 1;
                            }
                            else
                            {
                                if (this.goal == y.goal)
                                {
                                    if (this.name.CompareTo(y.name) > 0)
                                        return 1;
                                    else
                                        return -1;
                                }
                                else
                                {
                                    return -1;
                                }
                            }

                        }
                        else
                        {
                            return -1;
                        }
                    }
                }
                else
                {
                    return -1;
                }
            }
        }
    }

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            Team[] t = new Team[4];
            for (int i = 0; i < 5; i++)
            {
                string[] input = ReadArray();
                string[] score = input[2].Split(':');
                int x = int.Parse(score[0]);
                int y = int.Parse(score[1]);
                for (int j = 0; j < 4; j++)
                {
                    if (t[j] == null)
                    {
                        t[j] = new Team();
                        t[j].name = input[0];
                    }
                    if (t[j].name.Equals(input[0]))
                    {
                        if (x > y) t[j].point += 3;
                        if (x == y) t[j].point++;
                        t[j].goal += x;
                        t[j].miss += y;
                        t[j].cnt++;
                        break;
                    }

                }
                for (int j = 0; j < 4; j++)
                {
                    if (t[j] == null)
                    {
                        t[j] = new Team();
                        t[j].name = input[1];
                    }
                    if (t[j].name.Equals(input[1]))
                    {
                        if (y > x) t[j].point += 3;
                        if (x == y) t[j].point++;
                        t[j].goal += y;
                        t[j].miss += x;
                        t[j].cnt++;
                        break;
                    }
                }
            }
            int opp = 0;
            int ans = 0;
            for (int i = 0; i < 4; i++)
            {
                if (t[i].name.Equals("BERLAND"))
                {
                    t[i].point += 3;
                    t[i].goal++;
                    ans++;

                }
                if (!t[i].name.Equals("BERLAND") && t[i].cnt == 2)
                {
                    t[i].miss++;
                }
            }

            Team[] L = new Team[4];
            Team[] R = new Team[4];
            ArrayUtils.Merge_Sort(t, 0, 3, L, R);
            for (int i = 0; i < 4; i++)
                if (!t[i].name.Equals("BERLAND") && t[i].cnt == 2)
                    opp = i;
            for (int i = 0; i < 4; i++)
            {
                if (t[i].name.Equals("BERLAND"))
                {
                    if (i >= 2)
                    {
                        Console.WriteLine("1:0");
                        return;
                    }
                    for (int j = i + 1; j < 3; j++)
                    {
                        if (t[j].point > t[i].point && j <= 2)
                        {
                            Console.WriteLine("IMPOSSIBLE");
                            return;
                        }
                        else
                        {
                            while (t[i].CompareTo(t[j]) < 0)
                            {
                                t[i].goal++;
                                ans++;
                                t[opp].miss++;
                            }
                        }
                    }
                    Console.WriteLine(ans + ":0");
                }
            }

#if Online
            Console.ReadLine();
#endif

#if FileIO
            sr.Close();
            sw.Close();
#endif
        }

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

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

   /* public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

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

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    public class SegmentTree
    {
        int[] v_min;
        int[] v_max;
        int[] mas;
        public void BuildTree(int[] a)
        {
            int n = a.Length - 1;
            int z = 0;
            while (n >= 2)
            {
                z++;
                n >>= 1;
            }
            n = 1 << (z + 1);
            v_min = new int[n << 1];
            v_max = new int[n << 1];
            mas = new int[n << 1];
            for (int i = n; i < n + a.Length; i++)
                v_min[i] = a[i - n];
            for (int i = n + a.Length; i < v_min.Length; i++)
                v_min[i] = int.MaxValue;
            for (int i = n - 1; i > 0; i--)
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);

            for (int i = n; i < n + a.Length; i++)
                v_max[i] = a[i - n];
            for (int i = n + a.Length; i < v_max.Length; i++)
                v_max[i] = int.MinValue;
            for (int i = n - 1; i > 0; i--)
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);

        }
        //nil
        public int RMQ_MIN(int l, int r)
        {
            int ans = int.MaxValue;
            l += v_min.Length >> 1;
            r += v_min.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Min(ans, v_min[l]);
                if (!((r & 1) == 0))
                    ans = Math.Min(ans, v_min[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public int RMQ_MAX(int l, int r)
        {
            int ans = int.MinValue;
            l += v_max.Length >> 1;
            r += v_max.Length >> 1;
            const int o = 1;
            while (l <= r)
            {
                if ((l & 1) == o)
                    ans = Math.Max(ans, v_max[l]);
                if (!((r & 1) == 0))
                    ans = Math.Max(ans, v_max[r]);
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
            return ans;
        }

        public void Put(int l, int r, int op)
        {
            l += mas.Length >> 1;
            r += mas.Length >> 1;
            while (l <= r)
            {
                if (l % 2 != 0)
                    mas[l] = op;
                if (r % 2 == 0)
                    mas[r] = op;
                l = (l + 1) >> 1;
                r = (r - 1) >> 1;
            }
        }

        public int Get(int x)
        {
            x += mas.Length >> 1;
            int ans = int.MinValue;
            while (x > 0)
            {
                ans = Math.Max(mas[x], ans);
                x >>= 1;
            }
            return ans;
        }

        public void Update(int i, int x)
        {
            i += v_min.Length >> 1;
            v_min[i] = x;
            v_max[i] = x;
            i >>= 1;
            while (i > 0)
            {
                v_min[i] = Math.Min(v_min[(i << 1)], v_min[(i << 1) + 1]);
                v_max[i] = Math.Max(v_max[(i << 1)], v_max[(i << 1) + 1]);
                i >>= 1;
            }
        }
    }

    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }

   /* class Graph
    {
        public List<int>[] g;
        public int[] color; //0-white, 1-gray, 2-black
        public int[] o; //open
        public int[] c; //close
        public int[] p;
        public int[] d;
        public List<Edge> e;

        public Graph(int n)
        {
            g = new List<int>[n + 1];
            color = new int[n + 1];
            o = new int[n + 1];
            c = new int[n + 1];
            p = new int[n + 1];
            d = new int[n + 1];
        }
    }

    static class GraphUtils
    {
        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public static void BFS(int s, Graph g)
        {
            Queue<int> q = new Queue<int>();
            q.Enqueue(s);
            while (q.Count != 0)
            {
                int u = q.Dequeue();
                for (int i = 0; i < g.g[u].Count; i++)
                {
                    int v = g.g[u][i];
                    if (g.color[v] == white)
                    {
                        g.color[v] = gray;
                        g.d[v] = g.d[u] + 1;
                        g.p[v] = u;
                        q.Enqueue(v);
                    }
                }
                g.color[u] = black;
            }
        }

        public static void DFS(int u, ref int time, Graph g)
        {
            g.color[u] = gray;
            time++;
            g.o[u] = time;
            for (int i = 0; i < g.g[u].Count; i++)
            {
                int v = g.g[u][i];
                if (g.color[v] == white)
                {
                    g.p[v] = u;
                    DFS(v, ref time, g);
                }
            }
            g.color[u] = black;
            g.c[u] = time;
            time++;
        }

        public static void FordBellman(int u, Graph g)
        {
            int n = g.g.Length;
            for (int i = 0; i <= n; i++)
            {
                g.d[i] = int.MaxValue;
                g.p[i] = 0;
            }

            g.d[u] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < g.e.Count; j++)
                {
                    if (g.d[g.e[j].a] != int.MaxValue)
                    {
                        if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])
                        {
                            g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;
                            g.p[g.e[j].b] = g.e[j].a;
                        }
                    }
                }
            }
        }
    }*/
    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (val <= a[mid])
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }

            if (a[left] == val)
                return left;
            else
                return -1;
        }

        public static double Bisection(F f, double left, double right, double eps)
        {
            double mid;
            while (right - left > eps)
            {
                mid = left + ((right - left) / 2d);
                if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                    right = mid;
                else
                    left = mid;
            }
            return (left + right) / 2d;
        }

        public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
        {
            decimal m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3m;
                m2 = r - (r - l) / 3m;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
        {
            double m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3d;
                m2 = r - (r - l) / 3d;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (L[i].CompareTo(R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R);
            Merge_Sort(A, q + 1, r, L, R);
            Merge(A, p, q, r, L, R);
        }

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}


using System;
using System.Linq;

namespace ConsoleApplication18
{
    internal class Program
    {
        public static void Main(string[] args)
        {

            if(Console.ReadLine() == 2) Console.WriteLine(2);
            else Console.WriteLine(1);
        }
    }
}


int n = int.Parse(Console.ReadLine());
            for (int i = n - 1; i > 1; i--)
            {
                if (n % i != 0 && n != 1)
                {
                    n -= i;
                }
            }
            Console.WriteLine(n);


using System;

namespace codebusinesstrip
{
    class Program
    {
        private static void Main(string[] args)
        {
            int k, temp, s2 = 0;
            int[] ai = new int[12];
            k = Convert.ToInt32(Console.ReadLine());
            for (int i = 0; i < 12; i++)
                ai[i] = Convert.ToInt32(Console.ReadLine());

            if (k == 0)
            {
                Console.WriteLine(0);2

            }
            else
            {
                for (int j = 0; j < 12; j++)
                    for (int i = 0; i < 11; i++)
                    {
                        if (ai[i] > ai[i + 1])
                        {
                            temp = ai[i];
                            ai[i] = ai[i + 1];
                            ai[i + 1] = temp;
                        }
                    }

                for (int i = 11; i >= 0; i--)
                {
                    if (k > 0)
                    {
                        k -= ai[i];
                        s2++;
                    }
                }
                Console.WriteLine(k <= 0 ? s2 : -1);

            }
        }
    }
}


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

namespace Almost_Identity_Permutations
{
    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 readonly long[,] C = new long[1000,5];

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static long Solve(string[] args)
        {
            int n = Next();
            int k = Next();

            long ans = 1;
            var m = new[] {0, 1, 1, 2, 9};
            for (int i = 2; i <= k; i++)
            {
                ans += GetC(n, i)*m[i];
            }

            return ans;
        }

        private static long GetC(int n, int k)
        {
            if (n < k)
            {
                int c = k;
                k = n;
                n = c;
            }
            if (k == 0 || k == n)
                return 1;

            if (C[n, k] != 0)
                return C[n, k];

            return C[n, k] = GetC(n - 1, k - 1) + GetC(n - 1, k);
        }

        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;

namespace G.GangUp
{
    internal static class Program
    {
        public static void Main(string[] args)
        {
            var nmkcd = Console.ReadLine().Split();
            var n = int.Parse(nmkcd[0]);
            var m = int.Parse(nmkcd[1]);
            var k = int.Parse(nmkcd[2]);
            var c = int.Parse(nmkcd[3]);
            var d = int.Parse(nmkcd[4]);

            var solver = new Solver(n, m, k, c, d);
            solver.Init();

            var memberHomes = Console.ReadLine().Split().GroupBy(int.Parse);
            foreach (var memberHome in memberHomes)
                solver.AddMemberHome(memberHome.Key - 1, memberHome.Count());

            for (var i = 0; i < m; i++)
            {
                var xy = Console.ReadLine().Split();
                var x = int.Parse(xy[0]) - 1;
                var y = int.Parse(xy[1]) - 1;

                solver.AddEdge(x, y);
                solver.AddEdge(y, x);
            }

            for (var i = 0; i < k; i++)
                solver.IncreaseFlow();

            Console.WriteLine(solver.TotalCost);
        }
    }

    internal sealed class Solver
    {
        private static readonly Edge FakeEdge = new Edge();

        private readonly int _n, _m, _k, _c, _d;
        private readonly int _maxTime;
        private readonly Node _start, _sink;
        private readonly Node[,] _nodes;
        private readonly List<Edge>[] _nodeEdges;

        private readonly int[] _bestCosts;
        private readonly Edge[] _bestMoves;

        public Solver(int n, int m, int k, int c, int d)
        {
            _n = n;
            _m = m;
            _k = k;
            _c = c;
            _d = d;

            _maxTime = k + m;
            _nodes = new Node[n, _maxTime];

            _start = new Node() {Id = _nodes.Length};
            _sink = new Node() {Id = _nodes.Length + 1};

            var allNodesCount = _nodes.Length + 2;

            _nodeEdges = new List<Edge>[allNodesCount];
            _bestCosts = new int[allNodesCount];
            _bestMoves = new Edge[allNodesCount];

            for (var i = 0; i < allNodesCount; i++)
                _nodeEdges[i] = new List<Edge>();
        }

        public int TotalCost { get; private set; }

        public void Init()
        {
            var nodeId = 0;
            for (var node = 0; node < _n; node++)
                for (var time = 0; time < _maxTime; time++)
                    _nodes[node, time] = new Node() { Id = nodeId++ };

            for (var time = 0; time < _maxTime; time++)
                AddEdgePair(_nodes[0, time], _sink, time * _c, _k);

            for (var node = 0; node < _n; node++)
            {
                var from = _nodes[node, 0];
                for (var time = 1; time < _maxTime; time++)
                {
                    var to = _nodes[node, time];
                    AddEdgePair(from, to, 0, _k);
                    from = to;
                }
            }
        }

        public void AddMemberHome(int home, int count)
        {
            _nodeEdges[_start.Id].Add(new Edge()
            {
                From = _start,
                To = _nodes[home, 0],
                Cost = 0,
                ResidualCapacity = count,
                Paired = FakeEdge,
            });
        }

        public void AddEdge(int from, int to)
        {
            for (var time = 0; time < _maxTime - 1; time++)
            {
                var nodeFrom = _nodes[from, time];
                var nodeTo = _nodes[to, time + 1];

                for (int people = 0, cost = 1; people < _k; people++, cost += 2)
                    AddEdgePair(nodeFrom, nodeTo, cost * _d, 1);
            }
        }

        public void IncreaseFlow()
        {
            FindBestPath();
            CommitBestPath();
            TotalCost += _bestCosts[_sink.Id];
        }

        private void FindBestPath()
        {
            for (var i = 0; i < _bestCosts.Length; i++)
                _bestCosts[i] = int.MaxValue;

            _bestCosts[_start.Id] = 0;

            bool any;
            do
            {
                any = false;
                for (var nodeId = 0; nodeId < _nodeEdges.Length; nodeId++)
                {
                    var costToSource = _bestCosts[nodeId];
                    if (costToSource == int.MaxValue)
                        continue;

                    foreach (var edge in _nodeEdges[nodeId])
                    {
                        if (edge.ResidualCapacity == 0)
                            continue;

                        var newCost = costToSource + edge.Cost;
                        if (_bestCosts[edge.To.Id] <= newCost)
                            continue;

                        _bestCosts[edge.To.Id] = newCost;
                        _bestMoves[edge.To.Id] = edge;
                        any = true;
                    }
                }
            }
            while (any);
        }

        private void CommitBestPath()
        {
            var cur = _bestMoves[_sink.Id];
            while (cur != null)
            {
                cur.ResidualCapacity--;
                cur.Paired.ResidualCapacity++;
                cur = _bestMoves[cur.From.Id];
            }
        }

        private void AddEdgePair(Node from, Node to, int cost, int capacity)
        {
            var forwardEdge = new Edge()
            {
                From = from,
                To = to,
                Cost = cost,
                ResidualCapacity = capacity,
            };

            var reverseEdge = new Edge()
            {
                From = to,
                To = from,
                Cost = -cost,
                ResidualCapacity = 0,
            };

            forwardEdge.Paired = reverseEdge;
            reverseEdge.Paired = forwardEdge;

            _nodeEdges[from.Id].Add(forwardEdge);
            _nodeEdges[to.Id].Add(reverseEdge);
        }
    }

    internal struct Node
    {
        public int Id { get; set; }
        public override string ToString() => Id.ToString();
    }

    internal sealed class Edge
    {
        public Node From { get; set; }
        public Node To { get; set; }
        public int Cost { get; set; }
        public int ResidualCapacity { get; set; }
        public Edge Paired { get; set; }
    }
}


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

namespace G.GangUp
{
    internal static class Program
    {
        public static void Main(string[] args)
        {
            var nmkcd = Console.ReadLine().Split();
            var n = int.Parse(nmkcd[0]);
            var m = int.Parse(nmkcd[1]);
            var k = int.Parse(nmkcd[2]);
            var c = int.Parse(nmkcd[3]);
            var d = int.Parse(nmkcd[4]);

            var solver = new Solver(n, m, k, c, d);
            solver.Init();

            var memberHomes = Console.ReadLine().Split().GroupBy(int.Parse);
            foreach (var memberHome in memberHomes)
                solver.AddMemberHome(memberHome.Key - 1, memberHome.Count());

            for (var i = 0; i < m; i++)
            {
                var xy = Console.ReadLine().Split();
                var x = int.Parse(xy[0]) - 1;
                var y = int.Parse(xy[1]) - 1;

                solver.AddEdge(x, y);
                solver.AddEdge(y, x);
            }

            for (var i = 0; i < k; i++)
                solver.IncreaseFlow();

            Console.WriteLine(solver.TotalCost);
        }
    }

    internal sealed class Solver
    {
        private static readonly Edge FakeEdge = new Edge();
        private readonly int _n, _m, _k, _c, _d;
        private readonly int _maxTime;
        private readonly Node _start, _sink;
        private readonly Node[,] _nodes;
        private readonly List<Edge>[] _nodeEdges;

        private readonly int[] _bestCosts;
        private readonly Edge[] _bestMoves;
        private readonly bool[] _isInQueue;
        private readonly Queue<Node> _bestPathSearchQueue;

        public Solver(int n, int m, int k, int c, int d)
        {
            _n = n;
            _m = m;
            _k = k;
            _c = c;
            _d = d;

            _maxTime = k + m;
            _nodes = new Node[n, _maxTime];

            _start = new Node() {Id = _nodes.Length};
            _sink = new Node() {Id = _nodes.Length + 1};

            var allNodesCount = _nodes.Length + 2;

            _nodeEdges = new List<Edge>[allNodesCount];
            _bestCosts = new int[allNodesCount];
            _bestMoves = new Edge[allNodesCount];
            _isInQueue = new bool[allNodesCount];
            _bestPathSearchQueue = new Queue<Node>(allNodesCount);

            for (var i = 0; i < _nodeEdges.Length; i++)
                _nodeEdges[i] = new List<Edge>();
        }

        public int TotalCost { get; private set; }

        public void Init()
        {
            var nodeId = 0;
            for (var node = 0; node < _n; node++)
                for (var time = 0; time < _maxTime; time++)
                    _nodes[node, time] = new Node() { Id = nodeId++ };

            for (var time = 0; time < _maxTime; time++)
            {
                var leaderHome = _nodes[0, time];

                _nodeEdges[leaderHome.Id].Add(new Edge()
                {
                    From = leaderHome,
                    To = _sink,
                    Flow = new Flow() { Capacity = _k },
                    Cost = time * _c,
                    Paired = FakeEdge,
                });
            }

            for (var node = 0; node < _n; node++)
                for (var time = 0; time < _maxTime - 1; time++)
                {
                    var from = _nodes[node, time];
                    var to = _nodes[node, time + 1];
                    _nodeEdges[from.Id].Add(new Edge()
                    {
                        From = from,
                        To = to,
                        Cost = 0,
                        Flow = new Flow() { Capacity = int.MaxValue },
                        Paired = FakeEdge,
                    });
                }

            _isInQueue[_sink.Id] = true;
        }

        public void AddMemberHome(int home, int count)
        {
            var target = _nodes[home, 0];

            _nodeEdges[_start.Id].Add(new Edge()
            {
                From = _start,
                To = target,
                Flow = new Flow() { Capacity = count },
                Cost = 0,
                Paired = FakeEdge,
            });
        }

        public void AddEdge(int from, int to)
        {
            for (var time = 0; time < _maxTime - 1; time++)
            {
                var nodeFrom = _nodes[from, time];
                var nodeTo = _nodes[to, time + 1];

                for (int people = 0, cost = 1; people < _k; people++, cost += 2)
                {
                    var mainEdge = new Edge()
                    {
                        From = nodeFrom,
                        To = nodeTo,
                        Flow = new Flow() { Capacity = 1 },
                        Cost = cost * _d,
                    };

                    var helpEdge = new Edge()
                    {
                        From = nodeTo,
                        To = nodeFrom,
                        Flow = new Flow() { Capacity = 0 },
                        Cost = -cost * _d,
                    };

                    mainEdge.Paired = helpEdge;
                    helpEdge.Paired = mainEdge;

                    _nodeEdges[nodeFrom.Id].Add(mainEdge);
                    _nodeEdges[nodeTo.Id].Add(helpEdge);
                }
            }
        }

        public void IncreaseFlow()
        {
            FindBestPath();
            var flow = FindFlow();
            CommitBestPath(flow);
        }

        private void FindBestPath()
        {
            for (var i = 0; i < _bestCosts.Length; i++)
                _bestCosts[i] = int.MaxValue;

            _bestCosts[_start.Id] = 0;
            _bestPathSearchQueue.Enqueue(_start);

            while (_bestPathSearchQueue.Count > 0)
            {
                var node = _bestPathSearchQueue.Dequeue();
                var costToNode = _bestCosts[node.Id];

                foreach (var edge in _nodeEdges[node.Id])
                {
                    if (edge.Flow.Filled)
                        continue;

                    var possibleCost = costToNode + edge.Cost;
                    if (possibleCost >= _bestCosts[edge.To.Id])
                        continue;

                    _bestCosts[edge.To.Id] = possibleCost;
                    _bestMoves[edge.To.Id] = edge;
                    if (_isInQueue[edge.To.Id])
                        continue;

                    _isInQueue[edge.To.Id] = true;
                    _bestPathSearchQueue.Enqueue(edge.To);
                }

                _isInQueue[node.Id] = false;
            }
        }

        private int FindFlow()
        {
            var minFlow = int.MaxValue;
            var cur = _bestMoves[_sink.Id];
            while (cur != null)
            {
                var flow = cur.Flow.Remaining;
                if (flow < minFlow)
                    minFlow = flow;

                cur = _bestMoves[cur.From.Id];
            }

            return minFlow;
        }

        private void CommitBestPath(int flow)
        {
            var cur = _bestMoves[_sink.Id];
            while (cur != null)
            {
                TotalCost += cur.Cost;
                cur.Flow.ActualFlow += flow;
                cur.Paired.Flow.ActualFlow -= flow;
                cur = _bestMoves[cur.From.Id];
            }
        }
    }

    internal struct Node
    {
        public int Id { get; set; }
        public override string ToString() => Id.ToString();
    }

    internal struct Flow
    {
        public int ActualFlow { get; set; }
        public int Capacity { get; set; }

        public int Remaining => Capacity - ActualFlow;
        public bool Filled => ActualFlow == Capacity;
    }

    internal sealed class Edge
    {
        public Node From { get; set; }

        public Node To { get; set; }

        public int Cost { get; set; }
        public Edge Paired { get; set; }
        public Flow Flow;
    }
}


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

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

            string s = Console.ReadLine();
            int n = int.Parse(s.Split(' ')[0]);
            int m = int.Parse(s.Split(' ')[1]);

            if (n == 0 and m!=0 )
            {
                Console.WriteLine("Impossible");
            }
            else
            {
                int mx = 0;
                if (m == 0) { mx = n; } else { mx = n + m - 1; }
                if (m >= n)
                {
                    Console.WriteLine(m.ToString()+" "+(mx).ToString());
                }
                else
                {
                    Console.WriteLine(n.ToString() + " " + (mx).ToString());
                }
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Runtime.InteropServices;
using System.Text;

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

        static string Solve()
        {
            var nab = Console.ReadLine().Split().Select(long.Parse).ToArray();
            long a = nab[0];
            long b = nab[1];

            while (a != 0 && b != 0)
            {
                if (a >= 2 * b) a = a - 2 * b;
                else if (b >= 2 * a) b = b - 2 * a;
                else break;
            }

            return a + " " + b;
        }
    }
}


using System;
class Test {
    static double fac(int start , int end){
        double factorial = 1;
        for(int i = start ; i >= end ; i--){
            factorial *= i;
        }
        return factorial;
    }
    static double rev(int start , int number){
        double reverse = 1;
        int i = start;
        while(number!=0){
            reverse *= i;
            i--;
            number--;
        }
        return reverse;
    }
    static void Main(){
        string [] str = Console.ReadLine().Split();
        int b = int.Parse(str[0]);
        int g = int.Parse(str[1]);
        int n = int.Parse(str[2]);
        long sum = 0;
        int cg , cb;
        cg = 0;
        while(true){
            cg++;
            cb = n-cg;
            if(cb<4){
                break;
            }
            int tcg = cg;
            int tcb = cb;
            if(tcg>g/2){
                tcg = g-tcg;
            }
            if(tcb>b/2){
                tcb = b-tcb;
            }
            sum += (long)(rev(g,tcg)/fac(tcg,1))*(long)(rev(b,tcb)/fac(tcb,1));
        }
        Console.WriteLine(sum);
    }
}


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

namespace The_World_is_a_Theatre
{
    class Program
    {
        static void Main(string[] args)
        {
             int n, m, t;
             int s1 = 1, s2 = 1, sum = 0;

             string[] nmt = Console.ReadLine().Split(' ');
             n = int.Parse(nmt[0]);
             m = int.Parse(nmt[1]);
             t = int.Parse(nmt[2]);

             for (int i = 4; i <= t - 1; i++)
             {
                 s1 = 1;
                 s2 = 1;

                 for (int k = 0; k < i; k++)
                 {
                     s1 = s1 * (n - k) / (k + 1);
                 }

                 for (int j = 0; j < t - i; j++)
                 {
                     s2 = s2 * (m - j) / (j + 1);
                 }

                 sum += s1 * s2;
             }
             Console.WriteLine(sum);
        }
    }
}


 var NumberOfGroup = Convert.ToInt32(Console.ReadLine());
            var Years = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
            if (NumberOfGroup == 1)
            {
                Console.WriteLine(Years[0]);
                return;
            }
            int Answer = Years.Sum() / NumberOfGroup;
            Console.WriteLine(Answer);


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

        int n = Convert.ToInt32(Console.ReadLine());
        var Arr = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

        if (n == 1)
        {
            Console.WriteLine(Arr[0].ToString());
        }
        else
        {
            Array.Sort(Arr);
            Console.WriteLine(Arr[(n == 3) ? 1 : 2]);
        }

    }
}


/* Date: 12.05.2016 * Time: 22:45 */

*/

using System;
using System.IO;

class Example
{
	public static void Main(string[] args)
	{
		int n = int.Parse (Console.ReadLine ());
/*
 * 		if ( n < 10 )
			Console.WriteLine (n);
		else if ( n < 190 )
		{
			n -= 9;
			if ( n % 2 == 0 )
				n = (n % 20) / 2 - 1;
			else
				n = n / 20 + 1;
			Console.WriteLine (n);
		}
		else
		{
			n -= 99;
			if ( n % 3 == 0 )
				n = (n / 300) + 1;
			else if ( n % 3 == 1 )
				n = (n % 300) % 30 - 1;
			else
				n = (n % 30 + 1) / 3;
		}
*/
		int [] d = new int [4000];
		int k = 0;
		for ( int i=1; i < 10; i++, k++ )
			d [i] = i;
		for ( int i=10; i < 100; i++, k+=2 )
		{
			d [k] = i / 10;
			d [k+1] = i % 10;
		}
		for ( int i=100; i < 1000; i++, k+=3 )
		{
			d [k] = i / 100;
			d [k+1] = (i / 10) % 10;
			d [k+2] = i % 10;
		}
		Console.WriteLine (d [n]);
//		Console.ReadKey ();
	}
}
/*
	public static void Main(string[] args)
	{
# if ( ONLINE_JUDGE )

# else
		StreamReader sr= new StreamReader ("B.txt");
		StreamWriter sw = new StreamWriter ("B.out");
# endif

		string ss;

# if ( ONLINE_JUDGE )
		ss = Console.ReadLine ();
# else
		ss = sr.ReadLine ();
# endif

		int n = int.Parse (ss);

		for ( int i=0; i < n; i++ )
# if ( ONLINE_JUDGE )
			Console.WriteLine (e [i] + " ");
# else
			sw.WriteLine (e [i] + " ");
# endif

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

		Console.Write("Press any key to continue . . . ");
		Console.ReadKey(true);
	}
*/


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

class Program
{
    private static void Solve()
    {
        int xs = RI();
        int ys = RI();
        int n = RI();
        int[] x = new int[n];
        int[] y = new int[n];
        for (int i = 0; i < n; i++)
        {
            x[i] = RI() - xs;
            y[i] = RI() - ys;
        }

    }

    static void Main(string[] args)
    {
        int[,] map = new int[222, 222];

        int x = 105;
        int y = 105;
        map[x, y] = 1;
        foreach (char ch in Console.ReadLine())
        {
            if (ch == 'U') y++;
            if (ch == 'D') y--;
            if (ch == 'L') x--;
            if (ch == 'R') x++;
            map[x, y] = 1;

            int count = map[x - 1, y] + map[x + 1, y] + map[x, y - 1] + map[x, y + 1];

            if (count > 1)
            {
                Console.WriteLine("BUG");
                return;
            }
        }

        Console.WriteLine("OK");
    }

    private const int Mod = 1000000000 + 7;

    #region Data Read
    private static char ReadSign()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans == '+' || ans == '-' || ans == '?')
                return (char)ans;
        }
    }

    private static long GCD(long a, long b)
    {
        if (a % b == 0) return b;
        return GCD(b, a % b);
    }

    private static List<int>[] ReadGraph(int n, int m)
    {
        List<int>[] g = new List<int>[n];
        for (int i = 0; i < g.Length; i++) g[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            int a = RI() - 1;
            int b = RI() - 1;

            g[a].Add(b);
            g[b].Add(a);
        }

        return g;
    }

    private static int[,] ReadGraphAsMatrix(int n, int m)
    {
        int[,] matrix = new int[n + 1, n + 1];
        for (int i = 0; i < m; i++)
        {
            int a = RI();
            int b = RI();
            matrix[a, b] = matrix[b, a] = 1;
        }

        return matrix;
    }

    private static void Sort(ref int a, ref int b)
    {
        if (a > b) Swap(ref a, ref b);
    }

    private static void Swap(ref int a, ref int b)
    {
        int tmp = a;
        a = b;
        b = tmp;
    }

    private const int BufferSize = 1 << 16;
    private static StreamReader consoleReader;
    private static MemoryStream testData;

    private static int RI()
    {
        int ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

    private static ulong RUL()
    {
        ulong ans = 0;
        int chr;
        do
        {
            chr = consoleReader.Read();
            if (chr == -1)
                return 0;
        } while (chr < '0' || chr > '9');

        ans = (uint)(chr - '0');
        while (true)
        {
            chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans;
            ans = ans * 10 + (uint)(chr - '0');
        }
    }

    private static long RL()
    {
        long ans = 0;
        int mul = 1;
        do
        {
            ans = consoleReader.Read();
            if (ans == -1)
                return 0;
            if (ans == '-') mul = -1;
        } while (ans < '0' || ans > '9');

        ans -= '0';
        while (true)
        {
            int chr = consoleReader.Read();
            if (chr < '0' || chr > '9')
                return ans * mul;
            ans = ans * 10 + chr - '0';
        }
    }

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

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

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

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

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

        return s.ToArray();
    }

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

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

        char[] s = new char[n];
        int pos = 0;
        do
        {
            s[pos++] = (char)ans;
            if (pos == n) break;
            ans = consoleReader.Read();
        } while ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'));

        return s;
    }

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

        do
        {
            ans = consoleReader.Read();
        } while (ans == 10 || ans == 13);

        List<char> s = new List<char>();

        do
        {
            s.Add((char)ans);
            ans = consoleReader.Read();
        } while (ans != 10 && ans != 13);

        return s.ToArray();
    }

    private static char ReadLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if ((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z'))
                return (char)ans;
        }
    }
    private static char ReadNonLetter()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (!((ans >= 'a' && ans <= 'z') || (ans >= 'A' && ans <= 'Z')))
                return (char)ans;
        }
    }

    private static char ReadAnyOf(IEnumerable<char> allowed)
    {
        while (true)
        {
            char ans = (char)consoleReader.Read();
            if (allowed.Contains(ans))
                return ans;
        }
    }

    private static char ReadDigit()
    {
        while (true)
        {
            int ans = consoleReader.Read();
            if (ans >= '0' && ans <= '9')
                return (char)ans;
        }
    }

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

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

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

    private static double DoubleFromString(string x)
    {
        return double.Parse(x, CultureInfo.InvariantCulture);
    }

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

    private static void PushTestData(StringBuilder sb)
    {
        PushTestData(sb.ToString());
    }
    private static void PushTestData(string data)
    {
#if TOLYAN_TEST
        if (testData == null)
        {
            testData = new MemoryStream();
            consoleReader = new StreamReader(testData);
        }

        var pos = testData.Position;
        var bytes = Encoding.UTF8.GetBytes(data);
        testData.Write(bytes, 0, bytes.Length);
        testData.Flush();
        testData.Position = pos;
#endif
    }
    #endregion
}


int n, p, k;
String[] input = Console.ReadLine().Split(' ');
n = Int16.Parse(input[0]); //osszes oldal
p = Int16.Parse(input[1]); //jelenlegi
k = Int16.Parse(input[2]); //pluszba
for(int i = p-k; i <= p+k; i++){
    if(i < 1) i = 1;
    if(i != 1 && i == p-k){
        Console.Write("<< ");
    }
    if(i == p) Console.Write("("+i+") ");
    else Console.Write(i+" ");
    if(i >= n) break;
    else if(i == p+k){
        Console.Write(">>");
        break;
	}
}


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

namespace CF_399A
{
    class Program
    {
        static void Main()
        {
            int n, p, k;
            var input = Console.ReadLine().Split(' ');
            n = int.Parse(input[0]);
            p = int.Parse(input[1]);
            k = int.Parse(input[2]);
            string output = "";
            if (p > n || p < 1)
            {
                return;
            }
            if (p > k)
            {
                output += "<< ";
                for(int i= p - k; i < p; i++)
                {
                    output += i + " ";
                }

            }
            else
            {
                for (int i = 1; i < p; i++)
                {
                    output += i + " ";
                }
            }

            output += $"({p})";

            if(p < n - k)
            {
                for (int i = p+1; i <= p+k; i++)
                {
                    output += " " + i;
                }
                output += " >>";
            }
            else
            {
                for (int i = p+1; i <= n; i++)
                {
                    output += " " + i;
                }
            }

            Console.WriteLine(output);
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
namespace VectorSpaceModel
{
    class Program
    {
        // https://codeforces.com/contest/ + ContestId

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

            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            var b = Console.ReadLine().Split().Select(int.Parse).ToArray();

            //1 1 1 0 0
            //0 1 1 1 1

            var max = 0;
            List<int> aList = new List<int>(a);
            List<int> bList = new List<int>(b);

            if (a.Length == 1 && a[0] == 1 && b[0] == 0)
            {
                max = 1;
                goto DD;
            }

            for (var i = 1; i < a.Length; i++)
            {
                var c = 0;
                while (c < a.Length)
                {
                    // 1 0

                    if (a[c] == 1 && b[c] == 1)
                    {
                        aList[c] = i;
                        bList[c] = i;
                    }
                    else if (a[c] > b[c])
                    {
                        aList[c] = i;
                        bList[c] = 0;
                    }
                    else if (a[c] < b[c])
                    {
                        aList[c] = 0;
                        bList[c] = 1;
                    }

                    if (IsOk(aList.ToArray(), bList.ToArray()))
                    {
                        max = i;
                        goto DD;
                    }

                    c++;
                }
            }

            DD:
            Console.WriteLine(max == 0 ? -1 : max);

        }

        public static bool IsOk(int[] a, int[] b)
        {
            var sumA = a.Sum();
            var sumB = b.Sum();

            if (sumA > sumB)
                return true;

            return false;
        }
    }
}


using System;

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

            int[] r = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), (element) => int.Parse(element));
            int[] b = Array.ConvertAll(Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries), (element) => int.Parse(element));
            int countb = 0, countr = 0;
            for(int i = 0; i<n; i++)
            {
                if (r[i] == 0 && b[i] == 1)
                {
                    countb++;
                }

                else if (r[i] == 1 && b[i] == 0)
                {
                    countr++;

                }
                else continue;
            }

            if (countr == 0)
                Console.WriteLine(-1);
            else if (countr == countb)
            {
                Console.WriteLine(2);
            }

            else if(countr < countb)
            {
                int ans = countb = countr;
                ans += 2;
                Console.WriteLine(ans);
            }
            else
            {
                Console.WriteLine(1);
            }
        }

}


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

namespace codeforce0
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int c = int.Parse(Console.ReadLine());
            int d = int.Parse(Console.ReadLine());
            int result = min(a, b, c, d);
            Console.WriteLine(result);

        }
        public static int min(int maxGhesmateJaabe, int teedadeAjil, int teedadeMoghasem, int zarfiateHarGhesmat)
        {
            try
            {
                int min1 = 0;
                if (teedadeMoghasem < 0)
                {
                    teedadeMoghasem = 0;
                }
                if (maxGhesmateJaabe + 1 > teedadeMoghasem)
                {
                    min1 = teedadeMoghasem + 1;
                }
                else
                {
                    min1 = maxGhesmateJaabe;
                }
                int maxZafeiat = ((min1) * zarfiateHarGhesmat);

                if (teedadeAjil > maxZafeiat)
                {
                    return 1 + min(maxGhesmateJaabe, teedadeAjil - maxZafeiat, teedadeMoghasem - (maxGhesmateJaabe - 1), zarfiateHarGhesmat);
                }
                else
                {
                    return 1;
                }
            }
            catch (Exception)
            {

            }

        }

    }

}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;
using System.Data;
using System.Diagnostics;

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

            //k = the maximum number of sections in the box
            //a = the number of nuts
            //b = the number of divisors
            //v = the capacity of each section of the box

            int count = 0;
            string[] input = Console.ReadLine().Split();
            int k = int.Parse(input[0]);
            int a = int.Parse(input[1]);
            int b = int.Parse(input[2]);
            int v = int.Parse(input[3]);

            if (k - 1 < b)
            {
                a = a - (v * k);
                b = b - (k - 1);
                count++;
                while (a > 0)
                {
                    if(k-1 <b)
                    {
                        a = a - (v * k);
                        b = b - (k - 1);
                        count++;
                    }

                    else if (k-1 > b)
                    {
                        a = a - (b + 1) * v;
                        b = 0;
                        count++;
                    }
                    else if (b==0)
                    {
                        a = a - v;
                        count++;
                    }
                }
            }

            else
            {
                a = a - (b + 1) * v;
                count++;
                while (a > 0)
                {
                    a = a - v;
                    count++;
                }
            }

            Console.WriteLine(count);
        }
    }
}


using System;

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

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

            int v1 = int.Parse(s[0]);
            int v2 = int.Parse(s[1]);

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

            int t = int.Parse(ss[0]);
            int d = int.Parse(ss[1]);

            int ans = v1;

            int ts = v1;

            for (int i = 1, nts = 0; i < t; i++)
            {

                for (int j = d; j >=-d; j--)
                {
                    nts = ts + j;
                    if (Math.Abs(v2 - nts) <= d*(t - i - 1))
                    {
                       break;
                    }
                }
                ts = nts;
                ans += ts;

            }

            Console.WriteLine(ans);

            Console.WriteLine(ans);

        }
    }
}


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

namespace Problem{

    public class Solution{

        public static void Main(){

            int[] nums = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            int a = nums[0];
            int b = nums[1];
            int c = nums[2];

            int totalLength = c*2;

            if(a > b){
                totalLength += 2*b + 1;
            }else if(a < b){
                totalLength += 2*a + 1;
            }else{
                totalLength += 2*b;
            }

            Console.WriteLine(totalLength);
        }
    }
}


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

public class Class2
{
    static void Main()
    {
        string str;
        while ((str = Console.ReadLine()) != null)
        {
            var res = Func(str);
            Console.WriteLine(res);
        }
    }
    static int Func(string str)
    {
        var a = str.Split().Select(x => int.Parse(x)).ToArray();
        return Math.Min(a[0], a[1]) * 2 + a[2] * 2 + (Math.Abs(a[0] - a[1]) > 0 ? 1 : 0);
    }
}


using System;

class MainClass()
{
    static void Main(string[] args)
    {
        int[] input = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int minimum = input[0] > input[1] ? input[1] : input[0];

        if (minimum % 2 == 0) Console.WriteLine("Malvika");
        else Console.WriteLine("Akshat");
    }
}


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)
        {
            char[,] Pazl1 = new char[2, 2];
            char[,] Pazl2 = new char[2, 2];
            char ThisCh=' ',ch=' ';
            string str = Console.ReadLine();
            string str2 = Console.ReadLine();
            Pazl1[0, 0] = str[0];
            Pazl1[0, 1] = str[1];
            Pazl1[1, 0] = str2[0];
            Pazl1[1, 1] = str2[1];
            str = Console.ReadLine();
            str2 = Console.ReadLine();
            Pazl2[0, 0] = str[0];
            Pazl2[0, 1] = str[1];
            Pazl2[1, 0] = str2[0];
            Pazl2[1, 1] = str2[1];
            if (Pazl1[0,0]=='X')
            {
                ch = Pazl1[0, 0];
                Pazl1[0, 0] = Pazl1[1, 0];
                Pazl1[1, 0] = Pazl1[1, 1];
                Pazl1[1, 1] = Pazl1[0, 1];
                Pazl1[0, 1] = ch;
            }

            ThisCh = Pazl1[0, 0];
            while (ThisCh != Pazl2[0, 0])
            {
                ch = Pazl2[0, 0];
                Pazl2[0, 0] = Pazl2[1, 0];
                Pazl2[1, 0] = Pazl2[1, 1];
                Pazl2[1, 1] = Pazl2[0, 1];
                Pazl2[0, 1] = ch;
            }
            if (Pazl1[0, 1] == 'X')
            {
                ch = Pazl1[0, 1];
                Pazl1[0, 1] = Pazl1[1,1];
                Pazl1[0, 1] = ch;
            }
            if (Pazl2[0, 1] == 'X')
            {
                ch = Pazl2[0, 1];
                Pazl2[0, 1] = Pazl2[1, 1];
                Pazl2[1, 1] = ch;
            }
            if (Pazl2[0, 1] == Pazl1[0, 1])
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");
        }
    }
}


using System;

namespace ConsoleApplication
{
	class Program
	{
		static void Main(string[] args)
		{
			string bessy1 = Console.ReadLine();
			string bessy2 = Console.ReadLine();
			string elsy1 = Console.ReadLine();
			string elsy2 = Console.ReadLine();

			if (elsy1 != null && elsy1.Length == 2 &&
				elsy2 != null && elsy2.Length == 2 &&
				bessy1 != null && bessy1.Length == 2 &&
				bessy2 != null && bessy2.Length == 2 &&
				(bessy1 == elsy1 ||
				bessy2 == elsy2 ||
				string.Concat(bessy1[0], bessy2[0]) == string.Concat(elsy1[0], elsy2[0]) ||
				string.Concat(bessy1[1], bessy2[1]) == string.Concat(elsy1[1], elsy2[1])))
			{
				Console.WriteLine("YES");
			}
			else
			{
				Console.WriteLine("NO");
			}
		}
	}
}


using System;

namespace CF587.C
{
    public class Rectangle
    {
        public int MinX { get; set; }
        public int MinY { get; set; }

        public int MaxX { get; set; }
        public int MaxY { get; set; }
    }

    public enum OverlapType
    {
        Partial,
        Full,
        No,
        Right,
        Top,
        Left,
        Bottom,
    }

    public class Program
    {
        public static OverlapType GetOverlapType(Rectangle r1, Rectangle r2)
        {
            if (r2.MinX > r1.MaxX || r2.MaxX < r1.MinX) return OverlapType.No;
            if (r2.MinY > r1.MaxY || r2.MaxY < r1.MinY) return OverlapType.No;
            if (r2.MinX <= r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Full;
            if (r2.MinX <= r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY < r1.MaxY) return OverlapType.Bottom;
            if (r2.MinX <= r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY > r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Top;
            if (r2.MinX <= r1.MinX && r2.MaxX < r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Left;
            if (r2.MinX > r1.MinX && r2.MaxX >= r1.MaxX && r2.MinY <= r1.MinY && r2.MaxY >= r1.MaxY) return OverlapType.Right;
            return OverlapType.Partial;
        }

        public static void Main(string[] args)
        {
            var firstStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();
            var secondStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();
            var thirdStr = Console.ReadLine()?.Split(' ') ?? throw new ArgumentNullException();

            var white = new Rectangle
            {
                MinX = int.Parse(firstStr[0]),
                MinY = int.Parse(firstStr[1]),
                MaxX = int.Parse(firstStr[2]),
                MaxY = int.Parse(firstStr[3]),
            };

            var b1 = new Rectangle
            {
                MinX = int.Parse(secondStr[0]),
                MinY = int.Parse(secondStr[1]),
                MaxX = int.Parse(secondStr[2]),
                MaxY = int.Parse(secondStr[3]),
            };

            var b2 = new Rectangle
            {
                MinX = int.Parse(thirdStr[0]),
                MinY = int.Parse(thirdStr[1]),
                MaxX = int.Parse(thirdStr[2]),
                MaxY = int.Parse(thirdStr[3]),
            };

            var firstOverlap = GetOverlapType(white, b1);
            var secondOverlap = GetOverlapType(white, b2);

            var result = "YES";
            switch (firstOverlap)
            {
                case OverlapType.Full:
                    result = "NO";
                    break;

                case OverlapType.No:
                case OverlapType.Partial:
                    if (secondOverlap == OverlapType.Full) result = "NO";
                    break;

                case OverlapType.Right:
                    if (secondOverlap == OverlapType.Full) result = "NO";
                    if (secondOverlap == OverlapType.Left && b2.MaxX >= b1.MinY) result = "NO";
                    break;

                case OverlapType.Top:
                    if (secondOverlap == OverlapType.Full) result = "NO";
                    if (secondOverlap == OverlapType.Bottom && b2.MaxY >= b1.MinY) result = "NO";
                    break;

                case OverlapType.Left:
                    if (secondOverlap == OverlapType.Full) result = "NO";
                    if (secondOverlap == OverlapType.Right && b1.MaxX >= b2.MinX) result = "NO";
                    break;

                case OverlapType.Bottom:
                    if (secondOverlap == OverlapType.Full) result = "NO";
                    if (secondOverlap == OverlapType.Top && b1.MaxY >= b2.MinY) result = "NO";
                    break;

                default:
                    throw new ArgumentOutOfRangeException();
            }

            Console.WriteLine(result);
        }
    }
}


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

namespace ProgrammingContest.Codeforces.Round11
{
    class B
    {
        static long g(long x)
        {
            return x * (x + 1) / 2;
        }

        static long f(long x)
        {
            long l = 0, h = x;
            long v = -1;
            while (true)
            {
                v = (l + h)/2;
                long a = g(v), b = g(v+1);
                if (a <= x && b > x) break;
                if (a > x) h = v - 1;
                else l = v + 1;
            }
            return v;
        }

        public static void Main()
        {
            long x = long.Parse(Console.ReadLine());
            long a = f(x);
            long b = g(a);
            Console.WriteLine(a + (x - b) * 2);
        }
    }
}


using System;
using System.Linq;

namespace Codeforces
{
    internal static class Program
    {
        private static void Main()
        {
            var n = long.Parse(Console.ReadLine());

            long count = 0;

            for (var i = 1; i <= n; i++)
            {
                if (new long[] { 5, 7, 8, 9, 10 }.All(div => i % div == 0))
                {
                    count++;
                }
            }

            Console.WriteLine(count);
        }
    }
}


class Program
    {
        private static double SqrDistance(double x1, double y1, double x2, double y2)
        {
            return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2);
        }

        static void Main()
        {
            string input = Console.ReadLine();
            string[] intputNumbers = input.Split(' ');

            double x, y;
            x = Convert.ToInt64(intputNumbers[0]);
            y = Convert.ToInt64(intputNumbers[1]);

            double x1 = 0, y1 = 0, x2 = 0, y2 = 0;
            double height = Math.Sqrt(SqrDistance(x, y, x, 0));

            if(x > 0 && y > 0)
                Console.Write(0.ToString() + " " + (x + height).ToString() + " " + (x + height).ToString() + " " + 0.ToString());
            else if(x < 0 && y > 0)
                Console.Write((x - height).ToString() + " " + 0.ToString() + " " + 0.ToString() + " " + (-x + height).ToString());
            else if (x < 0 && y < 0)
                Console.Write((x - height).ToString() + " " + 0.ToString() + " " + 0.ToString() + " " + (x - height).ToString());
            else if (x > 0 && y < 0)
                Console.Write(0.ToString() + " " + (x + height).ToString() + " " + (x + height).ToString() + " " + 0.ToString());
        }
    }


public class Program{
    public static void Main(){
        int x, y;
        string[] line = Console.ReadLine().Split(' ');
        x = int.Parse(line[0]);
        y = int.Parse(line[1]);

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

        if(x > 0 && y > 0)
            Console.WriteLine("{0} {1} {2} {3}", 0, sum, sum, 0);
        else if(x > 0 && y < 0)
            Console.WriteLine("{0} {1} {2} {3}", 0, -sum, sum, 0);
        else if(x < 0 && y > 0)
            Console.WriteLine("{0} {1} {2} {3}", -sum, 0, 0, sum);
        else
            Console.WriteLine("{0} {1} {2} {3}", -sum, 0, 0, -sum);
    }
}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{26DE0CF0-FAFD-4D67-BDCC-4CB8493E45C1}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <RootNamespace>lessons</RootNamespace>
    <AssemblyName>lessons</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Net.Http" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>


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

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            const int d = 3;
            const int f = 36;
            double sm;
            sm =Convert.ToDouble(Console.ReadLine());
            double k = sm / f;
            double s = (k % 1) *12;
            Console.WriteLine(Convert.ToInt16(k) + " " + Convert.ToInt16(Math.Round(s)));
        }
    }
}


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

namespace Artyom
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int b = n / 36;
            n = n%36;
            int a = n / 3;
            if (n % 3 > 1) a = a + 1;
            Console.WriteLine(b + " " + a);
        }
    }
}


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

namespace CF_QueueSchool
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] tmp = Console.ReadLine().Split(' ');
            string q = Console.ReadLine();
            int n = int.Parse(tmp[1]);
            while(n-- >0)
            {
                q = q.Replace("BG", "GB");
            }
            Console.WriteLine(qu);
        }
    }
}


using System;

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            var maxVolume = 0;
            var charCount = Console.ReadLine();
            var sentance = Console.ReadLine();
            var words = sentance.Split(' ');

            foreach (var word in words)
            {
                var capsCount = word.Where(c => c.ToString() == c.ToString().ToUpper()).Count();

                if (capsCount > maxVolume)
                {
                    maxVolume = capsCount;
                }
            }
            Console.WriteLine(maxVolume);
        }
    }
}


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

namespace acm
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = nextInt();
            long ans = 0;
            for (int i = 0; i < 9; ++i)
            {
                for (int j = 0; j < 9; j++)
                {
                    for (int k = 0; k < 9; k++) if( j * k % 9 == i )
                    {
                        ans += calc(j, n) * calc(k, n) * calc(i, n);
                    }
                }
            }
            int[] e = new int[n + 1];
            for (int i = 2; i < n + 1; i++)
            {
                if( e[i] == 0 )
                    for (int j = i + i; j < n + 1; j+=i)
                    {
                        e[j] = i;
                    }
            }
            -- ans;
            for (int i = 2; i < n + 1; i++) if (e[i] > 0)
                {
                    List<int> a = new List<int>();
                    int j;
                    for (j = i; e[j] != 0; j /= e[j]) a.Add(e[j]);
                    a.Add(j);
                    var l = from v in a orderby v select v;
                    long cnt = 1;
                    int lst = -1;
                    long cur = 0;
                    foreach (var z in l)
                    {
                        if (z != lst)
                        {
                            cnt *= (cur + 1);
                            cur = 0;
                        }
                        ++cnt;
                        lst = z;
                    }
                    cnt *= (cur + 1);
                    //o(cnt);
                    ans -= cnt;
                }
                else ans -= 2;
            o(ans);
        }

        static long calc(int a, int n)
        {
            n -= a;
            if (a != 0) n += 9;
            return n / 9;
        }

        static string inp = null;
        static string[] inps = null;
        static int icur = -1;
        static string nextToken()
        {
            while (inps == null || icur == inps.Length)
            {
                icur = 0;
                inp = Console.ReadLine();
                inps = inp.Split(" \t".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            }
            return inps[icur++];
        }
        static int nextInt()
        {
            return int.Parse(nextToken());
        }
        static long nextLong()
        {
            return long.Parse(nextToken());
        }
        static double nextDouble()
        {
            return double.Parse(nextToken());
        }
        static void o( params object[] a )
        {
            Console.WriteLine(String.Join(" ", (from v in a select v.ToString()).ToArray()));
        }
    }
}


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

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

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

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

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

        static void solution()
        {
            #region SOLUTION
            var n = readInt();
            var cs = new long[10];
            var vs = new long[n + 1];
            for (int i = 1; i < n + 1; i++)
            {
                vs[i] = getSum(i);
                cs[vs[i]]++;
            }

            var total = 0L;
            for (int i = 1; i < 10; i++)
            {
                for (int j = 1; j < 10; j++)
                {
                    var next = getSum(i * j);
                    var val = cs[i] * cs[j];
                    //if (i == j)
                    //{
                    //    val = cs[i] * cs[i - 1] / 2;
                    //}

                    if (val * cs[next] > 0)
                    {
                        total += val * cs[next];
                    }

                }
            }

            //total += (cs[1] * (cs[1] - 1) / 2);
            //total += (cs[2] * cs[1]);
            //total += (cs[3] * cs[1]);
            //total += (cs[4] * cs[1] + cs[2] * (cs[2] - 1) / 2);
            //total += (cs[5] * cs[1]);
            //total += (cs[6] * cs[1] + cs[3] * cs[2]);
            //total += (cs[7] * cs[1]);
            //total += (cs[8] * cs[1] + cs[2] * cs[4]);
            //total += (cs[9] * cs[1] + cs[3] * (cs[3] - 1) / 2);

            var remc = 0L;
            for (int i = 1; i < n + 1; i++)
            {
                var end = (int)Math.Floor(Math.Sqrt(i));
                for (int j = 1; j <= end; j++)
                {
                    var rem = i % j;
                    var another = i / j;
                    if (rem == 0)
                    {
                        if (another == j)
                        {
                            remc++;
                        }
                        else
                        {
                            remc += 2;
                        }

                    }
                }
            }

            total -= remc;
            Console.WriteLine(total);

            //var n = readInt();
            //var m = readInt();

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

        static int getSum(int a)
        {
            if (a < 10)
            {
                return a;
            }

            var val = a;
            var sum = 0;
            while (true)
            {
                sum += (val % 10);
                val /= 10;
                if (val == 0)
                {
                    break;
                }
            }

            return getSum(sum);
        }

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

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

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

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

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

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


using System;

namespace CodefCS
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] tokens = Console.ReadLine().Split();
            int[] m = new int[105];
            int[] d = new int[105];
            int[] f = new int[105];

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

            int i=0;
            tokens = Console.ReadLine().Split();

            while (i < k)
            {
                m[i] = int.Parse(tokens[i]);
                i++;
            }i = 1;

            int a= m[0];
            int b;

            while (i < k)
            {
                if (m[i] - a > 0)b = m[i] - a;
                else b = n - a + m[i];

                if (f[b] == 1) { Console.WriteLine(-1);return;}

                f[b]++;
                d[a - 1] = b;
                a = m[i];
                i++;
            }i = 0;int j = 1;

            while (i < n)
            {
                if (d[i] == 0)
                {

                    while (j <= n)
                    {
                        if (f[j] == 0)
                        {
                            m[i] = j;
                            break;
                        }
                        j++;
                    }
                }
            }

            while (i < n)
            {
                Console.WriteLine(d[i]+" ");
                i++;
            }
        }
    }
}


<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  <PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
    <ProjectGuid>{AA9407D8-33A6-4D68-99B9-E3D10DE61119}</ProjectGuid>
    <OutputType>Exe</OutputType>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>IgraPerestanovka</RootNamespace>
    <AssemblyName>IgraPerestanovka</AssemblyName>
    <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
    <FileAlignment>512</FileAlignment>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
    <Optimize>false</Optimize>
    <OutputPath>bin\Debug\</OutputPath>
    <DefineConstants>DEBUG;TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <PlatformTarget>AnyCPU</PlatformTarget>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release\</OutputPath>
    <DefineConstants>TRACE</DefineConstants>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="System" />
    <Reference Include="System.Core" />
    <Reference Include="System.Xml.Linq" />
    <Reference Include="System.Data.DataSetExtensions" />
    <Reference Include="Microsoft.CSharp" />
    <Reference Include="System.Data" />
    <Reference Include="System.Xml" />
  </ItemGroup>
  <ItemGroup>
    <Compile Include="Program.cs" />
    <Compile Include="Properties\AssemblyInfo.cs" />
  </ItemGroup>
  <ItemGroup>
    <None Include="App.config" />
  </ItemGroup>
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
       Other similar extension points exist, see Microsoft.Common.targets.
  <Target Name="BeforeBuild">
  </Target>
  <Target Name="AfterBuild">
  </Target>
  -->
</Project>


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

namespace task121A
{
    class Program
    {
        static List<string> MyList = new List<string>();
        static List<Int64> lst = new List<Int64>();
        static void NewCh(string s)
        {
            if (s.Length == 11) return;
            MyList.Add(s);
            NewCh(s + "4");
            NewCh(s + "7");
        }

        static Int64 GetNumber(Int32 number)
        {
            Int64 result = 0;
            for (Int32 i = 0; i < MyList.Count; i++)
            {
                if (lst[i] >= number)
                {
                    result = lst[i];
                    break;
                }
            }
            return result;
        }
        static void Main(string[] args)
        {
            NewCh("4");
            NewCh("7");
            for(Int32 i = 0;i<MyList.Count;i++)
            {
                lst.Add(Int64.Parse(MyList[i]));
            }
            lst.Sort();
            /*foreach (string s in MyList)
                Console.Write(s + "  ");*/
            string[] input = Console.ReadLine().Split(' ');
            Int32 begin = Int32.Parse(input[0]);
            Int32 end = Int32.Parse(input[1]);
            Int64 result = 0;
            for (Int32 i = begin; i <= end; i++)
            {
                result += GetNumber(i);
            }
            Console.WriteLine(result);
            //Console.ReadLine();
        }
    }
}


#define Library
using System;
using System.Collections.Generic;
using System.Linq;

namespace Codeforces.TaskA
{
    public class Task
    {
        public static void Main()
        {
            var task = new Task();
            task.Solve();
        }

        private void Solve()
        {
            var list = Input.Numbers();
            var a = list[0];
            var b = list[1];
            var res = a;
            while (a >= b)
            {
                var whole = a/b;
                a -= whole*b;
                a += whole;
                res += whole;
            }
            Console.WriteLine(res);
        }
    }
}


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

class Program
{
    public static void Main(string[] args)
    {
        //MulticaseTest();
        //int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int n = int.Parse(Console.ReadLine());
        int[] input = Console.ReadLine().Split().Select(int.Parse).ToArray();
        if (input.All(x => x >= 0)) Console.WriteLine(input.Sum());
        else
        {
            int C = input.Min();
            List<int> vals = input.ToList();
            vals.Remove(C);
            int val = vals.Sum() + Math.Abs(C);
            Console.WriteLine(val);
        }
    }

    public static void MulticaseTest()
    {
        //4
        //4 5 2 3
        int t = int.Parse(Console.ReadLine());
        List<string> o = new List<string>(t);
        for (int i = 0; i < t; i++)
        {
            int n = int.Parse(Console.ReadLine());

        }
        o.ForEach(Console.WriteLine);
    }
}