using System;

namespace CSharp
{
    class _1033B
    {
        public static void Main()
        {
            for (int t = int.Parse(Console.ReadLine()); t > 0; t--)
            {
                var tokens = Console.ReadLine().Split();

                long a = long.Parse(tokens[0]);
                long b = long.Parse(tokens[1]);

                bool isPrime = a == b + 1;

                for (long i = 2; i * i <= a + b && isPrime; i++)
                {
                    if ((a + b) % i == 0)
                    {
                        isPrime = false;
                    }
                }

                Console.WriteLine(isPrime ? "YES" : "NO");
            }
        }
    }
}


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

using E = System.Linq.Enumerable;
using System.Threading;

using Weight = System.Int64;

internal partial class Solver {
    int f(int p1, int p2) {
        if (p1 > p2) p2 += 3;
        if (p1 == p2) return 0;
        if (p1 + 1 == p2) return 1;
        return -1;
    }

    public void Run() {
        var n = ni();
        var a = ni(3);
        var b = ni(3);
        // a1>a2, a2>a3, a3>a1
        var dual1 = new PrimalDual(11);
        var dual2 = new PrimalDual(11);

        int In(int p) => p;
        int Out(int p) => p + 3;
        int source = 6;
        int sink = 7;
        long inf = (long)1e10;
        for (int i = 0; i < 3; i++) {
            dual1.AddEdge(source, In(i), a[i], 0);
            dual2.AddEdge(source, In(i), a[i], 0);
            dual1.AddEdge(Out(i), sink, b[i], 0);
            dual2.AddEdge(Out(i), sink, b[i], 0);
            for (int j = 0; j < 3; j++) {
                var r = f(i, j);
                if (r == 1) { // alice win
                    dual1.AddEdge(In(i), Out(j), inf, 1);
                    dual2.AddEdge(In(i), Out(j), inf, -1);
                } else {
                    dual1.AddEdge(In(i), Out(j), inf, 0);
                    dual2.AddEdge(In(i), Out(j), inf, 0);
                }
            }
        }
        var min = dual1.Run(source, sink, n).TotalCost;
        var max = -dual2.Run(source, sink, n).TotalCost;

        cout.WriteLine("{0} {1}", min, max);
    }
}

public class MinCostFlowResult {
    public Weight TotalCost;
    public Weight TotalFlow;
}

/// <summary>
/// Cost can be negative.
/// O(FVE)
/// </summary>
public class PrimalDual {
    private readonly int N;
    private readonly List<List<Edge>> adjacents;

    private readonly Weight[] _distance;
    private readonly bool[] _inQueue;
    private readonly Edge[] _prevEdges;
    private readonly Queue<int> _queue;

    public class Edge {
        public int From, To;
        public Weight Flow, Capacity, Cost;
        public Edge Reverse;
        public Edge(int from, int to, Weight capacity, Weight cost, Weight flow = 0) {
            From = from;
            To = to;
            Cost = cost;
            Flow = flow;
            Capacity = capacity;
        }
        public Weight Residue {
            get {
                return Capacity - Flow;
            }
        }
    }

    public PrimalDual(int n) {
        N = n;
        adjacents = new List<List<Edge>>();
        for (int i = 0; i < n; i++) {
            adjacents.Add(new List<Edge>());
        }
        _distance = new Weight[N];
        _inQueue = new bool[N];
        _prevEdges = new Edge[N];
        _queue = new Queue<int>(N);
    }

    public IEnumerable<Edge> GetEdges() {
        return adjacents.SelectMany(a => a);
    }

    public void AddEdge(int from, int to, Weight capacity, Weight cost) {
        var e = new Edge(from, to, capacity, cost);
        adjacents[from].Add(e);
    }

    private Edge[] FindShortestPathTree(int source) {
        Array.Clear(_inQueue, 0, _inQueue.Length);
        Array.Clear(_prevEdges, 0, _prevEdges.Length);
        for (int i = 0; i < N; i++) {
            _distance[i] = Weight.MaxValue;
        }
        _distance[source] = 0;
        _inQueue[source] = true;
        _queue.Enqueue(source);
        while (_queue.Count > 0) { // SPFA
            int now = _queue.Dequeue();
            _inQueue[now] = false;
            foreach (var e in adjacents[now]) {
                if (e.Residue <= 0) {
                    continue;
                }

                if (_distance[now] != Weight.MaxValue && _distance[e.To] > _distance[now] + e.Cost) {
                    _distance[e.To] = _distance[now] + e.Cost;
                    _prevEdges[e.To] = e;
                    if (!_inQueue[e.To]) {
                        _inQueue[e.To] = true;
                        _queue.Enqueue(e.To);
                    }
                }
            }
        }
        return _prevEdges;
    }

    public MinCostFlowResult Run(int source, int sink, Weight flow) {
        Weight totalCost = 0;
        Weight totalFlow = 0;

        while (totalFlow < flow) {
            var prevEdges = FindShortestPathTree(source);
            if (prevEdges[sink] == null) {
                break;
            }

            long incrementalFlow = flow - totalFlow;
            for (var e = prevEdges[sink]; e != null; e = prevEdges[e.From]) {
                incrementalFlow = Math.Min(incrementalFlow, e.Residue);
            }
            for (var e = prevEdges[sink]; e != null; e = prevEdges[e.From]) {
                if (e.Reverse == null) {
                    var reverseEdge = new Edge(e.To, e.From, 0, -e.Cost) {
                        Reverse = e
                    };
                    e.Reverse = reverseEdge;
                    adjacents[e.To].Add(reverseEdge);
                }
                totalCost += e.Cost * incrementalFlow;
                e.Flow += incrementalFlow;
                e.Reverse.Flow -= incrementalFlow;
            }
            totalFlow += incrementalFlow;
        }
        return new MinCostFlowResult { TotalCost = totalCost, TotalFlow = totalFlow };
    }
}
// PREWRITEN CODE BEGINS FROM HERE

static public class StringExtensions {
    static public string JoinToString<T>(this IEnumerable<T> source, string separator = " ") {
        return string.Join(separator, source);
    }
}

internal partial class Solver : Scanner {
    static readonly int? StackSizeInMebiByte = null; //50;
    public static void StartAndJoin(Action action, int maxStackSize) {
        var thread = new Thread(new ThreadStart(action), maxStackSize);
        thread.Start();
        thread.Join();
    }

    public static void Main() {
#if LOCAL
        byte[] inputBuffer = new byte[1000000];
        var inputStream = Console.OpenStandardInput(inputBuffer.Length);
        using (var reader = new StreamReader(inputStream, Console.InputEncoding, false, inputBuffer.Length)) {
            Console.SetIn(reader);
            new Solver(Console.In, Console.Out).Run();
        }
#else
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        if (StackSizeInMebiByte.HasValue) {
            StartAndJoin(() => new Solver(Console.In, Console.Out).Run(), StackSizeInMebiByte.Value * 1024 * 1024);
        } else {
            new Solver(Console.In, Console.Out).Run();
        }
        Console.Out.Flush();
#endif
    }

#pragma warning disable IDE0052
    private readonly TextReader cin;
    private readonly TextWriter cout;
    private readonly TextWriter cerr;
#pragma warning restore IDE0052

    public Solver(TextReader reader, TextWriter writer)
        : base(reader) {
        cin = reader;
        cout = writer;
        cerr = Console.Error;
    }

    public Solver(string input, TextWriter writer)
        : this(new StringReader(input), writer) {
    }

#pragma warning disable IDE1006
#pragma warning disable IDE0051
    private int ni() { return NextInt(); }
    private int[] ni(int n) { return NextIntArray(n); }
    private long nl() { return NextLong(); }
    private long[] nl(int n) { return NextLongArray(n); }
    private double nd() { return NextDouble(); }
    private double[] nd(int n) { return NextDoubleArray(n); }
    private string ns() { return Next(); }
    private string[] ns(int n) { return NextArray(n); }
#pragma warning restore IDE1006
#pragma warning restore IDE0051
}

#if DEBUG
internal static class LinqPadExtension {
    public static string TextDump<T>(this T obj) {
        if (obj is IEnumerable) return (obj as IEnumerable).Cast<object>().JoinToString().Dump();
        else return obj.ToString().Dump();
    }
    public static T Dump<T>(this T obj) {
        return LINQPad.Extensions.Dump(obj);
    }
}
#endif

public class Scanner {
    private readonly TextReader Reader;
    private readonly CultureInfo ci = CultureInfo.InvariantCulture;

    private readonly char[] buffer = new char[2 * 1024];
    private int cursor = 0, length = 0;
    private string Token;
    private readonly StringBuilder sb = new StringBuilder(1024);

    public Scanner()
        : this(Console.In) {
    }

    public Scanner(TextReader reader) {
        Reader = reader;
    }

    public int NextInt() { return checked((int)NextLong()); }
    public long NextLong() {
        var s = Next();
        long r = 0;
        int i = 0;
        bool negative = false;
        if (s[i] == '-') {
            negative = true;
            i++;
        }
        for (; i < s.Length; i++) {
            r = r * 10 + (s[i] - '0');
#if DEBUG
            if (!char.IsDigit(s[i])) throw new FormatException();
#endif
        }
        return negative ? -r : r;
    }
    public double NextDouble() { return double.Parse(Next(), ci); }
    public string[] NextArray(int size) {
        string[] array = new string[size];
        for (int i = 0; i < size; i++) {
            array[i] = Next();
        }

        return array;
    }
    public int[] NextIntArray(int size) {
        int[] array = new int[size];
        for (int i = 0; i < size; i++) {
            array[i] = NextInt();
        }

        return array;
    }

    public long[] NextLongArray(int size) {
        long[] array = new long[size];
        for (int i = 0; i < size; i++) {
            array[i] = NextLong();
        }

        return array;
    }

    public double[] NextDoubleArray(int size) {
        double[] array = new double[size];
        for (int i = 0; i < size; i++) {
            array[i] = NextDouble();
        }

        return array;
    }

    public string Next() {
        if (Token == null) {
            if (!StockToken()) {
                throw new Exception();
            }
        }
        var token = Token;
        Token = null;
        return token;
    }

    public bool HasNext() {
        if (Token != null) {
            return true;
        }

        return StockToken();
    }

    private bool StockToken() {
        while (true) {
            sb.Clear();
            while (true) {
                if (cursor >= length) {
                    cursor = 0;
                    if ((length = Reader.Read(buffer, 0, buffer.Length)) <= 0) {
                        break;
                    }
                }
                var c = buffer[cursor++];
                if (33 <= c && c <= 126) {
                    sb.Append(c);
                } else {
                    if (sb.Length > 0) break;
                }
            }

            if (sb.Length > 0) {
                Token = sb.ToString();
                return true;
            }

            return false;
        }
    }
}


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

namespace Codeforces
{
    class Program : ProgramBase
    {
        private const long commonMod = 1000000007;

        static void Main(string[] args)
        {
            var p = new Program();
            var x = p.Solve();
            p.Out(x);
        }
        object Solve()
        {
            var s = Read();
            var res = 0;
            for (int i = 0; i < s.Length - 1; i++)
            {
                if (s[i] == 'V' && s[i + 1] == 'K')
                    res++;
            }
            var max = res;
            for (int i = 0; i < s.Length; i++)
            {
                var newS = s.Substring(0, i) + (s[i] == 'V' ? 'K' : 'V') + s.Substring(i + 1, s.Length - i - 1);
                res = 0;
                for (int j = 0; j < s.Length - 1; j++)
                {
                    if (newS[j] == 'V' && newS[j + 1] == 'K')
                        res++;
                }
                max = Math.Max(max, res);
            }
            return max;
        }

    }

    abstract class ProgramBase
    {
        bool? prod = null;
        StreamReader f;
        Queue<string> tokens;
        protected string FileName { private get; set; }

        protected string Read()
        {
            if (f == null)
                f = string.IsNullOrEmpty(FileName)
                    ? new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024 * 10)
                    : new StreamReader((GetProd() ? "" : "c:\\dev\\") + FileName);
            return f.ReadLine();
        }

        protected string ReadToken()
        {
            if (tokens == null || tokens.Count == 0)
                tokens = new Queue<string>(Read().Split(' '));
            return tokens.Dequeue();
        }

        protected long ReadLong() { return long.Parse(ReadToken()); }

        protected long[] ReadLongs()
        {
            var s = Read();
            if (s == "")
                return new long[0];
            //var i = s.IndexOf(' ');
            //return new[] { long.Parse(s.Substring(0, i)), long.Parse(s.Substring(i + 1)) };
            var tokens = s.Split(' ');
            var result = new long[tokens.Length];
            for (int i = 0; i < tokens.Length; i++)
                result[i] = long.Parse(tokens[i]);
            return result;
        }

        public void Out(object r)
        {
            if (string.IsNullOrEmpty(FileName))
                Console.WriteLine(r);
            else if (GetProd())
                File.WriteAllText(FileName, r.ToString());
            else
                Console.WriteLine(r);
        }

        private bool GetProd()
        {

            if (!prod.HasValue)
                try
                {
                    prod = Environment.MachineName != "RENADEEN-W7";
                }
                catch (Exception)
                {
                    prod = true;
                }
            return prod.Value;
        }
    }

    public static class Huj
    {
        public static T MinBy<T>(this IEnumerable<T> source, Func<T, double> func) where T : class
        {
            T result = null;
            var min = double.MaxValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (min > current)
                {
                    min = current;
                    result = item;
                }
            }
            return result;
        }

        public static T MaxBy<T>(this IEnumerable<T> source, Func<T, double> func, T defaultValue = default(T))
        {
            T result = defaultValue;
            var max = double.MinValue;
            foreach (var item in source)
            {
                var current = func(item);
                if (max < current)
                {
                    max = current;
                    result = item;
                }
            }
            return result;
        }

        public static string JoinStrings(this IEnumerable<string> s, string d) { return string.Join(d, s.ToArray()); }

        public static string JoinStrings(this IEnumerable<int> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
        public static string JoinStrings(this IEnumerable<long> s, string d) { return s.Select(x => x.ToString()).JoinStrings(d); }
    }
    class DSU
    {
        private int[] arr;
        private Random r = new Random();
        public DSU(int n)
        {
            arr = new int[n];
            for (int i = 0; i < n; i++)
            {
                arr[i] = i;
            }
        }

        public int Find(int x)
        {
            if (arr[arr[x]] == arr[x])
                return arr[x];
            var y = Find(arr[x]);
            arr[x] = y;
            return y;
        }

        public void Union(int x, int y)
        {
            var p1 = Find(x);
            var p2 = Find(y);
            if (p1 == p2)
                return;
            if (r.NextDouble() < 0.5)
                arr[p1] = p2;
            else
                arr[p2] = p1;
        }

        public Tuple<int, int>[] Enumerate()
        {
            return arr.Select((x, i) => new { g = Find(x), i }).GroupBy(x => x.g, (k, e) => Tuple.Create(k, e.Count())).ToArray();
        }
    }

}


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

namespace NetExperiment
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nm = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int[] x = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int[] y = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            foreach(var i in x)
            {
                if (y.Contains(i))
                    Console.Write(i + " ");
            }
        }
    }
}


using System;

public class Program
{
	public static void Main()
	{
		var num = int.Parse(Console.ReadLine());
		if(num%2 == 0){
			Console.WriteLine(0);
		}else{
			Console.WriteLine(1);
		}
	}
}


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

namespace Algrithom.CodeForces
{
    class _1286A_Garland
    {
        static int getminparity(int n, int[] aa)
        {
            if (n == 1)
                return 0;

            int oddCnt = n / 2 + n % 2;
            int evenCnt = n / 2;

            /*
            foreach(int a in aa)
            {
                if (a == 0)
                    continue;
                if (a % 2 == 0)
                    evenCnt--;
                else
                    oddCnt--;
            }
            */

            //int[,,,] memo = new int[n, (n / 2 + n % 2) + 1, (n / 2) + 1, 2];
            int[,,] memo = new int[2, oddCnt + 1, evenCnt + 1];
            for (int i = 0; i < memo.GetLength(0); i++)
                for (int j = 0; j < memo.GetLength(1); j++)
                    for (int k = 0; k < memo.GetLength(2); k++)
                        //for (int l = 0; l < memo.GetLength(3); l++)
                        //memo[i, j, k, l] = -1;
                        memo[i, j, k] = -1;

            if(aa[0] == 0)
            {
                int v1 = int.MaxValue;
                int v2 = int.MaxValue;

                if (oddCnt > 0)
                    v1 = dfs(1, oddCnt - 1, evenCnt, 1, aa, memo);
                if (evenCnt > 0)
                    v2 = dfs(1, oddCnt, evenCnt - 1, 0, aa, memo);

                if (v1 != -2 && v2 != -2)
                    return Math.Min(v1, v2);
                else if (v1 != -2)
                    return v1;
                else
                    return v2;
            }
            else
                if(aa[0] % 2 == 0)
                    return dfs(1, oddCnt, evenCnt-1, aa[0]%2, aa, memo);
                else
                    return dfs(1, oddCnt-1, evenCnt, aa[0] % 2, aa, memo);
        }

        //preParity 1: odd, 0: even

        static int dfs(int idx, int oddCnt, int evenCnt, int preParity, int[] aa, int[,,] memo)
        {
            if (idx == aa.Length && oddCnt == 0 && evenCnt == 0)
                return 0;

            if (oddCnt < 0 || evenCnt < 0)
                return -2;

            if (memo[preParity, oddCnt, evenCnt] != -1)
                return memo[preParity, oddCnt, evenCnt];

            int v;
            if(aa[idx] == 0)
            {
                int v1 = -2;
                int v2 = -2;

                if (oddCnt > 0)
                {
                    v1 = dfs(idx + 1, oddCnt - 1, evenCnt, 1, aa, memo);
                    if (v1 != -2)
                        v1 += (preParity == 0 ? 1 : 0);
                }
                if (evenCnt > 0)
                {
                    v2 = dfs(idx + 1, oddCnt, evenCnt - 1, 0, aa, memo);
                    if (v2 != -2)
                        v2 += (preParity == 0 ? 0 : 1);
                }

                if (v1 != -2 && v2 != -2)
                    v = Math.Min(v1, v2);
                else if (v1 != -2)
                    v = v1;
                else if (v2 != -2)
                    v = v2;
                else
                    v = -2;
            }
            else
            {
                if(aa[idx] % 2 == 0)
                    v = dfs(idx + 1, oddCnt, evenCnt-1, aa[idx] % 2, aa, memo);
                else
                    v = dfs(idx + 1, oddCnt-1, evenCnt, aa[idx] % 2, aa, memo);

                if (v != -2 && aa[idx] % 2 != preParity)
                    v++;
            }

            memo[preParity, oddCnt, evenCnt] = v;
            return v;
        }

        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine().Trim());
            int[] aa = Array.ConvertAll(Console.ReadLine().Trim().Split(' '), tmp => Convert.ToInt32(tmp));

            int res = getminparity(n, aa);

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


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

namespace Tasks
{
    class Program
    {
        static void Main(string[] args)
        {
            //Ввод
            string[] input = Console.ReadLine().Split();

            int Distance = int.Parse(input[0]), CurrentFuel = int.Parse(input[1]), GasStation = int.Parse(input[2]), TotalRuns = int.Parse(input[3]);
            int MaxFuel = CurrentFuel;
            int Distance_B2GS = Distance - GasStation;
            int GasPerKm = 1;
            bool isForward = true;
            int count = 0;
            //Часть переменных для
            for (int i = 1; i <= TotalRuns; i++)
            {
                if (i != TotalRuns)
                {
                    //Если поездка вперед
                    if (isForward)
                    {
                        //Если недотягиваем даже до заправки, увы и ах
                        if (CurrentFuel < GasPerKm * GasStation) { Console.WriteLine("-1"); return; }

                        if ((CurrentFuel - GasStation * GasPerKm) < 2 * GasPerKm * (Distance_B2GS))
                        {
                            CurrentFuel = MaxFuel - (Distance_B2GS) * GasPerKm;
                            count++;
                        }
                        else
                        {
                            CurrentFuel -= Distance * GasPerKm;
                        }
                    }
                    else //едем назад
                    {
                        //Проверим, дотянем ли до заправки
                        if (CurrentFuel < GasPerKm * Distance_B2GS) { Console.WriteLine("-1"); return; }

                        if ((CurrentFuel - GasPerKm * Distance_B2GS) < 2 * GasPerKm * (GasStation))
                        {
                            CurrentFuel = MaxFuel - GasPerKm * GasStation;
                            count++;
                        }
                        else
                        {
                            CurrentFuel -= Distance * GasPerKm;

                        }
                    }
                    isForward = !isForward;
                }
                else
                {
                    //Последний круг, прямо
                    if (isForward)
                    {
                        if ((CurrentFuel < GasPerKm * GasStation)||(CurrentFuel<GasPerKm*Distance_B2GS)) { Console.WriteLine("-1");return; }
                        if (CurrentFuel < GasPerKm * Distance)
                            count++;
                    }
                    else
                    {
                        if (CurrentFuel < GasPerKm * Distance_B2GS)
                        { Console.WriteLine("-1"); return; }
                        if (CurrentFuel < GasPerKm * Distance) count++;
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}


using System;

class Program{
    public static void Main(){
       string[] numbers = Console.ReadLine().Split(new char[] {' '});

       int n = Convert.ToInt32(numbers[0]);
       int k = Convert.ToInt32(numbers[1]);
       int t = Convert.ToInt32(numbers[2]);

        if (t <= k)
            Console.WriteLine(t);
        else if (t <= n)
            Console.WriteLine(k);
        else
            Console.WriteLine(n + k - t);
    }
}


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

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

        private static void Main(string[] args)
        {
            int n = Next();
            int m = Next();

            int l = 1, r = 5000000;
            while (l < r)
            {
                int mid = (l + r)/2;

                int d6 = mid/6;
                int d2 = mid/2 - d6;
                int d3 = mid/3 - d6;

                if (d6 >= (Math.Max(0, n - d2) + Math.Max(0, m - d3)))
                {
                    r = mid;
                }
                else
                {
                    l = mid + 1;
                }
            }

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

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


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

namespace A.Friends_Meeting
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int b = int.Parse(Console.ReadLine());
            int total = 0;
            int s = (Math.Abs(a - b)) / 2;
            for (int i = 1; i <= s; i++)
            {
                total += i;
            }
            if (Math.Abs(a - b) % 2 == 0){
                total*=2;
            }
            else
            {
                for (int i = 1; i <= Math.Abs(a - b)-s; i++)
                {
                    total += i;
                }
            }
            Console.WriteLine(total);
        }
    }
}


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

namespace KingOfThieves
{
	internal class Program
	{
		private static void Main(string[] args)
		{
			var input = args.Length == 0 ? new Input() : new Input(args[0]);

			var n = int.Parse(input.ReadLine());
			var items = new List<bool>(n);
			items.AddRange(input.ReadLine().Select(c => c == '*'));

			for (var i = 0; i < n - 4; i++)
			{
				if (items[i])
				{
					for (var j = i + 4; j < n; j += 4)
					{
						if (items[j])
						{
							var step = (j - i)/4;
							if (items[i + step] && items[j - step] && items[i + 2*step])
							{
								Console.WriteLine("yes");
								return;
							}
						}
					}
				}
			}
			Console.WriteLine("no");
		}

		private class Input
		{
			private readonly StreamReader _reader;

			public Input()
			{
			}

			public Input(string fileName)
			{
				_reader = new StreamReader(fileName);
			}

			public string ReadLine()
			{
				var line = _reader == null ? Console.ReadLine() : _reader.ReadLine();
				Console.Error.WriteLine(line);
				return line;
			}
		}
	}
}


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

class A
{
    private static string NextToken()
    {
        StringBuilder result = new StringBuilder();
        while (true)
        {
            int c = Console.Read();
            if (c == -1)
                return result.ToString();
            if (char.IsWhiteSpace((char)c))
            {
                if (result.Length > 0)
                {
                    return result.ToString();
                }
            }
            else
            {
                result.Append((char)c);
            }
        }
    }

    private static int NextInt()
    {
        return int.Parse(NextToken());
    }

    private static double NextDouble()
    {
        return double.Parse(NextToken());
    }

    static void Solve()
    {
        int n = NextInt();
        int c = NextInt();
        int[] x = new int[n];
        for (int i = 0; i < n; i++)
        {
            x[i] = NextInt();
        }
        int answer = 0;
        for (int i = 0; i < n - 1; i++)
        {
            int profit = x[i] - x[i + 1] - c;
            if (profit > answer)
                answer = profit;
        }
        Console.WriteLine(answer);
    }

    static void Main(string[] args)
    {
        //using (var reader = new StreamReader(new FileStream("a.in", FileMode.OpenOrCreate, FileAccess.Read)))
        //{
        //    Console.SetIn(reader);
        //    using (var writer = new StreamWriter(new FileStream("a.out", FileMode.Create, FileAccess.Write)))
        //    {
        //        Console.SetOut(writer);
                Solve();
        //    }
        //}
    }
}


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

public class Source
{
    public void Program()
    {
    }
    void Read()
    {
        int s = ri(), start = ri(), end = ri();
        int t1 = ri(), t2 = ri();
        int p = ri(), d = ri();
        int time1 = 0;
        while (true)
        {
            if (d == 1)
            {

                if (start >= p && start <= end)
                {
                    time1 = time1 + Math.Abs(p - end);
                    break;
                }else
                {
                    time1 += s - p;
                    p = s;

                }
            }
            else
            {

                if (start <= p && start >= end)
                {
                    time1 = time1 + Math.Abs(p - end);
                    break;
                }
                else
                {
                    time1 += p;
                    p = 0;

                }

            }
            d *= -1;
        }
        time1 *= t1;
            int time2 = Math.Abs(end - start) * t2;
        writeLine(Math.Min(time1, time2));

    }

    #region hide it
    #region Main

    protected static TextReader reader;
    protected static TextWriter writer;
    static void Main()
    {
#if DEBUG
        reader = new StreamReader("..\\..\\input.txt");
        //reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;
        //writer = new StreamWriter("..\\..\\output.txt");
#else
            reader = new StreamReader(Console.OpenStandardInput());
            writer = new StreamWriter(Console.OpenStandardOutput());
            //reader = new StreamReader("input.txt");
            //writer = new StreamWriter("output.txt");
#endif
        var source = new Source();
        source.Read();
        source.Program();

        /* try
         {
             new Source().Program();
         }
         catch (Exception ex)
         {
 #if DEBUG
             Console.WriteLine(ex);
 #else
             throw;
 #endif
         }*/
        reader.Close();
        writer.Close();
    }

    #endregion

    #region Read / Write
    private static Queue<string> currentLineTokens = new Queue<string>();
    private static string[] ReadAndSplitLine() { return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries); }
    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }
    public static int ri() { return int.Parse(ReadToken()); }
    public static char ReadChar() { return char.Parse(ReadToken()); }
    public static long ReadLong() { return long.Parse(ReadToken()); }
    public static ulong ReaduLong() { return ulong.Parse(ReadToken()); }
    public static double ReadDouble() { return double.Parse(ReadToken(), CultureInfo.InvariantCulture); }
    public static int[] ReadIntArray() { return ReadAndSplitLine().Select(i => int.Parse(i)).ToArray(); }
    public static char[] ReadCharArray() { return ReadAndSplitLine().Select(i => char.Parse(i)).ToArray(); }
    public static char[] SplitToChar() { string s = ReadToken(); char[] r = new char[s.Length]; for (int i = 0; i < s.Length; i++) r[i] = s[i]; return r; }
    public static byte[] SplitToByte() { string s = ReadToken(); byte[] r = new byte[s.Length]; for (int i = 0; i < s.Length; i++) r[i] = (byte)s[i]; return r; }
    public static double[] ReadDoubleArray() { return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray(); }
    public static int[][] ReadIntMatrix(int numberOfRows) { int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix; }
    public static char[][] ReadCharMatrix(int numberOfRows) { char[][] matrix = new char[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadCharArray(); return matrix; }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
        return ret;
    }
    public static string[] ReadLines(int quantity) { string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines; }
    public static void write<T>(T value) { writer.Write(value); }
    public static void writeLine<T>(T value) { writer.WriteLine(value); }
    public static void writeArray<T>(T[] array, string split) { for (int i = 0; i < array.Length; i++) { write(array[i] + split); } }
    public static void writeMatrix<T>(T[][] matrix, string split) { for (int i = 0; i < matrix.Length; i++) { writeArray(matrix[i], split); writer.Write("\n"); } }
    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }
    private static T[] Init<T>(int size) where T : new() { var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret; }
    #endregion

    #region Methods
    #region DSU
    public void MakeSet(int[] poi)
    {
        for (int i = 0; i < poi.Length; i++)
        {
            poi[i] = i;
        }
    }
    public int Find(int x, int[] poi)
    {
        if (poi[x] == x) return x;
        return poi[x] = Find(poi[x], poi);
    }
    Random rand = new Random();
    public void Unite(int x, int y, int[] poi)
    {
        y = Find(y, poi);
        x = Find(x, poi);
        if (rand.Next() % 2 == 0)
            Swap(ref x, ref y);
        poi[x] = y;
    }
    #endregion

    class Deque<T>
    {
        T[] array;
        int start, length;
        public Deque()
        {
            start = 0; length = 0; array = new T[1];
        }
        public T this[int index] { get { return array[(start + index) % array.Length]; } set { array[(start + index) % array.Length] = value; } }
        int last { get { return (start + length) % array.Length; } }
        /// <summary>
        /// ÃÆÃ¢â¬ËÃâÃÂÃÆÃ¢â¬ËÃÂ¢Ã¢âÂ¬Ã
        /// </summary>
        public T PeekFirst()
        {
            return array[start];
        }
        public int Count { get { return length; } }
        /// <summary>
        /// ÃÆÃÂÃâÃÂºÃÆÃÂÃâÃÂ¾ÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂµÃÆÃ¢â¬ËÃÂ¢Ã¢âÂ¬  ÃÆÃÂÃâÃÂ±ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ· ÃÆÃ¢â¬ËÃâ Ã¢â¬â¢ÃÆÃÂÃâÃÂ´ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂ¸ÃÆÃ¢â¬ËÃâÃÂ
        /// </summary>
        public T PeekLsat()
        {
            return array[last];
        }
        public T PopLast()
        {
            if (length == 0)
                throw new IndexOutOfRangeException("OutOfRange");
            length--;
            return array[last];
        }
        public T PopFirst()
        {
            if (length == 0)
                throw new IndexOutOfRangeException("OutOfRange");
            length--;
            if (start >= array.Length - 1) start = 0; else start++;
            return array[start - 1 < 0 ? array.Length - 1 : start - 1];
        }
        public void AddFirst(T value)
        {
            IncreaseAndInspection();
            if (start <= 0) start = array.Length - 1; else start--;
            array[start] = value;
            length++;
        }
        public void AddLast(T value)
        {
            IncreaseAndInspection();
            array[last] = value;
            length++;
        }
        bool overflow { get { return length == array.Length; } }
        void IncreaseAndInspection()
        {
            if (overflow)
                increase();

        }
        void increase()
        {
            T[] array2 = new T[array.Length * 2];
            for (int i = 0; i < array.Length; i++)
            {
                int pos = (start + i) % array.Length;
                array2[i] = array[pos];
            }
            array = array2;
            start = 0;
            array2 = null;
        }
        public void Clear()
        {
            start = 0; length = 0; array = new T[1];
        }
    }
    class Heap<T>
    {
        Comparison<T> ic;
        List<T> storage = new List<T>();
        public Heap(Comparison<T> ic)
        {
            this.ic = ic;
        }
        public void Add(T element)
        {
            storage.Add(element);
            int pos = storage.Count - 1;
            while (pos != 0 && ic(storage[((int)(pos - 1) >> 1)], element) > 0)
            {
                Swap(storage, pos, ((int)(pos - 1) / 2));
                pos = ((int)(pos - 1) / 2);
            }
        }
        public T Pop()
        {
            T t = storage[0];
            Swap(storage, 0, storage.Count - 1);
            int pos = 0;
            storage.RemoveAt(storage.Count - 1);
            if (Count > 0)
                while (true)
                {
                    T my = storage[pos];
                    if (pos * 2 + 1 >= Count)
                        break;
                    T left = storage[pos * 2 + 1];
                    if (pos * 2 + 2 >= Count)
                    {
                        if (ic(left, my) < 0)
                        {
                            Swap(storage, pos, pos * 2 + 1);
                            pos = pos * 2 + 1;
                        }
                        break;
                    }
                    T right = storage[pos * 2 + 2];
                    if (ic(left, my) < 0 || ic(right, my) < 0)
                    {
                        if (ic(left, right) < 0)
                        {
                            Swap(storage, pos, pos * 2 + 1);
                            pos = pos * 2 + 1;
                        }
                        else
                        {

                            Swap(storage, pos, pos * 2 + 2);
                            pos = pos * 2 + 2;
                        }
                    }
                    else break;
                }
            return t;
        }

        public void Clear()
        {
            storage.Clear();
        }
        /// <summary>
        /// ÃÆÃÂÃâÃÂ±ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ· ÃÆÃ¢â¬ËÃâ Ã¢â¬â¢ÃÆÃÂÃâÃÂ´ÃÆÃÂÃâÃÂ°ÃÆÃÂÃâÃÂ»ÃÆÃÂÃâÃÂµÃÆÃÂÃâÃÂ½ÃÆÃÂÃâÃÂ¸ÃÆÃ¢â¬ËÃâÃÂ
        /// </summary>
        /// <returns></returns>
        public T Peek()
        {
            return storage[0];
        }
        public int Count
        {
            get { return storage.Count; }
        }
        //void RemoveLast, Size, peeklast, add
    }
    static void Swap<T>(ref T lhs, ref T rhs)
    {
        T temp;
        temp = lhs;
        lhs = rhs;
        rhs = temp;
    }
    static void Swap<T>(T[] a, int l, int r)
    {
        T temp;
        temp = a[l];
        a[l] = a[r];
        a[r] = temp;
    }
    static void Swap<T>(List<T> a, int l, int r)
    {
        T temp;
        temp = a[l];
        a[l] = a[r];
        a[r] = temp;
    }

    bool outregion(long y, long x, long n, long m)
    {
        if (x < 0 || x >= m || y < 0 || y >= n)
            return true;
        return false;
    }
    static void initlist<T>(ref List<T>[] list, int n)
    {
        list = new List<T>[n];
        for (int i = 0; i < n; i++)
            list[i] = new List<T>();
    }
    static void newarray<T>(ref T[][] array, int n, int m)
    {
        array = new T[n][];
        for (int i = 0; i < n; i++)
            array[i] = new T[m];
    }
    static void newarray<T>(ref T[] array, int n)
    {
        array = new T[n];
    }
    static void fill<T>(T[] array, T value)
    {
        for (int i = 0; i < array.Length; i++)
            array[i] = value;
    }
    static void fill<T>(T[][] array, T value)
    {
        for (int i = 0; i < array.Length; i++)
            for (int j = 0; j < array[i].Length; j++)
                array[i][j] = value;
    }
    public bool NextPermutation<T>(T[] b, Comparison<T> ic)
    {
        for (int j = b.Length - 2; j >= 0; j--)
        {
            if (ic(b[j], b[j + 1]) < 0)
            {
                for (int l = b.Length - 1; l >= 0; l--)
                {
                    if (ic(b[l], b[j]) > 0)
                    {
                        Swap(b, j, l);
                        Array.Reverse(b, j + 1, b.Length - (j + 1));
                        return true;
                    }
                }
            }
        }
        return false;
    }
    int[,] step8 = new int[,]
    {
        {-1,0 },
        {1,0 },
        {0,-1 },
        {0,1 },
        {1,1 },
        {-1,1 },
        {-1,-1 },
        {1,-1 },
    };
    int[,] step4 = new int[,]
    {
        {-1,0 },
        {1,0 },
        {0,-1 },
        {0,1 },
    };
    struct Vector2
    {
        public double x;
        public double y;
        public Vector2(double x, double y)
        {
            this.x = x;
            this.y = y;
        }
        public double Dist(Vector2 to)
        {
            return Math.Sqrt(Math.Abs(Math.Pow(to.x - x, 2)) + Math.Abs(Math.Pow(to.y - y, 2)));
        }
        public static bool operator ==(Vector2 left, Vector2 right) { return left.x == right.x && left.y == right.y; }
        public static bool operator !=(Vector2 left, Vector2 right) { return left.x != right.x || left.y != right.y; }
    }
    #endregion
    #endregion

}


using System;

namespace ConsoleApplication5
{
    class Program
    {
        static long poisk(long x, long y, long z)
        {
            if (x < y && x < z)
                return x;
            else
            {
                if (y < x && y < z)
                    return y;
                else
                    return z;
              }
        }

        static void Main(string[] args)
        {
            string s = Console.ReadLine();
            var s1 = s.Split(' ');
            long n = long.Parse(s1[0]);
            long a = long.Parse(s1[1]);
            long b = long.Parse(s1[2]);
            long c = long.Parse(s1[3]);
            if (n % 4 == 0)
                Console.WriteLine (0);
            else
            {
                if (n % 4 == 1)
                    Console.WriteLine(poisk(c, 3 * a, a + b));
                else
                {
                    if (n % 4 == 2)
                        Console.WriteLine(poisk(b, 2 * a, 2 * c));
                    else
                        Console.WriteLine(poisk(a, 3 * c, c + b));
                }
            }
            Console.ReadLine();
        }
    }
}


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

namespace Code
{
    class Program
    {
        static void Main(string[] args)
        {
            string a = Console.ReadLine();
            int n = int.Parse(a.Split(' ')[0]);
            int k = int.Parse(a.Split(' ')[1]);
            string s = Console.ReadLine();
            for (int i = 0; i < s.Length; i++)
            {
                int c = 0;
                for (int j = 0; j < s.Length; j++)
                {
                    if (s[i] == s[j])
                        c++;
                }
                if (c > k)
                {
                    Console.Write("NO");
                    return;
                }
                c = 0;
            }
            Console.WriteLine("YES");

        }
    }
}


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

namespace ConsoleApp8
{
    class Program
    {
        static void Main(string[] args)
        {
            int b;

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

            int[] temp = new int[n];

            string[] tempStr = new string[n];

            string str = Console.ReadLine();

            char[] split = { ' ' };

            tempStr = str.Split(split);

            for (int k = 0; k <= n - 1; k++)
            {
                temp[k] = Convert.ToInt32(tempStr[k]);
            }

            int m = temp[0] - temp[1];
            b = 0;

            for (int k = 0; k <= n - 2; k++)
            {
                if (temp[k] - temp[k + 1] == m)
                {
                    b = b + 1;
                }
            }

            if (n > 2)
            {
                if (b == n - 1 && temp[n - 1] - temp[n - 2] == temp[n - 2] - temp[n - 3])
                {
                    Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);
                }
                else
                {
                    Console.WriteLine(temp[n - 1]);
                }
            }
            else
            {
                Console.WriteLine(temp[n - 1] + temp[n - 1] - temp[n - 2]);
            }
        }
    }
}


using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using CompLib.Util;

public class Program
{
    private int N;
    private List<(int to, int num)>[] E;
    private int[] U, V;
    private int Max;

    private int R;
    private bool[] IsX;
    private bool Found;
    private int XSize;

    private int[] Len;
    private int[] Dist;
    private int TmpX;
    private int TmpY;

    void Scan()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        E = new List<(int to, int num)>[N];
        U = new int[N - 1];
        V = new int[N - 1];
        for (int i = 0; i < N; i++)
        {
            E[i] = new List<(int to, int num)>();
        }

        for (int i = 0; i < N - 1; i++)
        {
            int u = sc.NextInt() - 1;
            int v = sc.NextInt() - 1;
            U[i] = u + 1;
            V[i] = v + 1;
            E[u].Add((v, i));
            E[v].Add((u, i));
        }

        Max = 2 * N * N / 9;
    }

    void SetFlag(int cur, int par)
    {
        foreach ((int to, int num) e in E[cur])
        {
            if (e.to == par) continue;
            SetFlag(e.to, cur);
        }

        IsX[cur] = true;
    }

    int Go(int cur, int par)
    {
        var ls = new List<(int to, int size)>();
        int size = 1;
        foreach (var e in E[cur])
        {
            if (e.to == par) continue;
            int tmp = Go(e.to, cur);
            ls.Add((e.to, tmp));
            size += tmp;
        }

        if (par != -1)
        {
            ls.Add((par, N - size));
        }

        if (!Found)
        {
            bool[,] dp = new bool[ls.Count + 1, N];
            dp[0, 0] = true;
            for (int i = 0; i < ls.Count; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    if (dp[i, j])
                    {
                        dp[i + 1, j] = true;
                        dp[i + 1, j + ls[i].size] = true;
                    }
                }
            }

            int x = -1;
            for (int i = 0; i < N; i++)
            {
                if (!dp[ls.Count, i]) continue;
                int y = N - 1 - i;
                if (Max < (i + 1) * (y + 1))
                {
                    x = i;
                    break;
                }
            }

            if (x != -1)
            {
                XSize = x;
                R = cur;
                for (int i = ls.Count - 1; i >= 0; i--)
                {
                    if (x - ls[i].size >= 0 && dp[i, x - ls[i].size])
                    {
                        SetFlag(ls[i].to, cur);
                        x -= ls[i].size;
                    }
                }

                Found = true;
            }
        }

        return size;
    }

    // r、x,yの頂点を決める
    void SearchR()
    {
        IsX = new bool[N];
        Found = false;
        Go(0, -1);
        if (!Found) throw new Exception();
    }

    // 現在地、親、par-curが辺num
    void SetX(int cur, int par, int num)
    {
        Dist[cur] = TmpX++;
        if (par != -1)
        {
            Len[num] = Dist[cur] - Dist[par];
        }

        foreach ((int to, int num) e in E[cur])
        {
            if (e.to == par) continue;
            if (!IsX[e.to]) continue;
            SetX(e.to, cur, e.num);
        }
    }

    void SetY(int cur, int par, int num)
    {
        Dist[cur] = TmpY;
        TmpY += (XSize + 1);
        if (par != -1)
        {
            Len[num] = Dist[cur] - Dist[par];
        }

        foreach ((int to, int num) e in E[cur])
        {
            if (e.to == par) continue;
            if (IsX[e.to]) continue;
            SetY(e.to, cur, e.num);
        }
    }

    void SetLen()
    {
        // 辺の長さ
        Len = new int[N - 1];
        // R->頂点までの距離
        Dist = new int[N];
        // X側の頂点はRに近い順に距離1~Xを割り当てる
        // それぞれの頂点までの距離になるように辺の長さを割り当てる
        TmpX = 0;
        SetX(R, -1, -1);

        // Y (X+1)刻みで割り当てる
        TmpY = 0;
        SetY(R, -1, -1);
    }

    void Write()
    {
        var sb = new StringBuilder();
        for (int i = 0; i < N - 1; i++)
        {
            sb.AppendLine($"{U[i]} {V[i]} {Len[i]}");
        }

        Console.Write(sb);
    }

    public void Solve()
    {
        // ある頂点rを境目に2つに分ける
        // 片方x個 もう片方 y個 x + y + 1 = N
        // 片方でrからの距離 0~xをつくる
        // 残り x+1刻みで y個
        // 0 <= p < (x+1)(y+1)できる

        Scan();
        SearchR();
        SetLen();
        Write();
    }

    public static void Main(string[] args)
    {
        new Thread(new ThreadStart(new Program().Solve), 1 << 27).Start();
    }
}

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

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

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

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

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

            return _line[_index++];
        }

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

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

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


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

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

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

            // Число фильтров, устройств, розеток
            int n = int.Parse(string1[0]);
            int m = int.Parse(string1[1]);
            int k = int.Parse(string1[2]);

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

            int[] mass = new int[n];
            for (int i = 0; i < n; i++)
            {
                mass[i] = int.Parse(string2[i]);
            }
            Array.Sort(mass);
            Array.Reverse(mass);

            // Число свободных розеток
            int free;

            // Только розетки
            free = k;

            if (free >= m)
            {
                Console.WriteLine(0);
                return;
            }

            for (int j = 1; j <= n; j++)
            {
                int sum = 0;
                for (int g = 0; g < j; g++)
                {
                    sum += mass[g];
                }
                free = k - j + sum;

                if (free >= m)
                {
                    Console.WriteLine(j);
                    return;
                }
            }

            Console.WriteLine(-1);
            return;
        }
    }
}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace codeforces
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			string[] s = Console.ReadLine ().Split (' ');
			int a = int.Parse (s [0]);
			int b = int.Parse (s [1]);
			int c = int.Parse (s [2]);
			s = Console.ReadLine ().Split (' ');
			int x = int.Parse (s [0]);
			int y = int.Parse (s [1]);
			int z = int.Parse (s [2]);
			int e1 = Math.Abs (a - x), e2 = Math.Abs (b - y), e3 = Math.Abs (c - z);
			int p=0,m=0;

			if (a >= x)
				p+= e1 / 2;
			else
				m+=e1;

			if (b >= y)
				p+= e2 / 2;
			else
				m+=e2;

			if (c >= z)
				p+= e3 / 2;
			else
				m+=e3;
			if(p>=m)
				Console.WriteLine ("Yes");
			else
				Console.WriteLine ("No");

		}
	}
}


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

namespace denemexxxx
{
    class Program
    {
        static void Main(string[] args)
        {
           try {
                string[] rule = new string[3];
                char[] x = new char[3];
                for (int i = 0; i < 3; i++)
                {
                    x = Console.ReadLine().ToCharArray();
                    if (x[1] == '<')
                    {
                        x[1] = '>';
                        Array.Reverse(x);
                        string s = new string(x);
                        rule[i] = s;

                    }
                    else
                    {
                        string s = new string(x);
                        rule[i] = s;
                    }
                }
                int[] sayi = new int[3];
                for (int i = 0; i < 3; i++)
                {
                    string s = "";
                    s = rule[i];
                    if (s[0] == 'A')
                        sayi[0]++;
                    else if (s[0] == 'B')
                        sayi[1]++;
                    else
                        sayi[2]++;

                }
                string a = "ABC";
                string z = "";
                if (sayi[0] == 2 || sayi[1] == 2 || sayi[2] == 2)
                {
                    for (int i = 0; i < 3; i++)
                    {
                        for (int j = 0; j < 3; j++)
                        {
                            if (sayi[j] == i) // 2 0 1
                                z += a[j];
                        }
                    }
                    Console.Write(z);
                }
                else
                    Console.Write("Impossible");
                Console.ReadKey();
            }
           catch { }

        }
    }
}


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

namespace CodeForces
{
   class A
   {
      static void Main(string[] args)
      {
        List<int> L = new List<int>();
         int n = int.Parse(Console.ReadLine());
         int to  = (n>100)?n-100:0;
         for(int i=n-1;i>=to;i--){
           if(i + GetSum(i)==n){
              L.Add(i);
           }
         }
         L.Sort();
         Console.WriteLine(L.Count);
         for(int i=0;i<L.Count;i++){
           Console.Write(L[i] + " ");
         }
      }

      static int GetSum(int n){
         int sum = 0;
         string s = n+"";
         for(int i=0;i<s.Length;i++){
           sum += (int)Char.GetNumericValue(s[i]);
         }
         return sum;

      }
   }

}


// A Dynamic Programming based
// C# program to find minimum
// number operations to
// convert str1 to str2
using System;
using System.Collections.Generic;
using System.Linq;
class GFG
{

    public static void Main()
    {
        List<ulong> arr = Console.ReadLine().Split(' ').Select(x => ulong.Parse(x)).ToList<ulong>();
        var op = Console.ReadLine().Split(' ').ToArray();
        Console.Write(SmallestNumber(arr, op, 0, ulong.MaxValue));
    }

    public static ulong SmallestNumber(List<ulong> arr, string[] ope, int opeCount, ulong min)
    {

        if (arr.Count == 1)
            return arr[0];

        for (int i = 0; i < arr.Count; i++)
        {
            for (int j = i + 1; j < arr.Count; j++)
            {
                if (ope[opeCount] == "+")
                {
                    var listNew = new List<ulong>(arr);
                    var tmp = listNew[i] + listNew[j];
                    listNew.RemoveAt(j);
                    listNew.RemoveAt(i);
                    listNew.Add(tmp);
                    min = Math.Min(min, SmallestNumber(listNew, ope, opeCount + 1, min));
                }
                if (ope[opeCount] == "*")
                {
                    var listNew = new List<ulong>(arr);
                    var tmp = listNew[i] * listNew[j];
                    listNew.RemoveAt(j);
                    listNew.RemoveAt(i);

                    listNew.Add(tmp);
                    min = Math.Min(min, SmallestNumber(listNew, ope, opeCount + 1, min));
                }
            }
        }

        //min = Math.Min(min1, min2);
        return min;
    }
}


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)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();

            bool[] ls = new bool[10];
            for (int i = 0; i < s.Length; i++)
            {
                ls[s[i] - '0'] = true;
            }
            bool[] yoko = new bool[3];
            bool[] tate = new bool[4];

            if(ls[0])
            {
                yoko[1] = true;
                tate[3] = true;
            }

            for (int i = 1; i < 10; i++)
            {
                if(ls[i])
                {
                    yoko[(i - 1) % 3] = true;
                    tate[(i - 1) / 3] = true;
                }
            }
            if (tate[3])//0
            {
                if (tate[0])
                {
                    Console.WriteLine("YES");
                    return;
                }
                else
                {
                    Console.WriteLine("NO");
                    return;
                }
            }
            if((tate[0]&&tate[2]) && yoko[0]&&yoko[2])
            {
                if (ls[7] || ls[9])
                {
                    Console.WriteLine("YES");
                    return;
                }
                else
                {
                    Console.WriteLine("NO");
                    return;
                }
            }
            else
            {
                Console.WriteLine("NO");
                return;
            }

        }
    }
}


// 1673 ms      !!!  long is much slower than double

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

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

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

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

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

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

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

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

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

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

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

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

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

            public bool EOF
            {
                get
                {
                    if (Read() == -1) return true;
                    Back();
                    return false;
                }
            }

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

        static void pe()
        {
            Console.WriteLine("???");
            Environment.Exit(0);
        }

        static void re()
        {
            Environment.Exit(55);
        }

        static int nosol()
        {
            Console.WriteLine("ERROR");
            return 0;
        }

        static Stopwatch sw = Stopwatch.StartNew();

        static void Test()
        {
            Random rand = new Random(52345235);
            for (int i = 0; i < 2e6; i++)
            {
            }
        }

        struct Pos
        {
            public int X, Y;

            public Pos(int x, int y)
            {
                X = x; Y = y;
            }

            public Pos(string s)
            {
                X = (int)(s[0] - 'a');
                Y = (int)(s[1] - '0' - 1);
            }

            public bool Neighbor(Pos o)
            {
                return (X != o.X || Y != o.Y) && Math.Abs(X - o.X) <= 1 && Math.Abs(Y - o.Y) <= 1;
            }

        }

        static void LadyaFill(int[,] field, Pos l)
        {
            for (int x = l.X + 1; x < 8; x++)
            {
                int t = field[l.Y, x];
                field[l.Y, x] |= 2;
                if ((t & 1) == 1) break;
            }
            for (int x = l.X - 1; x >= 0; x--)
            {
                int t = field[l.Y, x];
                field[l.Y, x] |= 2;
                if ((t & 1) == 1) break;
            }

            for (int y = l.Y + 1; y < 8; y++)
            {
                int t = field[y, l.X];
                field[y, l.X] |= 2;
                if ((t & 1) == 1) break;
            }

            for (int y = l.Y - 1; y >= 0; y--)
            {
                int t = field[y, l.X];
                field[y, l.X] |= 2;
                if ((t & 1) == 1) break;
            }
        }

        static int Main(string[] args)
        {
            //Test(); return 0;
            //Console.SetIn(File.OpenText("_input"));
            //Console.SetOut(File.CreateText("_out"));
            Parser parser = new Parser();

            while (!parser.SeekEOF)
            {
                string line = parser.ReadLine();
                string[] ll = line.Split(' ');
                if (ll.Length != 4) pe();

                Pos wl1 = new Pos(ll[0]);
                Pos wl2 = new Pos(ll[1]);
                Pos wk = new Pos(ll[2]);
                Pos bk = new Pos(ll[3]);

                int[,] field = new int[8, 8];
                field[wl1.Y, wl1.X] = 1;
                field[wl2.Y, wl2.X] = 1;
                field[wk.Y, wk.X] = 1;
                //field[bk.Y,bk.X]='b';

                LadyaFill(field, wl1);
                LadyaFill(field, wl2);

                for (int y = 0; y < 8; y++)
                    for (int x = 0; x < 8; x++)
                        if (wk.Neighbor(new Pos(x, y))) field[y, x] |= 2;

                bool underAttack = (field[bk.Y, bk.X] & 2) != 0;

                bool canMove = false;
                for (int y = 0; y < 8; y++)
                    for (int x = 0; x < 8; x++)
                        if (bk.Neighbor(new Pos(x, y)))
                            canMove |= (field[y, x] & 2) == 0;

                string res = underAttack && !canMove ? "CHECKMATE" : "OTHER";
                Console.WriteLine(res);

            }
            sw.Stop();
            return 0;
        }
    }
}


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

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

        private static void Main(string[] args)
        {
            int r = Next();
            int g = Next();
            int b = Next();

            int count = r/3 + g/3 + b/3;

            var nn = new[] {r%3, g%3, b%3};
            int min = nn.Min();

            if (min > 0)
            {
                count += min;
            }
            else
            {
                if (nn.Sum() == 4)
                {
                    if (r%3 == 0 && r > 0 || g%3 == 0 && g > 0 || b%3 == 0 && b > 0)
                    {
                        count++;
                    }
                }
            }

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

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


using System;
using System.Collections;
using System.Collections.Generic;
class solution
{
    static void Main(string[] args)
    {
        string[] ab = Console.ReadLine().Split(' ');
        int n = Convert.ToInt32(ab[0]);
        int v = Convert.ToInt32(ab[1]);
        int current = 1, totalmoney = 0;
        if (v >= n) Console.Write(n - 1);
        else
        {
            while (current < n)
            {
                if (n - current >= v)
                {
                    if (current == 1) totalmoney += v * current;
                    else totalmoney += current;
                }
                current++;
            }
            Console.Write(totalmoney);
        }
    }
}


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

class PairVariable : IComparable<PairVariable>
{
    public int a, b;
    public PairVariable()
    {
        a = b = 0;
    }
    public PairVariable(string s)
    {
        string[] q = s.Split();
        a = int.Parse(q[0]);
        b = int.Parse(q[1]);
    }
    public PairVariable(int a, int b)
    {
        this.a = a;
        this.b = b;
    }
    public int CompareTo(PairVariable pv)
    {
        if (this.a > pv.a)
        {
            return 1;
        }
        else if (this.a < pv.a)
        {
            return -1;
        }
        else
        {
            if (this.b >= pv.b)
            {
                return 1;
            }
            else
            {
                return -1;
            }
        }
    }

}
namespace ConsoleApplication2
{

    class Program
    {

        static int[,] matrix;
        static int[] mark;

        static void DFS(int v)
        {

            mark[v] = 1;
            for (int i = 0; i < matrix.GetLength(0); i++)
            {

                if (matrix[v, i] == 1)
                {

                    if (mark[v] == 0)
                    {
                        DFS(i);
                    }
                }
            }

        }
        static bool IsPrime(int n)
        {
            for (int i = 2; i <= Math.Sqrt(n); i++)
            {
                if (n % i == 0)
                {
                    return false;
                }
            }
            return true;
        }
        static void IsYesNo(bool b)
        {
            if (b)
            {
                Console.WriteLine("YES");
            }
            else
            {
                Console.WriteLine("NO");
            }
        }
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int[] m = new int[n];
            for (int i = 0; i < n; i++)
            {
                m[i] = int.Parse(s[i]);
            }
            int p1 = 0;
            int p2 = 0;
            bool f = false;
            for (int i = 0; i < n; i++)
            {
                if (m[i] == 1)
                {
                    f = true;
                    p1 = i;
                    break;
                }
            }
            if (!f)
            {
                Console.WriteLine(0);
                return;
            }

            for (int i = 0; i < n; i++)
            {
                if (m[i] == 1)
                {
                    p2 = i;
                }
            }
            int ans = p1;
            ans += n - p2 - 1;
            string q = "";
            for (int i = p1; i < p2; i++)
            {
                q += m[i];
            }
            string[] qt = q.Split('1');
            for (int i = 0; i < qt.Length; i++)
            {
                if (qt[i].Length >= 2)
                {
                    ans += qt[i].Length;
                }
            }
            Console.WriteLine(n-ans);

        }
    }
}


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

namespace CF
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            using (var sr = new InputReader(Console.In))
//       using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
                //using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var l = sr.NextInt32();
            var r = sr.NextInt32();
            var a = sr.NextInt32();
            var min = Math.Min(l, r);
            var max = Math.Max(l, r);
            if (max >= min + a) {
                sw.WriteLine((min + a)*2);
            }
            else {
                var o = min + a - max;
                sw.WriteLine((o/2 + max)*2);
            }
        }

        ~Task()
        {
            Dispose(false);
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}


using System;

namespace ShadowingOverride
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = new string[2];
            s[0] = Console.ReadLine();
            s[1] = Console.ReadLine();
            int n = s[0].Length;
            int empty = 0;
            int cur = 0;
            int ans = 0;

            for(int i = 0; i < n; i++)
            {
                cur = (s[0][i] == '0'?1:0) + (s[1][i] == '0'?1:0);
              //  Console.WriteLine(cur);
                empty += cur;
                if( empty >= 3)
                {
                    empty -= 3;
                    ans++;
                }
                else
                {
                    empty = cur;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    int Fun(int a, int b)
    {
        return b * (2 * a + b);
    }

    void Solve()
    {
        var a = ReadIntArray();
        int ans;
        if (a[0] == a[2])
            ans = Fun(a[1], a[0]) + Fun(a[4], a[3]);
        else if (a[0] < a[2])
            ans = Fun(a[1], a[0]) + Fun(a[4], a[3]) + (a[0] + a[1]) * 2 * (a[2] - a[0]);
        else
            ans = Fun(a[1], a[2]) + Fun(a[4], a[5]) + (a[2] + a[1]) * 2 * (a[0] - a[2]);

        Write(ans);
    }

    #region Main

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

    #endregion

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


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

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

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

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

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

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

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

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

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

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

                    continue;
                }

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

                    pos++;
                    continue;
                }

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

                pos = 0;
                start = -1;
            }

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

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

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

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

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

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

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

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


using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
class Solve{
    public Solve(){}
    StringBuilder sb;
    public static int Main(){
        new Solve().Run();
        return 0;
    }
    void Run(){
        sb = new StringBuilder();
        Calc();
        Console.Write(sb.ToString());
    }
    void Calc(){
        string[] str = Console.ReadLine().Split(' ');
        long count = 0;
        long t = int.Parse(str[0]);
        int l = int.Parse(str[1]);
        int r = int.Parse(str[2]);
        Generateprimenumber G = new Generateprimenumber(r+1);
        long[] A = new long[r+1];
        for(int i=0;i<r+1;i++){
            A[i] = i*(i-1)/2;
        }
        A[1] = 0;
        for(int i=1;i<r;i++){
            for(int j=2;i*j<=r;j++){
                A[i*j] = A[i] + (long)j*(long)(j-1)/2*i;
            }
        }
        long T = 1;
        for(int i=l;i<=r;i++){
            count = (count + T*(A[i] % Define.mod)) % Define.mod;
            T = T * t % Define.mod;
        }
        sb.Append(count+"\n");
    }
}
class Generateprimenumber{
    public long[] p;
    public int length;
    public Generateprimenumber(int n){
        bool[] a = new bool[n+1];
        List<long> pp = new List<long>();
        int j = 2;
        for(int i=0;i<n+1;i++){
            a[i] = true;
        }
        while(j<=n){
            if(a[j]){
                pp.Add(j);
                for(int i=j;(long)i*(long)j<=n;i++){
                    a[i*j] = false;
                }
            }
            j++;
        }
        length = pp.Count;
        p = pp.ToArray();
    }
    public long[] Divisor(long n){
        List<int> pp = new List<int>();
        long num = n;
        int count = 1;
        bool last = false;
        for(int i=0;p[i]*p[i] <= num;i++){
            int j=0;
            while(num % p[i] == 0){
                num /= p[i];
                j++;
            }
            pp.Add(j);
            count *= j+1;
        }
        if(num != 1){
            pp.Add(1);
            count *= 2;
            last = true;
        }
        long[] div = new long[count];
        for(int i=0;i<count;i++){
            long x = 1;
            int y = i;
            int z = count;
            for(int j=0;j<pp.Count;j++){
                z /= pp[j]+1;
                int k = y/z;
                y %= z;
                for(int l=0;l<k;l++){
                    x *= j == pp.Count - 1 && last ? num : p[j];
                }
            }
            div[i] = x;
        }
        return div;
    }
}
public static class Define{
    public const long mod = 1000000007;
}


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

// binary search --> use inclusive bounds and condition <=
//Array.Reverse do not work in mono!
namespace CodePractice
{

    public class Test
    {
        public static void Main()
        {
            ConsoleReader r = new ConsoleReader();
            TextWriter w = new StreamWriter(new BufferedStream(Console.OpenStandardOutput()));
            Solve(r, w);
            w.Close();
            //Console.ReadKey();
        }

        public static void Solve(ConsoleReader reader, TextWriter writer)
        {
            B(reader, writer);
        }

        public static void E(ConsoleReader reader, TextWriter writer)
        {
        }

        public static void D(ConsoleReader reader, TextWriter writer)
        {
            //http://codeforces.com/contest/1023/problem/D
            int n = reader.NextInt(), q = reader.NextInt();
            int[] a = new int[n];

            reader.NextArray(a, n);

            //
        }
        public static void C(ConsoleReader reader, TextWriter writer)
        {
        }

        public static void B(ConsoleReader reader, TextWriter writer)
        {
            long n = reader.NextLong(), sum = reader.NextLong();
            long ans = 0;

            if (n >= sum)
            {
                ans = sum / 2;
                if (sum % 2 == 0)
                {
                    ans--;
                }
            }
            else
            {
                ans = Math.Max(n - sum / 2, 0);
                //if (sum % 2 == 0 && ans > 0)
                //    ans--;
            }
            Console.WriteLine(ans);
        }

        public static void A(ConsoleReader reader, TextWriter writer)
        {
            int n = reader.NextInt(), m = reader.NextInt();

            string a = reader.NextString();
            string b = reader.NextString();

            int ai = 0, bi = 0;

            while (ai < a.Length && bi < b.Length && a[ai] != '*' && a[ai] == b[bi])
            {
                ai++;
                bi++;
            }

            if (ai < a.Length && a[ai] == '*')
            {
                bi--;
            }

            int aj = a.Length - 1, bj = b.Length - 1;
            while (aj > ai && bj > bi && a[aj] != '*' && a[aj] == b[bj])
            {
                aj--;
                bj--;
            }

            if ((ai == a.Length && bi == b.Length) || (ai < a.Length && ai == aj &&  a[ai] == '*'))
            {
                writer.WriteLine("YES");
            }
            else
            {
                writer.WriteLine("NO");
            }
        }
    }

    public class ConsoleReader
    {
        private String[] data;
        private int wordIndex = 0;

        private void ReadLineIfNeeded()
        {
            while (data == null || wordIndex >= data.Length)
            {
                wordIndex = 0;
                data = Console.ReadLine().Trim().Split();
            }
        }

        public long NextLong()
        {
            ReadLineIfNeeded();
            return long.Parse(data[wordIndex++]);
        }

        public int NextInt()
        {
            ReadLineIfNeeded();
            return int.Parse(data[wordIndex++]);
        }

        public void NextArray(long[] a, int n)
        {
            for (int i = 0; i < n; i++)
            {
                a[i] = NextLong();
            }
        }

        public void NextArray(int[] a, int n)
        {
            for (int i = 0; i < n; i++)
            {
                a[i] = NextInt();
            }
        }

        public string NextString()
        {
            ReadLineIfNeeded();
            return data[wordIndex++];
        }

        //ReadLine()

    }

}


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

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

        private static void Main(string[] args)
        {
            int r = Next(), g = Next(), b = Next();

            int max = 3*((r + 1)/2 - 1);
            max = Math.Max(max, 3*((g + 1)/2 - 1) + 1);
            max = Math.Max(max, 3*((b + 1)/2 - 1) + 2);

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

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


using System;

namespace TaskCS
{
    class Program
    {
        public static int Fac(int x)
        {
            var ans = 0;
            while (x > 0)
            {
                ans += x;
                x--;
            }
            return ans;
        }
        static void Main(string[] args)
        {
            var t = int.Parse(Console.ReadLine());
            var answers = new int[t];

            for (var i = 0; i < t; i++)
            {
                var x = Console.ReadLine();
                answers[i] = 10 * (int.Parse(x[0].ToString()) - 1) + Fac(x.Length);
            }

            foreach (var e in answers)
                Console.WriteLine(e);
        }
    }
}


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

class Program
{
    public static int[] Read(string str)
    {
        string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        int[] ret = new int[tokens.Length];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = int.Parse(tokens[i]);
        }

        return ret;
    }

    public static double[] ReadDouble(string str)
    {
        string[] tokens = str.Trim().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        double[] ret = new double[tokens.Length];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = double.Parse(tokens[i], CultureInfo.InvariantCulture);
        }

        return ret;
    }

    static string Reverse(string s)
    {
        char[] a = s.ToCharArray();
        Array.Reverse(a);
        return new string(a);
    }

    static long[,] T;

    static long Solve(int n, int h)
    {
        if (h < 0) h = 0;
        if (T[n, h] >= 0) return T[n, h];
        if (n < h)
        {
            T[n, h] = 0;
            return 0;
        }
        if (n <= 1)
        {
            T[n, h] = 1;
            return 1;
        }

        long res = 0;

        for (int k = 0; k <= n - 1; k++)
        {
            res += Solve(k, h - 1) * Solve(n - 1 - k, 0);
            res += Solve(k, 0) * Solve(n - 1 - k, h - 1);
            res -= Solve(k, h - 1) * Solve(n - 1 - k, h - 1);
        }

        T[n, h] = res;

        return res;
    }

    static void Main(string[] args)
    {
        int[] nh = Read(Console.ReadLine());
        int n = nh[0], h = nh[1];
        T = new long[n + 1, h + 1];
        for (int i = 0; i <= n; i++)
        {
            for (int j = 0; j <= h; j++)
            {
                T[i, j] = -1;
            }
        }

        long res = Solve(n, h);

        Console.WriteLine(res);
    }
}