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

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.ReadLine();
            var value = Console.ReadLine();
            while (value.Contains("__"))
            {
                value = value.Replace("__", "_");
            }

            value = value.Trim('_');
            value = value + '_';
            bool b = false;
            bool w = false;

            int maxLen = 0;
            int count = 0;
            int currentLen = 0;
            for (int i = 0; i < value.Length; i++)
            {
                if (value[i] != '(' && value[i] != ')' && value[i] != '_') // letter
                {
                    if (!w)
                    {
                        w = true;
                        currentLen = 0;
                    }
                    currentLen++;
                }
                else
                {
                    if (b & w)
                    {
                        count++;
                        currentLen = 0;
                    }
                    else
                    {
                        if (currentLen > maxLen && !b)
                        {
                            maxLen = currentLen;
                        }
                    }
                    w = false;
                    if (value[i] == '(') b = true;
                    if (value[i] == ')') b = false;
                }

            }
            Console.WriteLine(String.Format("{0} {1}", maxLen, count));
        }
    }
}


using System;

namespace _519C___Codeforces
{
    class Program
    {
        static void Main()
        {
            string[] nums = Console.ReadLine().Split();
            double n = double.Parse(nums[0]);
            double m = double.Parse(nums[1]);

            if (n == 0 || m == 0) Console.WriteLine(0);
            else if (n / m <= 0.5) Console.WriteLine(n);
            else if (m / n <= 0.5) Console.WriteLine(m);
            else
            {
               Console.WriteLine((int)(n + m) / 3);
            }
        }
    }
}


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

namespace ConsoleApplication34
{

    class Program
    {
        static void Main(string[] args)
        {
            double w, s, e;

            string[] q = Console.ReadLine().Split();
            double a = double.Parse(q[0]);
            double b = double.Parse(q[1]);
            double c = double.Parse(q[2]);
            double d = double.Parse(q[3]);
            double x =Math.Ceiling((a/c));
            if (x * b > b + d)
                Console.WriteLine("YES");
            else
                Console.WriteLine("NO");

        }
    }
}


using System;
using System.Linq;

namespace main
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            string input = Console.ReadLine();
            if (input.Length != 1)
            {
                foreach (char c in input.Where(c => Convert.ToInt32(c.ToString()) > 4))
                    input = input.Replace(c.ToString(), (9 - Convert.ToInt32(c.ToString())).ToString());
                if (input[0] == '0')
                {
                    input = input.Remove(0, 1);
                    input = "9" + input;
                }
            }
            Console.WriteLine(input);
        }
    }
}


using System;
class P {
    static void Main() {
        int n = int.Parse(Console.ReadLine()), cnt = 0, i = 1;
        for (; i < Math.Pow(2, 10) - 1; ++i) {
            var v = int.Parse(Convert.ToString(i, 2));
            if (v <= n) { cnt++; } else { break; }
        }
        Console.WriteLine(cnt);
    }
}


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

namespace ConsoleApplication1
{
    public class Program
    {
        public static void Main()
        {
            int[] parameters;
            int[] hook_costs;
            int num_guests, profit = 0, incr = 0;

            parameters = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();
            hook_costs = Console.ReadLine().Split(' ').Select(n => Convert.ToInt32(n)).ToArray();
            num_guests = Convert.ToInt32(Console.ReadLine());

            Array.Sort(hook_costs);

            for (int i = 0; i < num_guests; ++i)
            {
                if (incr < hook_costs.Length)
                {
                    profit += hook_costs[incr];
                    ++incr;
                }
                else
                    profit -= parameters[1];
            }

            Console.WriteLine(profit);
        }
    }
}


using System;
namespace _820A
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), int.Parse);
            int c = input[0], v0 = input[1], v1 = input[2], a = input[3], l = input[4], v = v0, result = 0;
            while (c > 0)
            {
                c -= v;
                if (result > 0)
                    c += l;
                result++;
                v = Math.Min(v + a, v1);
            }
            Console.WriteLine(result);
        }
    }
}


using System;

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            string data = Console.ReadLine();
            data = data.Remove(0, 1);
            int num = Convert.ToInt32(data);
            if (num % 2 == 0)
                Console.WriteLine("0");
            else Console.WriteLine("1");
        }
    }
}


using System;
using System.Text;

class main {

    public static void Main(string[] args)
    {
        int[,] street = new int[4,4];
        string[] line;
        for (int i = 0; i < 4; i++) {
            line = Console.ReadLine().Split(' ');
            for (int j = 0; j < 4; j++)
                street[i,j] = int.Parse(line[j]);
        }
        int[] crash = new int[4];
        for (int i = 0; i < 4; i++)
            for (int j = 0; j < 3; j++)
                if (street[i,j] == 1) {
                    crash[i]++;
                    crash[(i + 3 - j) % 4]++;
                }

        bool answer = true;
        for (int i = 0; i < 4; i++)
            if (street[i,3] == 1 && crash[i] > 0) {
                answer = false;
                break;
            }

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


using System;
namespace codeforces
{
    class Program
    {
        public static void Main(string[] args)
        {
            string[] str = Console.ReadLine().Split(' ');
            int n = int.Parse(str[0]);
            int m = int.Parse(str[1]);
            int k = int.Parse(str[2]);
            Console.WriteLine(Beaver(n, m, k));

        }

        public static string Beaver(int n, int m, int k) {
            if (n % 2 == 0)
                return "Marsel";
            if(m<=k)
                return "Marsel";

            for (Int64 i = 1; i * i <= m; i++) {
                if (m % i == 0 && (m / i) >= k &&  i!= 1 && m > i) return "Timur";
                if (m % i == 0 && i >= k && m > i) return  "Timur";
            }
            return "Marsel";
        }
        }
        }


using System;
using System.Linq;
using System.Collections.Generic;
using Debug = System.Diagnostics.Debug;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
using Point = System.Numerics.Complex;
using Number = System.Int64;
namespace Program
{
    public class Solver
    {
        public void Solve()
        {
            var q = sc.Integer();
            var par = new int[500002];
            par[0] = -1;
            var dp = Enumerate(500002, x => new double[35]);
            for (int i = 1; i < 35; i++)
                dp[0][i] = 1.0;

            var ptr = 1;
            Action<int> recalc = null;
            recalc = v =>
              {
                  for (int h = 1; h < 35; h++)
                      dp[v][h] = 1.0;
                  var ps = new List<int>();
                  for (int h = 0; h <= 35; h++)
                  {
                      if (v == -1) break;
                      ps.Add(v);
                      v = par[v];
                  }
                  for (int i = ps.Count - 2; i > 0; i--)
                  {
                      var u = ps[i]; var h = i;
                      if (h + 1 >= 35) continue;
                      var p = ps[i + 1];
                      dp[p][h + 1] /= (dp[u][h] + 1) / 2;
                  }
                  for (int i = 0; i + 1 < ps.Count; i++)
                  {
                      var u = ps[i]; var h = i;
                      var p = ps[i + 1];
                      if (h + 1 >= 35) continue;
                      dp[p][h + 1] *= (dp[u][h] + 1) / 2;
                  }
              };
            for (int i = 0; i < q; i++)
            {
                if (sc.Integer() == 1)
                {
                    var p = sc.Integer() - 1;
                    par[ptr] = p;
                    recalc(ptr);
                    ptr++;

                }
                else
                {
                    var v = sc.Integer() - 1;
                    var ans = 0.0;
                    for (int h = 1; h < 35; h++)
                        ans += 1 - dp[v][h];
                    Debug.WriteLine(dp[v].AsJoinedString());
                    IO.Printer.Out.WriteLine(ans);

                }
            }
        }
        public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());
        static T[] Enumerate<T>(int n, Func<int, T> f) { var a = new T[n]; for (int i = 0; i < n; ++i) a[i] = f(i); return a; }
        static public void Swap<T>(ref T a, ref T b) { var tmp = a; a = b; b = tmp; }
    }
}

#region main
static class Ex
{
    static public string AsString(this IEnumerable<char> ie) { return new string(System.Linq.Enumerable.ToArray(ie)); }
    static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") { return string.Join(st, ie); }
    static public void Main()
    {
        var solver = new Program.Solver();
        solver.Solve();
        Program.IO.Printer.Out.Flush();
    }
}
#endregion
#region Ex
namespace Program.IO
{
    using System.IO;
    using System.Text;
    using System.Globalization;
    public class Printer: StreamWriter
    {
        static Printer() { Out = new Printer(Console.OpenStandardOutput()) { AutoFlush = false }; }
        public static Printer Out { get; set; }
        public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
        public Printer(System.IO.Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
        public Printer(System.IO.Stream stream, Encoding encoding) : base(stream, encoding) { }
        public void Write<T>(string format, T[] source) { base.Write(format, source.OfType<object>().ToArray()); }
        public void WriteLine<T>(string format, T[] source) { base.WriteLine(format, source.OfType<object>().ToArray()); }
    }
    public class StreamScanner
    {
        public StreamScanner(Stream stream) { str = stream; }
        public readonly Stream str;
        private readonly byte[] buf = new byte[1024];
        private int len, ptr;
        public bool isEof = false;
        public bool IsEndOfStream { get { return isEof; } }
        private byte read()
        {
            if (isEof) return 0;
            if (ptr >= len) { ptr = 0; if ((len = str.Read(buf, 0, 1024)) <= 0) { isEof = true; return 0; } }
            return buf[ptr++];
        }
        public char Char() { byte b = 0; do b = read(); while ((b < 33 || 126 < b) && !isEof); return (char)b; }

        public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        public string ScanLine()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b != '\n'; b = (char)read())
                if (b == 0) break;
                else if (b != '\r') sb.Append(b);
            return sb.ToString();
        }
        public long Long()
        {
            if (isEof) return long.MinValue;
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != 0 && b != '-' && (b < '0' || '9' < b));
            if (b == 0) return long.MinValue;
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = ret * 10 + b - '0';
            }
        }
        public int Integer() { return (isEof) ? int.MinValue : (int)Long(); }
        public double Double() { var s = Scan(); return s != "" ? double.Parse(s, CultureInfo.InvariantCulture) : double.NaN; }
        private T[] enumerate<T>(int n, Func<T> f)
        {
            var a = new T[n];
            for (int i = 0; i < n; ++i) a[i] = f();
            return a;
        }

        public char[] Char(int n) { return enumerate(n, Char); }
        public string[] Scan(int n) { return enumerate(n, Scan); }
        public double[] Double(int n) { return enumerate(n, Double); }
        public int[] Integer(int n) { return enumerate(n, Integer); }
        public long[] Long(int n) { return enumerate(n, Long); }
    }
}
#endregion


using System;
using System.Globalization;
using System.IO;
using System.Linq;

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 n = sr.NextInt64();
            var k = sr.NextInt64();
            if (n == k) {
                sw.WriteLine("0 0");
                return;
            }
            if (k == 0) {
                sw.WriteLine("0 0");
                return;
            }
            var min = 1;
            var max = 0L;
            if (k >= n / 2)
                max = n - k;
            else
                max = Math.Min(k * 2, n - k);

            sw.WriteLine(min + " " + max);
        }

        ~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;
using System.Collections;
using System.Collections.Generic;

public class CF_Chord
{
    static string[] N = new string[] { "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "B", "H" };

    public static int dist(string a, string b)
    {
        int pos1 = Array.IndexOf(N, a);
        int pos2 = Array.IndexOf(N, b);
        int d = pos2 - pos1;
        if (d < 0) d = 12 + d;
        return d;
    }

    public static string chord(string a, string b, string c)
    {
        int d1 = dist(a, b);
        int d2 = dist(b, c);

        string ans = "strange";
        if (d1 == 4 && d2 == 3) ans = "major";
        else if (d1 == 3 && d2 == 4) ans = "minor";
        return ans;
    }

    public static void Main(string[] args)
    {
        string[] notes = Console.ReadLine().Split();
        int n = notes.Length;
        string a = notes[0];
        string b = notes[1];
        string c = notes[2];
        int d1 = dist(notes[0], notes[1]);
        int d2 = dist(notes[1], notes[2]);

        string ans = chord(a, b, c);
        if (ans == "strange") ans = chord(a, c, b);
        if (ans == "strange") ans = chord(b, a, c);
        if (ans == "strange") ans = chord(b, c, a);
        if (ans == "strange") ans = chord(c, a, b);
        if (ans == "strange") ans = chord(c, b, a);

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


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

namespace TK1
{
    class Program
    {
        static void Main(string[] args)
        {
            var t = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = t[0];
            int a = t[1];
            int b = t[2];
            int i = 0;
            while (a != b)
            {
                a = (int) Math.Ceiling(a/2.0);
                b = (int) Math.Ceiling(b/2.0);
                i += 1;
            }
            int il = (int) Math.Ceiling(Math.Log(n, 2));
            if ( il == i)
            {
                Console.WriteLine("Final!");
            }
            else
            {
            Console.WriteLine(i);
            }
        }
    }
}


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

class Program
{
    private static long GetCost(long mask, long[] c)
    {
        long ans = 0;

        for (int i = 0; i < c.Length; i++)
            if ((mask & (1L << i)) > 0)
                ans += c[i];

        return ans;
    }

    private static void Main(string[] args)
    {
        var n = RI();
        var L = RL();
        var c = new long[32];
        for (int i = 0; i < n; i++)
            c[i] = RL();

        for (int i = 1; i < n; i++)
            c[i] = Math.Min(c[i], c[i - 1] + c[i - 1]);

        for (int i = n; i < c.Length; i++)
            c[i] = c[i - 1] + c[i - 1];

        for (int i = c.Length - 2; i >= 0; i--)
            c[i] = Math.Min(c[i], c[i + 1]);

        var ans = GetCost(L, c);
        bool work = true;
        while (work)
        {
            var d = L & (L - 1);
            d = L - d;
            if (d == L)
            {
                work = false;
            }

            L += d;
            ans = Math.Min(ans, GetCost(L, c));
        }

        Console.WriteLine(ans);
    }

    private const int Mod = 1000000000 + 7;

    #region Data Read

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

    private static List<int>[] ReadTree(int n)
    {
        return ReadGraph(n, n - 1);
    }

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

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

        return g;
    }

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

        return matrix;
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        return s.ToArray();
    }

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

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

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

        return s;
    }

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

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

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

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

        return s.ToArray();
    }

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

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

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

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

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

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

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

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

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

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


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

namespace parazit
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string s = Console.ReadLine();
            if (n > 2)
            {
                string[] mas = new string[n / 2];
                string s1 = "ogo";
                for (int i = 0; i < n/2; i++)
                {
                    mas[i] = s1; s1 += "go";
                }
                for (int i = n/2-1; i >=0; i--)
                {
                    s = s.Replace(mas[i], "***");
                }
                Console.WriteLine(s);

            }
            else Console.WriteLine(s);

        }
    }
}


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

namespace _227a
{
    class Program
    {
        class Scanner
        {
            string[] s;
            int i;

            char[] cs = new char[] { ' ' };

            public Scanner()
            {
                s =// @"3 0 1 2 3".Split(cs, StringSplitOptions.RemoveEmptyEntries);
                    new string[0];
                i = 0;
            }

            public string next()
            {
                if (i < s.Length) return s[i++];
                s = Console.ReadLine().Split(cs, StringSplitOptions.RemoveEmptyEntries);
                i = 0;
                return s[i++];
            }

            public int NextInt()
            {
                return int.Parse(next());
            }

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

        }
        static void Main(string[] args)
        {
            Scanner sc = new Scanner();
            string s = sc.next();
            int hour = int.Parse(s.Substring(0, 2));
            int minutes = int.Parse(s.Substring(3, 2));

            s = sc.next();
            int sleepHours = int.Parse(s.Substring(0, 2));
            int sleepMinutes = int.Parse(s.Substring(3, 2));

            DateTime dt = new DateTime(2014, 1, 23, hour, minutes,0);
            dt = dt.AddMinutes(-1 * (sleepHours * 60 + sleepMinutes));
            Console.WriteLine("{0:00}:{1:00}", dt.Hour, dt.Minute);
        }
    }
}


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

class Solver
{
    public void Solve(Scanner sc)
    {
        var N = sc.Int;
        var W = sc.ArrInt;
        Array.Sort(W);
        var min = int.MaxValue;
        for(int i=0;i<2*N;i++)
            for(int j = 0; j < i; j++)
            {
                var res = 0;
                var idx = 0;
                while (idx < 2 * N)
                {
                    while(idx == i || idx == j) { idx++; }
                    if (idx >= 2 * N) break;
                    var d1 = W[idx++];
                    while (idx == i || idx == j) { idx++; }
                    var d2 = W[idx++];
                    res += d2 - d1;
                }
                chmin(ref min, res);
            }
        Console.WriteLine(min);
    }
}

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

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

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

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


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

namespace ConsoleApp2
{
    public static class Compare
    {
        const double defaultEpsilon = 1e-13;
        public static bool Equal(double a, double b, double epsilon = defaultEpsilon)
        {
            return Math.Abs(a - b) < epsilon;
        }
        public static bool Less(double a, double b, double epsilon = defaultEpsilon)
        {
            return a < b && !Equal(a, b, epsilon);
        }
        public static bool Greater(double a, double b, double epsilon = defaultEpsilon)
        {
            return a > b && !Equal(a, b, epsilon);
        }
        public static bool LessOrEqual(double a, double b, double epsilon = defaultEpsilon)
        {
            return a < b || Equal(a, b, epsilon);
        }
        public static bool GreaterOrEqual(double a, double b, double epsilon = defaultEpsilon)
        {
            return a > b || Equal(a, b, epsilon);
        }
    }
    struct Vector
    {
        public double X;
        public double Y;
        public double Length => Math.Sqrt(X * X + Y * Y);
        public double LengthSquared => X * X + Y * Y;
        public double Atan2 => Math.Atan2(Y, X);
        public Vector Normalize => this / Length;

        public Vector(double x, double y)
        {
            X = x;
            Y = y;
        }
        public Vector(double angle)
        {
            X = Math.Cos(angle);
            Y = Math.Sin(angle);
        }

        public static double Determinant(Vector left, Vector right)
        {
            return (left.X * right.Y) - (left.Y * right.X);
        }
        public static double DotProduct(Vector left, Vector right)
        {
            return (left.X * right.X) + (left.Y * right.Y);
        }
        public static double AngleBetween(Vector left, Vector right)
        {
            return Math.Acos(DotProduct(left, right) / (left.Length * right.Length));
        }
        public static Vector operator +(Vector vector)
        {
            return vector;
        }
        public static Vector operator -(Vector vector)
        {
            return new Vector(-vector.X, -vector.Y);
        }
        public static Vector operator +(Vector left, Vector right)
        {
            return new Vector(left.X + right.X, left.Y + right.Y);
        }
        public static Vector operator -(Vector left, Vector right)
        {
            return left + -right;
        }
        public static Vector operator *(Vector vector, double value)
        {
            return new Vector(vector.X * value, vector.Y * value);
        }
        public static Vector operator /(Vector vector, double value)
        {
            return new Vector(vector.X / value, vector.Y / value);
        }
        public static bool operator ==(Vector left, Vector right)
        {
            return Compare.Equal(left.X, right.X) && Compare.Equal(left.Y, right.Y);
        }
        public static bool operator !=(Vector left, Vector right)
        {
            return !(left == right);
        }

        public override string ToString()
        {
            return string.Format("({0:F2}, {1:F2})", X, Y);
        }
    }
    struct Line
    {
        public double A;
        public double B;
        public double C;

        public Line(Vector left, Vector right)
        {
            A = (right.Y - left.Y);
            B = -(right.X - left.X);
            C = (right.X * left.Y) - (left.X * right.Y);
        }

        public double GetValAt(double x, double y)
        {
            return A * x + B * y + C;
        }
        public double GetValAt(Vector v)
        {
            return this.GetValAt(v.X, v.Y);
        }
        public bool IsParallel(Line other)
        {
            return Compare.Equal(this.A * other.B, this.B * other.A);
        }
        public Vector Intersect(Line other)
        {
            if (this.IsParallel(other))
            {
                // throw new ArgumentException("Lines are parallel");
                return new Vector(double.NaN, double.NaN);
            }

            double den = (this.A * other.B) - (other.A * this.B);

            double x = ((this.B * other.C) - (other.B * this.C)) / den;
            double y = ((this.A * other.C) - (other.A * this.C)) / -den;

            return new Vector(x, y);
        }
        public Vector Projection(Vector point)
        {
            if (A == 0 && B == 0)
            {
                return new Vector(double.NaN, double.NaN);
            }

            Vector n = new Vector(A, B);
            double k = -(A * point.X + B * point.Y + C) / (A * A + B * B);

            return point + (n * k);
        }
    }
    struct Range
    {
        public Vector Left;
        public Vector Right;
        public Line GetLine => new Line(Left, Right);

        public Range(Vector left, Vector right)
        {
            Left = left;
            Right = right;
        }

        public bool IsInside(Vector v)
        {
            if (!Compare.Equal(GetLine.GetValAt(v), 0))
            {
                return false;
            }

            if ((v == Left) || (v == Right))
            {
                return true;
            }

            return Vector.DotProduct(Left - v, Right - v) < 0;
        }
    }
    struct Polygon
    {
        // Clockwise
        public Vector[] Points;

        public Polygon(params Vector[] points)
        {
            Points = points;
        }

        public IEnumerable<Polygon> Triangulate()
        {
            throw new NotImplementedException("Cannot triangulate (yet)");
            // works incorrectly in certain cases

            if (Points.Length <= 4)
            {
                yield return this;
            }
            else
            {

            }

            for (int i = 0; i < Points.Length; i++)
            {
                for (int j = i + 2; j < Points.Length; j++)
                {
                    Range diagonal = new Range(Points[i], Points[j]);

                }
            }

            List<Vector> remainingPoints = new List<Vector>(Points);

            while (remainingPoints.Count > 3)
            {
                //int j = -1;
                //double smallestArea = double.MaxValue;

                for (int i = 1; i < remainingPoints.Count - 1; i++)
                {
                    Vector first = remainingPoints[i - 1] - remainingPoints[i];
                    Vector second = remainingPoints[i + 1] - remainingPoints[i];

                    double orientedArea = Vector.Determinant(first, second);
                    if (Compare.Less(orientedArea, 0))
                    {
                        continue;
                    }

                    Vector[] trianglePoints = new Vector[]
                    {
                        remainingPoints[i - 1],
                        remainingPoints[i],
                        remainingPoints[i + 1],
                        remainingPoints[i - 1]
                    };
                    Polygon triangle = new Polygon(trianglePoints);

                    int count = 0;
                    for (int j = 1; j < remainingPoints.Count; j++)
                    {
                        if (triangle.IsInside(remainingPoints[j])) {
                            count++;
                        }
                    }

                    if (count == 3)
                    {
                        yield return new Polygon(trianglePoints);
                        remainingPoints.RemoveAt(i);

                        break;
                    }

                    //if (orientedArea < smallestArea)
                    //{
                    //    smallestArea = orientedArea;
                    //    j = i;
                    //}
                }

                //if (j == -1)
                //{
                //    throw new ArgumentException();
                //}

                //Vector[] triangle = new Vector[]
                //{
                //    remainingPoints[j - 1],
                //    remainingPoints[j],
                //    remainingPoints[j + 1],
                //    remainingPoints[j - 1]
                //};
                //yield return new Polygon(triangle);

                //remainingPoints.RemoveAt(j);
            }
        }
        public IEnumerable<Range> Sides()
        {
            for (int i = 1; i < Points.Length; i++)
            {
                yield return new Range(Points[i - 1], Points[i]);
            }
        }
        public double Area()
        {
            double area = 0;
            for (int i = 1; i < Points.Length; i++)
            {
                double dx = Points[i].X - Points[i - 1].X;
                double avgY = (Points[i - 1].Y + Points[i].Y) / 2;

                area += dx * avgY;
            }

            return Math.Abs(area);
        }
        public bool IsInside(Vector point)
        {
            double angleSum = 0;
            foreach (Range side in Sides())
            {
                if (side.IsInside(point))
                {
                    return true;
                }

                angleSum += Vector.AngleBetween(side.Left - point, side.Right - point);
            }

            return Compare.Equal(angleSum, Math.PI * 2);
        }

        public static Polygon GetConvexPolygon(List<Vector> points)
        {
            if (points.Count < 3)
            {
                return new Polygon(Array.Empty<Vector>());
            }

            Vector current = points[0];
            for (int i = 1; i < points.Count; i++)
            {
                Vector point = points[i];
                if (Compare.Equal(point.Y, current.Y))
                {
                    if (Compare.Greater(point.X, current.X))
                    {
                        current = point;
                    }
                }
                else if (point.Y < current.Y)
                {
                    current = point;
                }
            }

            // Start is located at the bottom right
            List<Vector> convexPolygon = new List<Vector>();
            convexPolygon.Add(current);

            double maxAngle = double.MaxValue;
            while (true)
            {
                double angle = double.MinValue;
                double dist = 0;
                Vector next = new Vector();
                for (int i = 0; i < points.Count; i++)
                {
                    Vector point = points[i];
                    Vector v = point - current;

                    if (point == current)
                    {
                        continue;
                    }

                    double alpha = v.Atan2;
                    if (Compare.Greater(alpha, maxAngle))
                    {
                        continue;
                    }

                    if (Compare.Greater(alpha, angle))
                    {
                        angle = alpha;
                        dist = v.LengthSquared;
                        next = point;
                    }
                    else if (Compare.Equal(alpha, angle) && (v.LengthSquared > dist))
                    {
                        angle = alpha;
                        dist = v.LengthSquared;
                        next = point;
                    }
                }

                if (dist == 0)
                {
                    break;
                }

                maxAngle = angle;
                current = next;
                convexPolygon.Add(current);
            }

            return new Polygon(convexPolygon.ToArray());
        }
        public Polygon IntersectConvexPolygons(Polygon other)
        {
            List<Vector> points = new List<Vector>();

            foreach (Vector vertex in this.Points)
            {
                if (other.IsInside(vertex))
                {
                    points.Add(vertex);
                }
            }
            foreach (Vector vertex in other.Points)
            {
                if (this.IsInside(vertex))
                {
                    points.Add(vertex);
                }
            }

            foreach (Range thisSide in this.Sides())
            {
                foreach (Range otherSide in other.Sides())
                {
                    Line thisLine = thisSide.GetLine;
                    Line otherLine = otherSide.GetLine;
                    if (thisLine.IsParallel(otherLine))
                    {
                        continue;
                    }

                    Vector intersection = thisLine.Intersect(otherLine);
                    if (thisSide.IsInside(intersection) && otherSide.IsInside(intersection))
                    {
                        points.Add(intersection);
                    }
                }
            }

            return GetConvexPolygon(points);
        }
    }
    public struct IntervalInt
    {
        public long Left;
        public long Right;
        public long Length => IsProper() ? (Right - Left + 1) : 0;
        public double Average => (Left + Right) / 2.0;

        public IntervalInt(long left, long right)
        {
            Left = left;
            Right = right;
        }

        public bool IsOnInterval(long val)
        {
            return (Left <= val) && (val <= Right);
        }
        public bool IsProper()
        {
            return Left <= Right;
        }
        public long IntegerSum()
        {
            if (Left > Right || Left < 0)
            {
                return 0;
            }

            return NaturalSum(Right) - NaturalSum(Left - 1);
        }
        public IntervalInt Ceiling(long val)
        {
            return new IntervalInt(Left, Math.Min(Right, val));
        }
        public IntervalInt Floor(long val)
        {
            return new IntervalInt(Math.Max(Left, val), Right);
        }
        private static long NaturalSum(long n)
        {
            return n > 0 ? ((n * (n + 1)) / 2) : 0;
        }

        public static IntervalInt operator+(IntervalInt interval, long val)
        {
            return new IntervalInt(interval.Left + val, interval.Right + val);
        }
        public static IntervalInt operator -(IntervalInt interval, long val)
        {
            return interval + -val;
        }
    }

    public struct Rectangle
    {
        public Point First;
        public Point Second;
        public long Left => Math.Min(First.X, Second.X);
        public long Right => Math.Max(First.X, Second.X);
        public long Bottom => Math.Min(First.Y, Second.Y);
        public long Top => Math.Max(First.Y, Second.Y);
        public long DX => Math.Abs(Second.X - First.X);
        public long DY => Math.Abs(Second.Y - First.Y);
        public long Width => DX + 1;
        public long Height => DY + 1;
        public long Area => Width * Height;

        public Rectangle(Point first, Point second)
        {
            First = first;
            Second = second;
        }

        public bool IsLine => (DX == 0) || (DY == 0);
        public bool IsInside(Point point)
        {
            long manhattan = point.ManhattanDist(First) + point.ManhattanDist(Second);
            long dxdy = DX + DY;
            return manhattan == dxdy;
        }

        public IEnumerable<Point> GetPoints()
        {
            long top = Top;
            long right = Right;

            for (long y = Bottom; y <= top; y++)
            {
                for (long x = Left; x <= right; x++)
                {
                    yield return new Point(x, y);
                }
            }
        }
    }
    public struct Point
    {
        public long X;
        public long Y;
        public bool IsZero => this == ZeroPoint;
        public double Length => Math.Sqrt((X * X) + (Y * Y));
        public long ManhattanLength => Math.Abs(X) + Math.Abs(Y);

        public Point(long x, long y)
        {
            X = x;
            Y = y;
        }

        public static Point operator +(Point p)
        {
            return p;
        }
        public static Point operator -(Point p)
        {
            return new Point(-p.X, -p.Y);
        }
        public static Point operator +(Point left, Point right)
        {
            return new Point(left.X + right.X, left.Y + right.Y);
        }
        public static Point operator -(Point left, Point right)
        {
            return left + -right;
        }
        public static bool operator ==(Point left, Point right)
        {
            return (left.X == right.X) && (left.Y == right.Y);
        }
        public static bool operator !=(Point left, Point right)
        {
            return !(left == right);
        }

        public static Point ZeroPoint => new Point(0, 0);
        public double Dist(Point other)
        {
            return (this - other).Length;
        }
        public long ManhattanDist(Point other)
        {
            return (this - other).ManhattanLength;
        }

        public override string ToString()
        {
            return string.Format($"{X} {Y}");
        }
    }
    public class Program
    {
        static int[] ReadIntData()
        {
            return Console.ReadLine()
                .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(e => int.Parse(e))
                .ToArray();
        }
        static long[] ReadLongData()
        {
            return Console.ReadLine()
                .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(e => long.Parse(e))
                .ToArray();
        }
        static double[] ReadDoubleData()
        {
            return Console.ReadLine()
                .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(e => double.Parse(e))
                .ToArray();
        }
        static void RandomizeArray<T>(T[] arr, Random random)
        {
            for (int i = arr.Length - 1; i > 0; i--)
            {
                int pos = random.Next(i);
                if (pos != i)
                {
                    (arr[i], arr[pos]) = (arr[pos], arr[i]);
                }
            }
        }
        static double RandomDouble(double left, double right, Random random)
        {
            double len = right - left;
            double val = random.NextDouble();
            return (val * len) + left;
        }

        static Program()
        {
            CultureInfo cultureInfo = (CultureInfo)CultureInfo.CurrentCulture.Clone();
            cultureInfo.NumberFormat.NumberDecimalSeparator = ".";
            CultureInfo.CurrentCulture = cultureInfo;

            const bool useFilesInsteadOfConsole = false;

            if (useFilesInsteadOfConsole)
            {
                const string fileName = "";
                const bool useCustomFileNames = false;

                const string inputPath = useCustomFileNames ? (fileName + ".in") : "input.txt";
                const string outputPath = useCustomFileNames ? (fileName + ".out") : "output.txt";

                Console.SetIn(new StreamReader(inputPath));
                Console.SetOut(new StreamWriter(outputPath));
            }
        }

        static double CircleSegmentArea(double r, double h)
        {
            double alpha = Math.Acos(h / r);

            double sectorArea = alpha * r * r;
            double triangleArea = h * r * Math.Sin(alpha);
            double area = sectorArea - triangleArea;

            return area;
        }
        static double CircleSliceArea(double r, double h1, double h2)
        {
            if (h1 >= h2)
            {
                return 0;
            }

            return CircleSegmentArea(r, h1) - CircleSegmentArea(r, h2);
        }

        class TreeVertex
        {
            public readonly int Id;
            private readonly List<TreeVertex> children;
            public TreeVertex Parent { get; set; }

            public int LeafCount { get; set; }
            public int ChildrenCount => children.Count;
            public bool IsLeaf => ChildrenCount == 0;

            public TreeVertex(int id)
            {
                Id = id;

                children = new List<TreeVertex>();
                Parent = null;

                LeafCount = 0;
            }

            public void AddChild(TreeVertex child)
            {
                children.Add(child);
            }

            public IEnumerable<TreeVertex> GetChildren()
            {
                foreach (TreeVertex child in children)
                {
                    yield return child;
                }
            }
        }

        static void Swap(ref int left, ref int right)
        {
            int temp = left;
            left = right;
            right = temp;
        }
        static bool Solve(int[] a, int[] b)
        {
            int n = a.Length;
            if (b.Length != n)
            {
                throw new ArgumentException("Arrays 'a' and 'b' have different length");
            }

            bool answer = true;
            for (int i = n - 1; i > 0; i--)
            {
                if (b[i] != a[i])
                {
                    answer = false;
                    break;
                }

                if (b[i] == b[i - 1])
                {
                    for (int j = i - 1; j > 0; j--)
                    {
                        if (b[j] == a[j])
                        {
                            break;
                        }

                        Swap(ref b[j - 1], ref b[j]);
                    }
                }
            }
            if (b[0] != a[0])
            {
                answer = false;
            }

            return answer;
        }
        static void GenerateTests()
        {
            Random random = new Random();
            const int N = 5;
            const int ExpCount = 100;
            int[] a = new int[N];
            int[] b = new int[N];
            int[] origB = new int[N];

            for (int i = 0; i < ExpCount; i++)
            {
                for (int j = 0; j < N; j++)
                {
                    a[j] = b[j] = random.Next(N) + 1;
                }

                for (int j = 0; j < 100; j++)
                {
                    int left = random.Next(N);
                    int right = random.Next(N);

                    if (left > right)
                    {
                        Swap(ref left, ref right);
                    }

                    if (right - left <= 1)
                    {
                        continue;
                    }

                    if (b[left] == b[right])
                    {
                        for (int k = left; k < right; k++)
                        {
                            b[k] = b[k + 1];
                        }
                    }
                }

                Array.Copy(b, origB, N);

                if (!Solve(a, b))
                {
                    Console.WriteLine("FAILED:");
                    Console.WriteLine($"a: {string.Join(" ", a)}");
                    Console.WriteLine($"b: {string.Join(" ", origB)}");
                    Console.WriteLine();
                }
            }

            //int t = int.Parse(Console.ReadLine());
            //for (int z = 0; z < t; z++)
            //{
            //    int n = int.Parse(Console.ReadLine());
            //    int[] a = ReadIntData();
            //    int[] b = ReadIntData();

            //    Console.WriteLine(Solve(a, b) ? "YES" : "NO");
            //}
        }
        static (double, double) VisibilityTime(Vector start, Vector end, double rF, Vector objPos, double rObj)
        {
            double rSum = rF + rObj;
            double pathLength = (end - start).Length;

            if (start != end)
            {
                Line line = new Line(start, end);
                Vector mid = line.Projection(objPos);

                double height = (objPos - mid).Length;
                double dif = Math.Sqrt(rSum * rSum - height * height);

                double midTime = (mid - start).Length / pathLength;
                double deltaT = dif / pathLength;

                double timeLeft = Math.Max(midTime - deltaT, 0);
                double timeRight = Math.Min(midTime + deltaT, 1);

                if (timeLeft < timeRight)
                {
                    return (timeLeft, timeRight);
                }
                else
                {
                    return (-1, -1);
                }
            }
            else
            {
                if ((objPos - start).Length < rSum)
                {
                    return (0, 1);
                }
                else
                {
                    return (-1, -1);
                }
            }
        }

        static void Main()
        {
            int t = int.Parse(Console.ReadLine());
            for (int z = 0; z < t; z++)
            {
                int[] row1 = ReadIntData();
                int[] row2 = ReadIntData();

                int countR1 = row1.Count(val => val == 1);
                int countR2 = row2.Count(val => val == 1);
                int count = countR1 + countR2;

                int ans;
                if (count == 0)
                {
                    ans = 0;
                }
                else if (count == 4)
                {
                    ans = 2;
                }
                else
                {
                    ans = 1;
                }

                Console.WriteLine(ans);
            }

            Console.Out.Close();
        }
    }
}


using System;
/*
Examples
input
input
4
output
2
input
27
output
3

input
5
output
1

input
2000000000
Output
4
Answer
2

*/
namespace CodeForcesCS
{
    class P735D_Taxes
    {
        public static void Main()
        {
            (new P735D_Taxes()).Solve();
        }

        public void Solve()
        {
            long n = long.Parse(Console.ReadLine());
            int tax;

            if (isPrimeNumber(n))
                tax = 1;
            else if ((n & 1) == 0 || isPrimeNumber(n - 2))
                tax = 2;
            else
                tax = 3;

            //while (n > 0 && (primeNum = maxPrimeNumber(n)) > 0)
            //{
            //    n -= primeNum;
            //    tax++;
            //}
            Console.WriteLine(tax);
            Console.ReadLine();
        }

        public static bool isPrimeNumber(long num)
        {
            if (num < 2)
                return false;

            if (num <= 3)
                return true;

            if ((num & 1) == 0 || num % 3 == 0)
                return false;

            long i = 5;
            long w = 2;
            long sqrtNum = (long)Math.Sqrt(num);

            while (i <= sqrtNum)
            {
                if (num % i == 0)
                    return false;

                i += w;
                w = 6 - w;
            }

            return true;
        }
/* REMOVED:
        public static long maxPrimeNumber(long num)
            // return: the number x <= num that is prime.
        {
            if (num == 2 || num == 3)
                return num;

            bool isPrime = false;
            num += ((num & 1) == 0 ? 1 : 2);
            while (!isPrime)
            {
                num -= 2;
                if (num % 3 != 0)
                {
                    long i = 5;
                    long w = 2;

                    isPrime = true;
                    while (i * i <= num)
                    {
                        if (num % i == 0)
                        {
                            isPrime = false;
                            break;
                        }

                        i += w;
                        w = 6 - w;
                    }
                }
            }
            return num;
        }

        public static long nextPrimeNumber(long num)
        {
            if (num < 2)
                return 2;
            if (num < 3)
                return 3;

            bool isPrime = false;
            if ((num & 1) == 0)
            {
                num--;
            }
            while (!isPrime)
            {
                num += 2;
                if (num % 3 != 0)
                {
                    long i = 5;
                    long w = 2;

                    isPrime = true;
                    while (i * i <= num)
                    {
                        if (num % i == 0)
                        {
                            isPrime = false;
                            break;
                        }

                        i += w;
                        w = 6 - w;
                    }
                }
            }
            return num;
        }
*/
    }
}


using System;

namespace NearestInterestingNumber
{
    class Program
    {
        static bool isInteresting(int a)
        {
            int sum = 0;
            while (a > 0)
            {
                sum += a % 10;
                a = a / 10;
            }
            if (sum % 4 == 0)
            {
                return true;
            }
            return false;
        }
        static void Main(string[] args)
        {
            int a = Convert.ToInt32(Console.ReadLine());
            while(!isInteresting(a))
            {
                a++;
            }
            Console.WriteLine(a);
        }
    }
}


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

namespace CF23
{
    class Program
    {
        static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int maxLenth = 0;
            for (int i = 0; i < str.Length; i++)
            {
                for (int j = i + 1; j < str.Length; j++)
                {
                    if (str[i] == str[j])
                    {
                        int curLength = 0;
                        int k = i;
                        int t = j;
                        while (t<str.Length && str[k] == str[t])
                        {
                            t++;
                            k++;
                            curLength++;
                        }
                        if (curLength > maxLenth)
                        {
                            maxLenth = curLength;
                        }
                    }
                }
            }
            Console.Write(maxLenth);
            Console.ReadKey();
        }
    }
}


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

namespace ThreeBalls
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            string[] s = Console.ReadLine().Split();
            int[] a = new int[1001];

            for (int i=0;i<n;i++)
            {
                int x = int.Parse(s[i]);
                a[x] = 1;
            }

            bool ok = false;
            int j = 1;
            while (!ok && j<=998)
            {
                ok = (a[j] + a[j + 1] + a[j + 2]) == 3;
                j++;
            }
            if (ok)
            {
                Console.Write("YES");
            }
            else
            {
                Console.Write("NO");
            }

        }
    }
}


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

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            // Load the inputs
            string input = Console.ReadLine();
            string[] inputs = input.Split(' ');
            int n = int.Parse(inputs[0]);
            int m = int.Parse(inputs[1]);
            int i = int.Parse(inputs[2]);
            int j = int.Parse(inputs[3]);
            int a = int.Parse(inputs[4]);
            int b = int.Parse(inputs[5]);

            // Write down the distances we need to move
            int[] dx_array = { i - 1, i - 1, n - i, n - i };
            int[] dy_array = { j - 1, m - j, j - 1, m - j };
            int best_score = 1000000;

            // Try all directions
            for (int k = 0; k < 4; k++)
            {
                int dx = dx_array[k];
                int dy = dy_array[k];

                // Three conditions are needed for a successful solve
                if ((dy % b == 0) && (dx % a == 0) &&
                    (dy / b - dx / a) % 2 == 0)
                {
                    // Special case where x / y is correct but you can't do
                    // a move without going out of the bounds
                    if ((dx == 0) && (dy != 0) && (i + a > n) && (i - a < 1)) continue;
                    if ((dy == 0) && (dx != 0) && (j + b > m) && (j - b < 1)) continue;

                    int score = Math.Max(dx / a, dy / b);
                    if (score < best_score)
                    {
                        best_score = score;
                    }
                }
            }

            // If there has been no improvement, there's no possible win
            if (best_score == 1000000) Console.WriteLine("Poor Inna and pony!");
            else Console.WriteLine(best_score);
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Numerics;
using System.Threading;
using System.IO.Pipes;
using System.Runtime.InteropServices;
using System.Runtime.Remoting;
using System.Data.Odbc;

public static class Ex
{
    public static bool IsNullOrEmpty(this string s) { return string.IsNullOrEmpty(s); }
    public static void yesno(this bool b) => Console.WriteLine(b ? "yes" : "no");
    public static void YesNo(this bool b) => Console.WriteLine(b ? "Yes" : "No");
    public static void YESNO(this bool b) => Console.WriteLine(b ? "YES" : "NO");
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool Chmax<T>(ref this T a, T b) where T : struct, IComparable<T>
    {
        if (b.CompareTo(a) > 0) { a = b; return true; }
        else return false;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static bool Chmin<T>(ref this T a, T b) where T : struct, IComparable<T>
    {
        if (b.CompareTo(a) < 0) { a = b; return true; }
        else return false;
    }

    public static List<string> FastSort(this List<string> s) { s.Sort(StringComparer.OrdinalIgnoreCase); return s.ToList(); }

    public static int PopCount(this uint bits)
    {
        bits = (bits & 0x55555555) + (bits >> 1 & 0x55555555);
        bits = (bits & 0x33333333) + (bits >> 2 & 0x33333333);
        bits = (bits & 0x0f0f0f0f) + (bits >> 4 & 0x0f0f0f0f);
        bits = (bits & 0x00ff00ff) + (bits >> 8 & 0x00ff00ff);
        return (int)((bits & 0x0000ffff) + (bits >> 16 & 0x0000ffff));
    }
}

partial class Program
{
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    string GetStr() { return Console.ReadLine().Trim(); }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    char GetChar() { return Console.ReadLine().Trim()[0]; }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    int GetInt() { return int.Parse(Console.ReadLine().Trim()); }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    long GetLong() { return long.Parse(Console.ReadLine().Trim()); }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    double GetDouble() { return double.Parse(Console.ReadLine().Trim()); }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    string[] GetStrArray() { return Console.ReadLine().Trim().Split(' '); }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    string[][] GetStrArray(int N)
    {
        var res = new string[N][];
        for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ');
        return res;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    int[] GetIntArray() { return Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray(); }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    int[][] GetIntArray(int N)
    {
        var res = new int[N][];
        for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
        return res;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public long[] GetLongArray() { return Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray(); }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    long[][] GetLongArray(int N)
    {
        var res = new long[N][];
        for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ').Select(long.Parse).ToArray();
        return res;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    char[] GetCharArray() { return Console.ReadLine().Trim().Split(' ').Select(char.Parse).ToArray(); }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    double[] GetDoubleArray() { return Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray(); }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    double[][] GetDoubleArray(int N)
    {
        var res = new double[N][];
        for (int i = 0; i < N; i++) res[i] = Console.ReadLine().Trim().Split(' ').Select(double.Parse).ToArray();
        return res;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    char[][] GetGrid(int H)
    {
        var res = new char[H][];
        for (int i = 0; i < H; i++) res[i] = Console.ReadLine().Trim().ToCharArray();
        return res;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    T[] CreateArray<T>(int N, T value)
    {
        var res = new T[N];
        for (int i = 0; i < N; i++) res[i] = value;
        return res;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    T[][] CreateArray<T>(int H, int W, T value)
    {
        var res = new T[H][];
        for (int i = 0; i < H; i++)
        {
            res[i] = new T[W];
            for (int j = 0; j < W; j++) res[i][j] = value;
        }
        return res;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    T[][][] CreateArray<T>(int H, int W, int R, T value)
    {
        var res = new T[H][][];
        for (int i = 0; i < H; i++)
        {
            res[i] = new T[W][];
            for (int j = 0; j < W; j++)
            {
                res[i][j] = new T[R];
                for (int k = 0; k < R; k++) res[i][j][k] = value;
            }
        }
        return res;
    }

    Dictionary<int, List<int>> GetUnweightedAdjacencyList(int N, int M, bool isDirected, bool isNode_0indexed)
    {
        var dic = new Dictionary<int, List<int>>();
        foreach (var e in Enumerable.Range(0, N)) { dic.Add(e, new List<int>()); }
        for (int i = 0; i < M; i++)
        {
            var input = GetIntArray();
            var a = isNode_0indexed ? input[0] : input[0] - 1;
            var b = isNode_0indexed ? input[1] : input[1] - 1;
            dic[a].Add(b);
            if (isDirected == false) dic[b].Add(a);
        }
        return dic;
    }
    class Path
    {

    }
    Dictionary<int, List<(int node, long cost)>> GetWeightedAdjacencyList(int N, int M, bool isDirected, bool isNode_0indexed)
    {
        var dic = new Dictionary<int, List<(int, long)>>();
        foreach (var e in Enumerable.Range(0, N)) { dic.Add(e, new List<(int, long)>()); }
        for (int i = 0; i < M; i++)
        {
            var input = GetIntArray();
            var a = isNode_0indexed ? input[0] : input[0] - 1;
            var b = isNode_0indexed ? input[1] : input[1] - 1;
            var c = input[2];
            dic[a].Add((b, c));
            if (isDirected == false) dic[b].Add((a, c));
        }
        return dic;
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    bool eq<T, U>() => typeof(T).Equals(typeof(U));
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    T ct<T, U>(U a) => (T)Convert.ChangeType(a, typeof(T));
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    T cv<T>(string s) => eq<T, int>() ? ct<T, int>(int.Parse(s))
                       : eq<T, long>() ? ct<T, long>(long.Parse(s))
                       : eq<T, double>() ? ct<T, double>(double.Parse(s))
                       : eq<T, char>() ? ct<T, char>(s[0])
                                         : ct<T, string>(s);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void Multi<T>(out T a) => a = cv<T>(GetStr());
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void Multi<T, U>(out T a, out U b)
    {
        var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]);
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void Multi<T, U, V>(out T a, out U b, out V c)
    {
        var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]);
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void Multi<T, U, V, W>(out T a, out U b, out V c, out W d)
    {
        var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]);
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void Multi<T, U, V, W, X>(out T a, out U b, out V c, out W d, out X e)
    {
        var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]);
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void Multi<T, U, V, W, X, Y>(out T a, out U b, out V c, out W d, out X e, out Y f)
    {
        var ar = GetStrArray(); a = cv<T>(ar[0]); b = cv<U>(ar[1]); c = cv<V>(ar[2]); d = cv<W>(ar[3]); e = cv<X>(ar[4]); f = cv<Y>(ar[5]);
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void Output<T>(T t) => Console.WriteLine(t);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    void Output<T>(IList<T> ls) => Console.WriteLine(string.Join(" ", ls));
    void Debug<T>(IList<IList<T>> ls)
    {
        foreach (var l in ls)
            foreach (var s in l)
                Console.WriteLine(s);
    }

    void Swap<T>(ref T a, ref T b) { T temp = a; a = b; b = temp; }

    int[] dx = new int[] { 1, 0, -1, 0, 1, -1, -1, 1 };
    int[] dy = new int[] { 0, 1, 0, -1, 1, 1, -1, -1 };
    long mod = 1000000007;
}

//-------------------------------------------------------------------------------------------------------

partial class Program
{
    static void Main()
    {
        Console.SetIn(new StreamReader(Console.OpenStandardInput(1000000)));
        Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
        var program = new Program();
        //var t = new Thread(program.Solve, 134217728);
        //t.Start();
        //t.Join();
        program.Solve();
        Console.Out.Flush();
        Console.Read();
    }

    public void Solve()
    {
        long N, L, R;
        Multi(out N, out L, out R);
        var l = Pow(2, L) - 1 + N - L;
        var r = Pow(2, R) - 1 + (N - R) * Pow(2, R - 1);
        Output(l + " " + r);
    }

    long Pow(long a, long n)
    {
        long res = 1;
        while (n > 0)
        {
            if ((n & 1) == 1) { res *= a; }
            a *= a;
            n >>= 1;
        }
        return res;
    }

}


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

class Solver
{
    public void Solve(Scanner sc)
    {
        int N, K;
        sc.Make(out N, out K);
        ModInt res = 0;
        var P = Create(K+1, () => new List<int>());//iの素因数
        var pow = new ModInt[K + 1];pow[1] = 1;//i^N
        for(int i = 2; i <= K; i++)
        {
            pow[i] = ModInt.Pow(i, N);
            if (P[i].Count == 0)
            {
                for(int j = i; j <= K; j += i)
                {
                    P[j].Add(i);
                }
            }
        }
        ModInt dp = 0;
        for(int i = 1; i <= K; i++)
        {
            ModInt newdp = dp;
            //1<=ai<=iかつひとつ以上iを含むようなものを求める
            for(int j = 0; j < (1 << P[i].Count); j++)
            {
                var now = 1;var ct = 0;
                for (int k = 0; k < P[i].Count; k++) if ((1 & j >> k) == 1) { ct++; now *= P[i][k]; }
                if ((ct & 1) == 0)
                    newdp += pow[i / now] - pow[i / now - 1];//i/nowを一つ以上含む->gcdがnowかつiを一つ含む
                else newdp -= pow[i / now] - pow[i / now - 1];
            }
            res += newdp ^ i;
            dp = newdp;
        }
        Console.WriteLine(res);
    }

}

public struct ModInt
{
    public const long MOD = (int)1e9 + 7;
    //public const long MOD = 998244353;
    public long Value { get; set; }
    public ModInt(long n = 0) { Value = n; }
    private static ModInt[] fac;//i!
    private static ModInt[] inv;//1/i
    private static ModInt[] facinv;//1/(i!)
    public override string ToString() => Value.ToString();
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator +(ModInt l, ModInt r)
    {
        l.Value += r.Value;
        if (l.Value >= MOD) l.Value -= MOD;
        return l;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator -(ModInt l, ModInt r)
    {
        l.Value -= r.Value;
        if (l.Value < 0) l.Value += MOD;
        return l;
    }
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator *(ModInt l, ModInt r) => new ModInt(l.Value * r.Value % MOD);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static ModInt operator /(ModInt l, ModInt r) => l * Pow(r, MOD - 2);
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator long(ModInt l) => l.Value;
    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static implicit operator ModInt(long n)
    {
        n %= MOD; if (n < 0) n += MOD;
        return new ModInt(n);
    }

    public static ModInt Pow(ModInt m, long n)
    {
        if (n == 0) return 1;
        if (n % 2 == 0) return Pow(m * m, n >> 1);
        else return Pow(m * m, n >> 1) * m;
    }

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

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

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

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


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

namespace Main {
    class Program {

        const int MOD = 1000003;

        void solve() {
            int n = sc.nextInt();
            int got = 1;
            int ans = 0;
            while (--n > 0) {
                ans = (ans + got) % MOD;
                got = (int) ((1L * got * 3) % MOD);
            }
            output.WriteLine(got);
        }

        public abstract class InputReader {
            protected char[] buf;
            protected int current;
            protected bool isFinished;

            public InputReader() {
                buf = new char[1024];
                current = 1024;
            }

            public abstract int read();

            public int nextInt() {
                int c = read();
                while (c <= 32 && c >= 0) {
                    c = read();
                }
                int sgn = 1;
                if (c == '-') {
                    sgn = -1;
                    c = read();
                }
                if (c < '0' || c > '9') {
                    throw new Exception("digit expected " + (char)c
                            + " found");
                }
                int ret = 0;
                while (c >= '0' && c <= '9') {
                    ret = ret * 10 + (c - '0');
                    c = read();
                }
                if (c == -1) {
                    isFinished = true;
                }
                if (c > 32) {
                    throw new Exception("space character expected "
                            + (char)c + " found");
                }
                return ret * sgn;
            }

            public long nextLong() {
                int c = read();
                while (c <= 32 && c >= 0) {
                    c = read();
                }
                int sgn = 1;
                if (c == '-') {
                    sgn = -1;
                    c = read();
                }
                if (c < '0' || c > '9') {
                    throw new Exception("digit expected " + (char)c
                            + " found");
                }
                long ret = 0;
                while (c >= '0' && c <= '9') {
                    ret = ret * 10 + (c - '0');
                    c = read();
                }
                if (c == -1) {
                    isFinished = true;
                }
                if (c > 32) {
                    throw new Exception("space character expected "
                            + (char)c + " found");
                }
                return ret * sgn;
            }

            public string next() {
                int c = read();
                while (c <= 32 && c >= 0) {
                    c = read();
                }
                StringBuilder sb = new StringBuilder();
                while (c > 32) {
                    sb.Append((char)(c));
                    c = read();
                }
                if (c == -1) {
                    isFinished = true;
                }
                return sb.ToString();
            }

            public bool isFinishedFunction() {
                return isFinished;
            }
        }

        public class StreamInputReader : InputReader {
            private StreamReader stream;

            public StreamInputReader(StreamReader stream)
                : base() {
                this.stream = stream;
            }

            override public int read() {
                if (current == buf.Length) {
                    if (stream.ReadBlock(buf, 0, buf.Length) == 0) {
                        return -1;
                    }
                    current = 0;
                }
                return buf[current++];
            }

        }

        InputReader sc;
        StreamWriter output;

        public static void Main(string[] args) {
            new Program().run();
        }

        public void run() {
            sc = new StreamInputReader(new StreamReader(Console.OpenStandardInput()));
            output = new StreamWriter(Console.OpenStandardOutput());
            solve();
            output.Close();
        }
    }
}


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

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

    internal class Task
    {
        public void Solve(InputReader sr, TextWriter sw)
        {
            var s = sr.NextString().ToCharArray();
            for (var i = 0; i < s.Length; i++) {
                var old = s[i];
                for (var j = 0; j < 26; j++) {
                    var ch = (char) ('a' + j);
                    if (ch != old) {
                        s[i] = ch;
                        if (Check(new string(s))) {
                            sw.Write("YES");
                            return;
                        }
                    }
                }
                s[i] = old;
            }

            sw.WriteLine("NO");
        }

        private bool Check(string str)
        {
            var mid = str.Length / 2;
            for (var i = 0; i < mid; i++) {
                if (str[i] != str[str.Length - i - 1])
                    return false;
            }

            return true;
        }
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;

    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(NextString());
    }

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

    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;
using System.Collections.Generic;
using System.Linq;

namespace CodeForces.Problems.A
{
    class _810
    {
        public static void Main()
        {
            var n = GetInt();
            var k = GetInt();

            var sum = GetInts(n).Sum();
            var x = (2 * (k - 0.5d) * n - 2 * sum) / (2 * k - 2 * (k - 0.5d));

            Console.Write((x < 0) ? 0 : (int)x);
        }

        private static IEnumerable<int> GetInts(int count)
        {
            for (int i = 0; i < count; i++)
            {
                yield return GetInt();
            }
        }

        private static int GetInt()
        {
            char ch = (char)Console.Read();

            while (!char.IsDigit(ch))
            {
                ch = (char)Console.Read();
            }

            int current = 0;
            while (char.IsDigit(ch))
            {
                current = (current * 10) + (int)char.GetNumericValue(ch);
                ch = (char)Console.Read();
            }

            return current;
        }
    }
}


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

namespace ConsoleApplication5
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine(25);
        }
    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
namespace ConsoleApplication1
{
    class Program
    {

        static Dictionary<int, int> aVal;
        static Dictionary<int, int> bVal;
        public static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            int n, k;
            n = int.Parse(s[0]);
            k = int.Parse(s[1]);
            s = Console.ReadLine().Split(' ');
            int nGruppi = n / k;
            int[] count = new int[k];
            for (int i = 0; i < nGruppi; i++)
            {
                for (int j = 0; j < k; j++)
                {
                    if (s[i * k + j][0] == '1')
                    {
                        count[j]++;
                    }

                }
            }
            int ris = 0;
            for (int i = 0; i < k; i++)
            {
                if (count[i] > nGruppi / 2)
                {
                    ris += nGruppi - count[i];
                }
                else
                {
                    ris += count[i];
                }
            }
            Console.WriteLine(ris);
        }

    }
}