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

namespace CodeforcesTemplate
{
    public static class Permutation
    {
        private static bool Next(ref int[] arr)
        {
            int k, j, l;
            for (j = arr.Length - 2; (j >= 0) && (arr[j] >= arr[j + 1]); j--) { }
            if (j == -1)
            {
                arr = arr.OrderBy(c => c).ToArray();
                return false;
            }
            for (l = arr.Length - 1; (arr[j] >= arr[l]) && (l >= 0); l--) { }
            var tmp = arr[j];
            arr[j] = arr[l];
            arr[l] = tmp;
            for (k = j + 1, l = arr.Length - 1; k < l; k++, l--)
            {
                tmp = arr[k];
                arr[k] = arr[l];
                arr[l] = tmp;
            }
            return true;
        }
        public static IEnumerable<int[]> AllPermutations(int[] arr)
        {
            do yield return arr;
            while (Next(ref arr));
        }
    }

    class Program
    {
        private const string FILENAME = "distance4";

        private const string INPUT = FILENAME + ".in";

        private const string OUTPUT = FILENAME + ".out";

        private static Stopwatch _stopwatch = new Stopwatch();

        private static StreamReader _reader = null;
        private static StreamWriter _writer = null;

        private static string[] _curLine;
        private static int _curTokenIdx;

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

        private static string ReadNextToken()
        {
            if (_curTokenIdx >= _curLine.Length)
            {
                //Read next line
                string line = _reader.ReadLine();
                if (line != null)
                    _curLine = line.Split(_whiteSpaces, StringSplitOptions.RemoveEmptyEntries);
                else
                    _curLine = new string[] { };
                _curTokenIdx = 0;
            }

            if (_curTokenIdx >= _curLine.Length)
                return null;

            return _curLine[_curTokenIdx++];
        }

        private static int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        private static void RunTimer()
        {
#if (DEBUG)

            _stopwatch.Start();

#endif
        }

        private static void Main(string[] args)
        {

#if (DEBUG)
            double before = GC.GetTotalMemory(false);
#endif

            long a = long.Parse(Console.ReadLine());
            long b = long.Parse(Console.ReadLine());

            char[] aChar = ("" + a).ToCharArray();
            char[] bChar = ("" + b).ToCharArray();

            if (aChar.Length < bChar.Length)
            {
                Array.Sort(aChar);

                Array.Reverse(aChar);

                Console.WriteLine(new string(aChar));

                return;
            }

            int[] aDigit = new int[10];
            int[] bDigit = new int[10];

            foreach (char ch in aChar)
            {
                aDigit[ch - '0']++;
            }

            foreach (char ch in bChar)
            {
                bDigit[ch - '0']++;
            }

            bool same = true;

            for (int i = 0; i < 10; i++)
            {
                if (aDigit[i] != bDigit[i])
                {
                    same = false;
                }
            }

            if (same)
            {
                Console.WriteLine(b);
                return;
            }

            long answer = 0;

            for (int divide = 0; divide < aChar.Length; divide++)
            {
                if (divide >= 1)
                {
                    if (aDigit[bChar[divide - 1] - '0'] == 0)
                    {
                        break;
                    }

                    aDigit[bChar[divide - 1] - '0']--;
                }

                StringBuilder sb = new StringBuilder();

                for (int i = 0; i < divide; i++)
                {
                    sb.Append(bChar[i]);
                }

                int usedLower = -1;
                {
                    for (int d = (bChar[divide] - '0') - 1; d >= (divide == 0 ? 1 : 0); d--)
                    {
                        if (aDigit[d] > 0)
                        {
                            usedLower = d;
                            break;
                        }
                    }
                }
                if (usedLower < 0)
                {
                    continue;
                }

                sb.Append((char)('0' + usedLower));

                aDigit[usedLower]--;

                for (int i = divide + 1; i < aChar.Length; i++)
                {
                    for (int d = 9; d >= 0; d--)
                    {
                        for (int x = 0; x < aDigit[d] && i < aChar.Length; x++, i++)
                        {
                            sb.Append((char)('0' + d));
                        }
                    }
                }

                aDigit[usedLower]++;

                answer = Math.Max(answer, long.Parse(sb.ToString()));
            }

            Console.WriteLine(answer);

#if (DEBUG)
            _stopwatch.Stop();

            double after = GC.GetTotalMemory(false);

            double consumedInMegabytes = (after - before) / (1024 * 1024);

            Console.WriteLine($"Time elapsed: {_stopwatch.Elapsed}");

            Console.WriteLine($"Consumed memory (MB): {consumedInMegabytes}");

            Console.ReadKey();
#endif

        }

        private static int CountLeadZeros(string source)
        {
            int countZero = 0;

            for (int i = source.Length - 1; i >= 0; i--)
            {
                if (source[i] == '0')
                {
                    countZero++;
                }

                else
                {
                    break;
                }

            }

            return countZero;
        }

        private static string ReverseString(string source)
        {
            char[] reverseArray = source.ToCharArray();

            Array.Reverse(reverseArray);

            string reversedString = new string(reverseArray);

            return reversedString;
        }

        private static int[] CopyOfRange(int[] src, int start, int end)
        {
            int len = end - start;
            int[] dest = new int[len];
            Array.Copy(src, start, dest, 0, len);
            return dest;
        }

        private static string StreamReader()
        {

            if (_reader == null)
                _reader = new StreamReader(INPUT);
            string response = _reader.ReadLine();
            if (_reader.EndOfStream)
                _reader.Close();
            return response;

        }

        private static void StreamWriter(string text)
        {

            if (_writer == null)
                _writer = new StreamWriter(OUTPUT);
            _writer.WriteLine(text);

        }

        private static int BFS(int start, int end, int[,] arr)
        {
            Queue<KeyValuePair<int, int>> queue = new Queue<KeyValuePair<int, int>>();
            List<bool> visited = new List<bool>();
            for (int i = 0; i < arr.GetLength(0); i++)
            {
                visited.Add(false);
            }

            queue.Enqueue(new KeyValuePair<int, int>(start, 0));
            KeyValuePair<int, int> node;
            int level = 0;
            bool flag = false;

            while (queue.Count != 0)
            {
                node = queue.Dequeue();
                if (node.Key == end)
                {
                    return node.Value;
                }
                flag = false;
                for (int i = 0; i < arr.GetLength(0); i++)
                {

                    if (arr[node.Key, i] == 1)
                    {
                        if (visited[i] == false)
                        {
                            if (!flag)
                            {
                                level = node.Value + 1;
                                flag = true;
                            }
                            queue.Enqueue(new KeyValuePair<int, int>(i, level));
                            visited[i] = true;
                        }
                    }
                }

            }
            return 0;

        }

        private static void Write(string source)
        {
            File.WriteAllText(OUTPUT, source);
        }

        private static string ReadString()
        {
            return File.ReadAllText(INPUT);
        }

        private static void WriteStringArray(string[] source)
        {
            File.WriteAllLines(OUTPUT, source);
        }

        private static string[] ReadStringArray()
        {
            return File.ReadAllLines(INPUT);
        }

        private static int[] GetIntArray()
        {
            return ReadString().Split(' ').Select(int.Parse).ToArray();
        }

        private static double[] GetDoubleArray()
        {
            return ReadString().Split(' ').Select(double.Parse).ToArray();
        }

        private static int[,] ReadINT2XArray(List<string> lines)
        {
            int[,] arr = new int[lines.Count, lines.Count];

            for (int i = 0; i < lines.Count; i++)
            {
                int[] row = lines[i].Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(int.Parse).ToArray();

                for (int j = 0; j < lines.Count; j++)
                {
                    arr[i, j] = row[j];
                }
            }

            return arr;
        }
    }
}


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"))) {
                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 input = sr.ReadArrayOfInt32();
            var n = input[0];
            var array = sr.ReadArrayOfInt32();
            var four = n;
            for (var i = 0; i < array.Length; i++) {
                var count = array[i] / 4;
                if (four >= count) {
                    four -= count;
                    array[i] = array[i] % 4;
                }
                else {
                    count -= four;
                    four = 0;
                    array[i] = count * 4 + array[i] % 4;
                }
            }
            var twice = 2*n;
            var one = 0;
            if (four > 0) {
                one = four;
                twice += four;
            }
            Array.Sort(array, (x, y) => -(x % 2).CompareTo((y % 2)));
            for (var i = 0; i < array.Length; i++) {
                var a = array[i];
                if (a % 2 == 1) {
                    var count = a / 2 + 1;
                    if (one > 0) {
                        one--;
                        count--;
                    }
                    if (twice < count) {
                        sw.WriteLine("NO");
                        return;
                    }
                    twice -= count;
                }
                else {
                    var count = a / 2;
                    if (twice > count) {
                        twice -= count;
                    }
                    else {
                        count -= twice;
                        twice = 0;
                        if (one < count * 2) {
                            sw.WriteLine("NO");
                            return;
                        }
                        else {
                            one -= count * 2;
                        }
                    }
                }
            }

            sw.WriteLine("YES");
        }
    }
}

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 int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

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

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


#define DEBUG
#undef DEBUG
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Codeforces_A066
{
    class A066
    {
        static void Main()
        {

            long k, ans, r1;
            string s;
            long[] a = new long[3];
#if DEBUG
            StreamReader sr = new StreamReader("a66.txt");
            s = sr.ReadLine();
#else
            s = Console.ReadLine();
#endif
            string[] st = s.Split(' ');
            a[0] = long.Parse(st[0].Trim());
            a[1] = long.Parse(st[1].Trim());
            a[2] = long.Parse(st[2].Trim());
            Array.Sort(a);
            k = long.Parse(st[3].Trim());

            if (k == 0) ans = 1;
            else
                if (k >= (a[0]-1) + (a[1]-1) + (a[2]-1)) ans = a[0] * a[1] * a[2];
                else
                {
                    ans = 1;
                    for (long i = 0; i < 3; i++)
                    {
                        r1 = Math.Min(k / (3 - i), a[i]-1);
                        ans *= (r1+1);
                        k -= r1;
                    }
                }
            Console.WriteLine(ans);
#if DEBUG
            Console.ReadKey();
#endif
        }
    }
}


using System;
using System.Collections.Generic;

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

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

            n = Convert.ToInt32(input[0]);
            k = Convert.ToInt32(input[1]);

            int[] a = new int[n];

            input = Console.ReadLine().Split(' ');

            for (int i = 0; i < n; i++)
            {
                a[i] = Convert.ToInt32(input[i]);
            }

            int min = int.MaxValue;

            if(k == 1) min = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = i + 1; j < n; j++)
                {
                    int target = a[i];
                    int temp = a[j];
                    int count1 = 0;
                    int count2 = 0;
                    List<int> counts = new List<int>();

                    while (temp != target)
                    {
                        while (temp > target)
                        {
                            temp /= 2;
                            count1++;
                        }

                        while (target > temp)
                        {
                            target /= 2;
                            count2++;
                        }
                    }

                    //Console.WriteLine(target + " target");

                    /*counts.Add(count1);
                    counts.Add(count2);*/

                    for (int x = 0; x < n; x++)
                    {
                        int current = a[x];
                        int count = 0;

                        //Console.WriteLine("current " + current + " target " + target);

                        if(current < target) continue;

                        while (current > target)
                        {
                            current /= 2;
                            count++;
                        }

                        //Console.WriteLine("i " + i + " j " + j + " x " + x + " count " + count);

                        if(current == target)
                        {
                            counts.Add(count);
                        }
                    }

                    //Console.WriteLine("count size " + counts.Count);

                    if(counts.Count >= k)
                    {
                        counts.Sort();
                        int newCount = 0;

                        for (int x = 0; x < k; x++)
                        {
                            //Console.WriteLine("Counts " + counts[x] + " i " + i + " j " + j + " x " + x);
                            newCount += counts[x];
                        }

                        min = Math.Min(min, newCount);
                    }
                }
            }

            Console.WriteLine(min);
        }
    }
}


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

#region code challenges entry point
#if !SOLVER_ATWORKSPACE
class Program{static void Main(string[] args){using (var output = new CC.FormattedStreamWriter(Console.OpenStandardOutput())) using (var error = new CC.FormattedStreamWriter(Console.OpenStandardError())) using (var input = new CC.BufferedStreamReader(Console.OpenStandardInput()))new CC.Solver(input, output, error).Do();}}
#endif
#endregion

#region code helpers boilerplate
namespace CC
{
    class BufferedStreamReader : StreamReader { const int QUEUE_INITSIZE = 10000; public BufferedStreamReader(String fileName): base(fileName) { } public BufferedStreamReader(Stream stream): base(stream) { } private Queue<string> buffer = new Queue<string>(QUEUE_INITSIZE); public override string ReadLine() { if (buffer.Count > 0) throw new InvalidOperationException("must read from buffer first"); return base.ReadLine(); } public string ReadToken() { while (buffer.Count == 0) { base.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries).ToList().ForEach((t) => { buffer.Enqueue(t); }); } return buffer.Dequeue(); } public void ResetBuffer() { buffer = new Queue<string>(QUEUE_INITSIZE); } }
    class FormattedStreamWriter : StreamWriter { public FormattedStreamWriter(Stream stream) : base(stream) { } public FormattedStreamWriter(string filePath) : base(filePath) { } public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } } }
    static class IOExtensions
    {
        public static string String(this BufferedStreamReader reader) { return reader.ReadToken(); }
        public static string[] StringArray(this BufferedStreamReader reader, int n) { var array = new string[n]; for (int i = 0; i < n; ++i) { array[i] = reader.ReadToken(); } return array; }
        public static int Int(this BufferedStreamReader reader) { return int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }
        public static int[] IntArray(this BufferedStreamReader reader, int n) { var array = new int[n]; for (int i = 0; i < n; ++i) { array[i] = int.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }
        public static uint UnsignedInt(this BufferedStreamReader reader) { return uint.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }
        public static long Long(this BufferedStreamReader reader) { return long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }
        public static long[] LongArray(this BufferedStreamReader reader, int n) { var array = new long[n]; for (int i = 0; i < n; ++i) { array[i] = long.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }
        public static ulong UnsignedLong(this BufferedStreamReader reader) { return ulong.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }
        public static double Double(this BufferedStreamReader reader) { return double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }
        public static double[] DoubleArray(this BufferedStreamReader reader, int n) { var array = new double[n]; for (int i = 0; i < n; ++i) { array[i] = double.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }
        public static decimal Decimal(this BufferedStreamReader reader) { return decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); }
        public static decimal[] DecimalArray(this BufferedStreamReader reader, int n) { var array = new decimal[n]; for (int i = 0; i < n; ++i) { array[i] = decimal.Parse(reader.ReadToken(), CultureInfo.InvariantCulture); } return array; }
        public static void ArrayLine<T>(this FormattedStreamWriter writer, T[] array, int n, string format = "{0}", string separator = " ") { for (int i = 0; i < n; ++i) { if (i > 0) writer.Write(separator); writer.Write(format, array[i]); } writer.WriteLine(); }
        public static void ArrayLine<T>(this FormattedStreamWriter writer, T[] array, string format = "{0}", string separator = " ") { writer.ArrayLine(array, array.Length, format, separator); }
    }
    partial class Solver
    {
        protected readonly BufferedStreamReader read;
        protected readonly FormattedStreamWriter write;
        protected readonly FormattedStreamWriter error;
        public Solver(BufferedStreamReader read, FormattedStreamWriter write, FormattedStreamWriter error){this.read = read;this.write = write;this.error = error;}
        public static T[][] Create2DArray<T>(int dim1, int dim2) { var res = new T[dim1][]; for (int i = 0; i < dim1; ++i) res[i] = new T[dim2]; return res; }
        public static T[][][] Create3DArray<T>(int dim1, int dim2, int dim3) { var res = new T[dim1][][]; for (int i = 0; i < dim1; ++i) res[i] = Create2DArray<T>(dim2, dim3); return res; }
        public static T[][][][] Create4DArray<T>(int dim1, int dim2, int dim3, int dim4) { var res = new T[dim1][][][]; for (int i = 0; i < dim1; ++i) res[i] = Create3DArray<T>(dim2, dim3, dim4); return res; }
        public void Do(){Run();}
    }
    static class Utils
    {
        public static void Swap<T>(ref T one, ref T second) { T tmp = one; one = second; second = tmp; }
    }
}
#endregion

namespace CC
{
    using System.Diagnostics;
    using System.Text;

    partial class Solver
    {
        public void Run()
        {
            var a = read.IntArray(14);
            var b = new int[14];
            long res = 0;
            for (int i = 0; i < 14; ++i)
                if (a[i] > 0)
                {
                    Array.Copy(a, b, 14);
                    b[i] = 0;
                    for (int j = 0; j < 14; ++j)
                        b[(i + 1 + j) % 14] += a[i] / 14 + ((a[i] % 14) > j ? 1: 0);
                    long sum = 0;
                    for (int j = 0; j < 14; ++j)
                        sum += b[j] % 2 == 0 ? b[j] : 0;
                    res = Math.Max(res, sum);
                }
            write.WriteLine(res);
        }
    }
}


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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solution
{
    public void Solve()
    {
        int n = ReadInt();
        int m = ReadInt();

        if (m == 1)
            Write(n - 1);
        else
            Write(1L * n * (m - 1));
    }

    #region Main

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

    #endregion

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


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

class Program
{

    void solve()
    {
        long l = nextInt();
        long r = nextInt();
        long p = 1;
        long res = 0;
        while (p < 1000000000000L)
        {
            p *= 10;
            long c = p - 1;
            long num;
            if (c / 2 > r)
                num = r;
            else if (c / 2 < l)
                num = l;
            else
                num = c / 2;
            if (num >= p / 10 && num < p)
                res = Math.Max(res, num * (c - num));
        }
        println(res);

    }
    long get(int x)
    {
        long y = 0;
        long p = 1;
        long temp = x;
        while (x > 0)
        {
            y += p * (9 - x % 10);
            x /= 10;
            p *= 10;
        }
        return temp * y;
    }

    ////////////
    private void println(int[] ar)
    {
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i]);
            else
                print(ar[i] + " ");
        }
    }
    private void println(int[] ar, bool add)
    {
        int A = 0;
        if (add)
            A++;
        for (int i = 0; i < ar.Length; i++)
        {
            if (i == ar.Length - 1)
                println(ar[i] + A);
            else
                print((ar[i] + A) + " ");
        }
    }

    private void println(string Stringst)
    {
        Console.WriteLine(Stringst);
    }
    private void println(char charnum)
    {
        Console.WriteLine(charnum);
    }
    private void println(int Intnum)
    {
        Console.WriteLine(Intnum);
    }
    private void println(long Longnum)
    {
        Console.WriteLine(Longnum);
    }
    private void println(double Doublenum)
    {
        string s = Doublenum.ToString(CultureInfo.InvariantCulture);
        Console.WriteLine(s);
    }

    private void print(string Stringst)
    {
        Console.Write(Stringst);
    }
    private void print(int Intnum)
    {
        Console.Write(Intnum);
    }
    private void print(char charnum)
    {
        Console.Write(charnum);
    }
    private void print(long Longnum)
    {
        Console.Write(Longnum);
    }
    private void print(double Doublenum)
    {
        Console.Write(Doublenum);
    }

    string[] inputLine = new string[0];
    int inputInd = 0;
    string nextLine()
    {
        return Console.ReadLine();
    }
    void readInput()
    {
        if (inputInd != inputLine.Length)
            throw new Exception();
        inputInd = 0;
        inputLine = Console.ReadLine().Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
        if (inputLine.Length == 0)
            readInput();
    }
    int nextInt()
    {
        return int.Parse(nextString());
    }
    long nextLong()
    {
        return long.Parse(nextString());
    }
    double nextDouble()
    {
        return double.Parse(nextString());
    }
    string nextString()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return inputLine[inputInd++];
    }
    static void Main(string[] args)
    {
        Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        new Program().solve();
    }
}


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

namespace B_Sum
{
    public class Sum
    {
        static int GetNotation(string input)
        {
            int max = 0;
            foreach (char c in input)
                max = Math.Max(max, (int)c);
            return max - 47;
        }

        static int Calculate(int notation, int result_10)
        {
            int output = 0;
            int temp = result_10;

            do
            {
                output++;
                temp = temp / notation;
            } while (temp >= notation);
            output++;
            return output;

        }

        static int Convert_10(int notation, string x)
        {

            int count = 0;
            int output = 0;
            for (int i = x.Length - 1; i >= 0; i--)
            {
                int temp = ((int)x[i] - 48) * Pow(notation, count);
                count++;
                output += temp;
            }
            return output;
        }

        static int Pow(int x, int g)
        {
            if (g == 0) return 1;
            else return x * Pow(x, g - 1);
        }

        static public int MaxLength(string input)
        {
            int notation = GetNotation(input);
            string[] s = input.Split(' ');
            int x = Convert_10(notation, s[0]);
            int y = Convert_10(notation, s[1]);
            return Calculate(notation, x + y);
        }
    }
    class Program
    {

        static void Main(string[] args)
        {
            Sum X = new Sum();
            Console.WriteLine(Sum.MaxLength(Console.ReadLine()));
            //Console.WriteLine(Convert_10(9, "78"));
        }
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        public static Int64 powermod(Int64 b, Int64 n, Int64 m)
        {
            Int64 result = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    result = (result * b) % m;
                }
                b = (b * b) % m;
                n = n / 2;
            }
            return result;

            //return (result - 1) % m;
        }

        static void Main(string[] args)
        {
            Int64 n, m;
            string[] inp = Console.ReadLine().ToString().Split(' ');
            n = Convert.ToInt64(inp[0]);
            m = Convert.ToInt64(inp[1]);

            Int64 r = powermod(3, n, m);
            r = r == 0 ? m - 1 : r-1;
            Console.WriteLine(r);
        }
    }
}


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

namespace cfgr14
{
    class Program
    {
        static void Main(string[] args)
        {
           Console.SetOut(new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false });
            if (File.Exists("input.txt"))
            {
                Console.SetIn(new StreamReader("input.txt"));
            }
            solve_cfgr14E();
            Console.Out.Flush();
        }

        public static long[] fact = new long [405];
        public static long[] inv = new long [405];
        public static long[,] choose = new long [405, 405];
        public static long[] pow2 = new long [405];
        public static long n;
        public static long mod;
        /*
        Editorial:

        */
        public static void solve_cfgr14E()
        {
            long[] nm = Array.ConvertAll(Console.ReadLine().Split(), long.Parse);
            n = nm[0];
            mod = nm[1];
            precompute();
            long[,] dp = new long[405, 405];
            dp[0, 0] = 1;
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    for (int k = 1; i + k <= n; k++)
                    {
                        dp[i + k + 1, j + k] += (dp[i, j] * pow2[k - 1]) % mod * choose[j + k, k];
                        dp[i + k + 1, j + k] %= mod;
                    }
                }
            }

            long ans = 0;
            for (int i = 0; i <= n; i++)
            {
                ans = (ans + dp[n + 1, i]) % mod;
            }
            Console.WriteLine(ans);
        }

        public static void precompute()
        {
            fact[0] = 1;
            inv[0] = 1;
            for (int i = 1; i <= n; i++)
            {
                fact[i] = (fact[i - 1] * i) % mod;
                inv[i] = binExp(fact[i], mod - 2);
            }

            for (int i = 0; i <= n; i++)
            {
                for (int j = 0; j <= i; j++)
                {
                    choose[i, j] = ((fact[i] * inv[j]) % mod * inv[i - j]) % mod;
                }
            }

            for (int i = 0; i <= n; i++)
            {
                pow2[i] = binExp(2, i);
            }
        }

        public static long binExp(long a, long exp)
        {
            if (exp == 0)
            {
                return 1;
            }
            long tmp = binExp(a, exp / 2);
            tmp = (tmp * tmp) % mod;
            if (exp % 2 == 1)
            {
                tmp *= a;
            }
            return tmp % mod;
        }

        public static void solve_cfgr14C()
        {
            int t = Convert.ToInt32(Console.ReadLine());
            while(t-- > 0)
            {
                int[] nmx = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                int n = nmx[0];
                int m = nmx[1];
                int x = nmx[2];
                int[] h = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                Array.Sort(h);
                int[] cnt = new int[m];
                for (int i = 0; i < n; i++)
                {
                    cnt[i % m] += h[i];
                }
                int min = int.MaxValue;
                int max = int.MinValue;
                bool ok = true;
                for (int i = 0; i < m; i++)
                {
                    min = Math.Min(min, cnt[i]);
                    max = Math.Max(max, cnt[i]);
                    if (max - min > x)
                    {
                        ok = false;
                        break;
                    }
                }
                if (ok)
                {
                    Console.WriteLine("YES");
                    for (int i = 0; i < n; i++)
                    {
                        Console.Write("{0} ", (i % m) + 1);
                    }
                }
                else
                {
                    Console.Write("NO");
                }
                Console.WriteLine();
            }
        }

        public static void solve_cfgr14B()
        {
            int t = Convert.ToInt32(Console.ReadLine());
            while(t-- > 0)
            {
                int n = Convert.ToInt32(Console.ReadLine());
                bool ok = false;
                if (n > 1 && (n & (n - 1)) == 0)
                {
                    ok = true;
                }
                else
                {
                    for (int i = 2; i * i <= 1000000000; i++)
                    {
                        if (i % 2 != 0)
                        {
                            if (n % (i * i) == 0)
                            {
                                int r = n / (i * i);
                                if (r > 1 && (r & (r - 1)) == 0)
                                {
                                    ok = true;
                                    break;
                                }
                            }
                        }
                    }
                }
                Console.WriteLine(ok ? "YES" : "NO");
            }

        }

        public static void solve_cfgr14A()
        {
            int t = Convert.ToInt32(Console.ReadLine());
            while(t-- > 0)
            {
                int[] nx = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                int n = nx[0];
                int x = nx[1];
                int[] w = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
                Array.Sort(w, (a, b) => b.CompareTo(a));
                int sum = 0;
                int posToChange = -1;
                for (int i = 0; i < n; i++)
                {
                    sum += w[i];
                    if (sum == x)
                    {
                        posToChange = i;
                    }
                }
                if (sum != x)
                {
                    Console.WriteLine("YES");
                    for (int i = 0; i < n; i++)
                    {
                        if (i == posToChange)
                        {
                            if (i + 1 < n)
                            {
                                int tmp = w[i];
                                w[i] = w[i + 1];
                                w[i + 1] = tmp;
                            }
                        }
                        Console.Write("{0} ", w[i]);
                    }
                }
                else
                {
                    Console.Write("NO");
                }
                Console.WriteLine();

            }
        }
    }
}


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

// (づ°ω°)づﾐ★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    void Solve()
    {
        var fibs = new List<long> { 1, 1};
        for (int i = 2; i < 50; i++)
            fibs.Add(fibs[i - 2] + fibs[i - 1]);

        int n = ReadInt();
        long m = ReadLong() - 1;
        var ans = new int[n];
        for (int i = 0; i < n; i++)
            if (fibs[n - i - 1] > m)
                ans[i] = i + 1;
            else
            {
                ans[i] = i + 2;
                ans[i + 1] = i + 1;
                m -= fibs[n - i - 1];
                i++;
            }
        WriteArray(ans);
    }

    #region Main

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

    #endregion

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


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

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

            string input = "";
            string[] inputElements = new string[3];
            input = Console.ReadLine();
            inputElements = input.Split(' ');

            int a = Convert.ToInt32(inputElements[0]);
            int b = Convert.ToInt32(inputElements[1]);
            int c = Convert.ToInt32(inputElements[2]);

            int first = (a * b) + (b * c) + (c * a);
            int second = a + b + c;

            Console.WriteLine(first - second + 1);
        }

    }
}


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using static System.Math;
using System.Text;
using System.Threading;
using System.Globalization;
using System.Runtime.CompilerServices;
using Library;

namespace Program
{
    public static class ProblemD
    {
        static bool SAIKI = false;
        static public int numberOfRandomCases = 0;
        static public void MakeTestCase(List<string> _input, List<string> _output, ref Func<string[], bool> _outputChecker)
        {
        }
        static public void Solve()
        {
            var n = (int)NN;
            var m = (int)NN;
            var q = (int)NN;
            var pList = NNList(n);
            var ab = Repeat(0, m).Select(_ => new { a = (int)NN - 1, b = (int)NN - 1 }).ToArray();
            var query = Repeat(0, q).Select(_ => new { t = (int)NN, param = (int)NN }).ToArray();
            var graph = Repeat(0, n).Select(_ => new List<int>()).ToArray();
            var uf = new LIB_UnionFind(n);
            var deleted = new bool[m];
            foreach (var item in query)
            {
                if (item.t == 2) deleted[item.param - 1] = true;
            }
            var procTgtEdgeIndex = new bool[m];
            for (var i = 0; i < m; i++)
            {
                if (!deleted[i])
                {
                    if (uf.Unite(ab[i].a, ab[i].b))
                    {
                        graph[ab[i].a].Add(ab[i].b);
                        graph[ab[i].b].Add(ab[i].a);
                    }
                }
            }
            foreach (var item in query.Reverse())
            {
                if (item.t == 2)
                {
                    var i = item.param - 1;
                    if (uf.Unite(ab[i].a, ab[i].b))
                    {
                        procTgtEdgeIndex[i] = true;
                        graph[ab[i].a].Add(ab[i].b);
                        graph[ab[i].b].Add(ab[i].a);
                    }
                }
            }
            var param = new int[n];
            var qList = new List<LIB_PriorityQueue>();
            var used = new bool[n];
            {
                var done = new bool[n];
                for (var i = 0; i < n; i++)
                {
                    if (!done[i])
                    {
                        var c = qList.Count();
                        var tmpq = new LIB_PriorityQueue();
                        qList.Add(tmpq);
                        var que = new Queue<int>();
                        que.Enqueue(i);
                        done[i] = true;
                        param[i] = c;
                        while (que.Count > 0)
                        {
                            var v = que.Dequeue();
                            foreach (var item in graph[v])
                            {
                                if (done[item]) continue;
                                done[item] = true;
                                param[item] = c;
                                que.Enqueue(item);
                            }
                        }
                    }
                    qList[param[i]].Push((int)pList[i], i);
                }
            }
            var leftVs = new List<int>();
            var rightVs = new List<int>();
            var leftQ = new Queue<(int, int)>();
            var rightQ = new Queue<(int, int)>();
            foreach (var item in query)
            {
                if (item.t == 1)
                {
                    var v = item.param - 1;
                    var p = param[v];
                    var que = qList[p];
                    var value = 0L;
                    while (que.Count > 0)
                    {
                        if (used[que.Peek.Item2] || p != param[que.Peek.Item2]) que.Pop();
                        else
                        {
                            used[que.Peek.Item2] = true;
                            value = que.Pop().Key;
                            break;
                        }
                    }
                    Console.WriteLine(value);
                }
                else
                {
                    var leftV = ab[item.param - 1].a;
                    var rightV = ab[item.param - 1].b;
                    if (!procTgtEdgeIndex[item.param - 1]) continue;
                    leftQ.Clear();
                    rightQ.Clear();
                    var color = param[leftV];
                    var lidx = 0;
                    var ridx = 0;
                    var lv = leftV;
                    var rv = rightV;
                    var lp = rightV;
                    var rp = leftV;
                    var exit = false;
                    leftVs.Clear();
                    rightVs.Clear();
                    leftVs.Add(lv);
                    rightVs.Add(rv);
                    var procVs = leftVs;
                    while (true)
                    {
                        var leftOK = false;
                        while (true)
                        {
                            while (graph[lv].Count > lidx)
                            {
                                var v = graph[lv][lidx++];
                                if (v == lp) continue;
                                if (color != param[v]) continue;
                                leftQ.Enqueue((v, lv));
                                leftVs.Add(v);
                                leftOK = true;
                                break;
                            }
                            if (leftOK) break;
                            if (leftQ.Count == 0)
                            {
                                exit = true;
                                break;
                            }
                            var pop = leftQ.Dequeue();
                            lv = pop.Item1;
                            lp = pop.Item2;
                            lidx = 0;
                        }
                        if (exit) break;
                        var rightOK = false;
                        while (true)
                        {
                            while (graph[rv].Count > ridx)
                            {
                                var v = graph[rv][ridx++];
                                if (v == rp) continue;
                                if (color != param[v]) continue;
                                rightQ.Enqueue((v, rv));
                                rightVs.Add(v);
                                rightOK = true;
                                break;
                            }
                            if (rightOK) break;
                            if (rightQ.Count == 0)
                            {
                                procVs = rightVs;
                                exit = true;
                                break;
                            }
                            var pop = rightQ.Dequeue();
                            rv = pop.Item1;
                            rp = pop.Item2;
                            ridx = 0;
                        }
                        if (exit) break;
                    }
                    var procColorTo = qList.Count;
                    var tmpq = new LIB_PriorityQueue();
                    qList.Add(tmpq);
                    foreach (var item2 in procVs)
                    {
                        if (!used[item2]) tmpq.Push((int)pList[item2], item2);
                        param[item2] = procColorTo;
                    }
                }
            }
        }
        class Printer : StreamWriter
        {
            public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
            public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { base.AutoFlush = false; }
            public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { base.AutoFlush = false; }
        }
        static LIB_FastIO fastio = new LIB_FastIODebug();
        static public void Main(string[] args) { if (args.Length == 0) { fastio = new LIB_FastIO(); Console.SetOut(new Printer(Console.OpenStandardOutput())); } if (SAIKI) { var t = new Thread(Solve, 134217728); t.Start(); t.Join(); } else Solve(); Console.Out.Flush(); }
        static long NN => fastio.Long();
        static double ND => fastio.Double();
        static string NS => fastio.Scan();
        static long[] NNList(long N) => Repeat(0, N).Select(_ => NN).ToArray();
        static double[] NDList(long N) => Repeat(0, N).Select(_ => ND).ToArray();
        static string[] NSList(long N) => Repeat(0, N).Select(_ => NS).ToArray();
        static long Count<T>(this IEnumerable<T> x, Func<T, bool> pred) => Enumerable.Count(x, pred);
        static IEnumerable<T> Repeat<T>(T v, long n) => Enumerable.Repeat<T>(v, (int)n);
        static IEnumerable<int> Range(long s, long c) => Enumerable.Range((int)s, (int)c);
        static IOrderedEnumerable<T> OrderByRand<T>(this IEnumerable<T> x) => Enumerable.OrderBy(x, _ => xorshift);
        static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x) => Enumerable.OrderBy(x.OrderByRand(), e => e);
        static IOrderedEnumerable<T1> OrderBy<T1, T2>(this IEnumerable<T1> x, Func<T1, T2> selector) => Enumerable.OrderBy(x.OrderByRand(), selector);
        static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x) => Enumerable.OrderByDescending(x.OrderByRand(), e => e);
        static IOrderedEnumerable<T1> OrderByDescending<T1, T2>(this IEnumerable<T1> x, Func<T1, T2> selector) => Enumerable.OrderByDescending(x.OrderByRand(), selector);
        static IOrderedEnumerable<string> OrderBy(this IEnumerable<string> x) => x.OrderByRand().OrderBy(e => e, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<T> OrderBy<T>(this IEnumerable<T> x, Func<T, string> selector) => x.OrderByRand().OrderBy(selector, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<string> OrderByDescending(this IEnumerable<string> x) => x.OrderByRand().OrderByDescending(e => e, StringComparer.OrdinalIgnoreCase);
        static IOrderedEnumerable<T> OrderByDescending<T>(this IEnumerable<T> x, Func<T, string> selector) => x.OrderByRand().OrderByDescending(selector, StringComparer.OrdinalIgnoreCase);
        static string Join<T>(this IEnumerable<T> x, string separator = "") => string.Join(separator, x);
        static uint xorshift { get { _xsi.MoveNext(); return _xsi.Current; } }
        static IEnumerator<uint> _xsi = _xsc();
        static IEnumerator<uint> _xsc() { uint x = 123456789, y = 362436069, z = 521288629, w = (uint)(DateTime.Now.Ticks & 0xffffffff); while (true) { var t = x ^ (x << 11); x = y; y = z; z = w; w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)); yield return w; } }
        static bool Chmax<T>(this ref T lhs, T rhs) where T : struct, IComparable<T> { if (lhs.CompareTo(rhs) < 0) { lhs = rhs; return true; } return false; }
        static bool Chmin<T>(this ref T lhs, T rhs) where T : struct, IComparable<T> { if (lhs.CompareTo(rhs) > 0) { lhs = rhs; return true; } return false; }
    }
}
namespace Library {
    class LIB_FastIO
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_FastIO() { str = Console.OpenStandardInput(); }
        readonly Stream str;
        readonly byte[] buf = new byte[2048];
        int len, ptr;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        byte read()
        {
            if (ptr >= len)
            {
                ptr = 0;
                if ((len = str.Read(buf, 0, 2048)) <= 0)
                {
                    return 0;
                }
            }
            return buf[ptr++];
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        char Char()
        {
            byte b = 0;
            do b = read();
            while (b < 33 || 126 < b);
            return (char)b;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public string Scan()
        {
            var sb = new StringBuilder();
            for (var b = Char(); b >= 33 && b <= 126; b = (char)read())
                sb.Append(b);
            return sb.ToString();
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public long Long()
        {
            long ret = 0; byte b = 0; var ng = false;
            do b = read();
            while (b != '-' && (b < '0' || '9' < b));
            if (b == '-') { ng = true; b = read(); }
            for (; true; b = read())
            {
                if (b < '0' || '9' < b)
                    return ng ? -ret : ret;
                else ret = (ret << 3) + (ret << 1) + b - '0';
            }
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        virtual public double Double() { return double.Parse(Scan(), CultureInfo.InvariantCulture); }
    }
    class LIB_FastIODebug : LIB_FastIO
    {
        Queue<string> param = new Queue<string>();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        string NextString() { if (param.Count == 0) foreach (var item in Console.ReadLine().Split(' ')) param.Enqueue(item); return param.Dequeue(); }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_FastIODebug() { }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override string Scan() => NextString();
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override long Long() => long.Parse(NextString());
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public override double Double() => double.Parse(NextString());
    }
    class LIB_UnionFind<T>
    {
        int[] d;
        T[] v;
        Func<T, T, T> f;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_UnionFind(IEnumerable<T> s, Func<T, T, T> func)
        {
            v = s.ToArray();
            d = Enumerable.Repeat(-1, v.Length).ToArray();
            f = func;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public bool Unite(long x, long y)
        {
            x = Root(x);
            y = Root(y);
            if (x != y)
            {
                d[x] = d[x] + d[y];
                v[x] = f(v[x], v[y]);
                d[y] = (int)x;
            }
            return x != y;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public bool IsSame(long x, long y) => Root(x) == Root(y);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public long Root(long x) => d[x] < 0 ? x : d[x] = (int)Root(d[x]);
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public long Count(long x) => -d[Root(x)];
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public T Calc(long x) => v[Root(x)];
    }
    class LIB_UnionFind : LIB_UnionFind<int>
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_UnionFind(long n) : base(Enumerable.Repeat(0, (int)n), (x, y) => x + y) { }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        new private void Calc(long x) { }
    }
    class LIB_PriorityQueue
    {
        long[] heap;
        int[] dat;
        public (long, int) Peek => (heap[0], dat[0]);
        public long Count
        {
            get;
            private set;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_PriorityQueue()
        {
            heap = new long[16];
            dat = new int[16];
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Push(long key, int val)
        {
            if (Count == heap.Length) Expand();
            var i = Count++;
            heap[i] = key;
            dat[i] = val;
            while (i > 0)
            {
                var ni = (i - 1) / 2;
                if (key <= heap[ni]) break;
                heap[i] = heap[ni];
                dat[i] = dat[ni];
                i = ni;
            }
            heap[i] = key;
            dat[i] = val;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public KeyValuePair<long, int> Pop()
        {
            var ret = new KeyValuePair<long, int>(heap[0], dat[0]);
            var key = heap[--Count];
            var val = dat[Count];
            if (Count == 0) return ret;
            var i = 0; while ((i << 1) + 1 < Count)
            {
                var i1 = (i << 1) + 1;
                var i2 = (i << 1) + 2;
                if (i2 < Count && heap[i1] < heap[i2]) i1 = i2;
                if (key >= heap[i1]) break;
                heap[i] = heap[i1];
                dat[i] = dat[i1];
                i = i1;
            }
            heap[i] = key;
            dat[i] = val;
            return ret;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        void Expand()
        {
            var tmp = new long[Count << 1];
            for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];
            heap = tmp;
            var tmp2 = new int[Count << 1];
            for (var i = 0; i < dat.Length; ++i) tmp2[i] = dat[i];
            dat = tmp2;
        }
    }
    class LIB_PriorityQueue<T>
    {
        T[] heap;
        Comparison<T> comp;
        public T Peek => heap[0];
        public long Count
        {
            get;
            private set;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_PriorityQueue(long cap, Comparison<T> cmp, bool asc = true)
        {
            heap = new T[cap];
            comp = asc ? cmp : (x, y) => cmp(y, x);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_PriorityQueue(Comparison<T> cmp, bool asc = true)
        {
            heap = new T[16];
            comp = asc ? cmp : (x, y) => cmp(y, x);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer<T>.Default.Compare, asc) { }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_PriorityQueue(bool asc = true) : this(Comparer<T>.Default.Compare, asc) { }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Push(T val)
        {
            if (Count == heap.Length) Expand();
            var i = Count++;
            heap[i] = val;
            while (i > 0)
            {
                var ni = (i - 1) / 2;
                if (comp(val, heap[ni]) >= 0) break;
                heap[i] = heap[ni];
                i = ni;
            }
            heap[i] = val;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public T Pop()
        {
            var ret = heap[0];
            var val = heap[--Count];
            if (Count == 0) return ret;
            var i = 0; while ((i << 1) + 1 < Count)
            {
                var i1 = (i << 1) + 1;
                var i2 = (i << 1) + 2;
                if (i2 < Count && comp(heap[i1], heap[i2]) > 0) i1 = i2;
                if (comp(val, heap[i1]) <= 0) break;
                heap[i] = heap[i1]; i = i1;
            }
            heap[i] = val;
            return ret;
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        void Expand()
        {
            var tmp = new T[Count << 1];
            for (var i = 0; i < heap.Length; ++i) tmp[i] = heap[i];
            heap = tmp;
        }
    }
    class LIB_PriorityQueue<TK, TV>
    {
        LIB_PriorityQueue<KeyValuePair<TK, TV>> q;
        public KeyValuePair<TK, TV> Peek => q.Peek;
        public long Count => q.Count;
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_PriorityQueue(long cap, Comparison<TK> cmp, bool asc = true)
        {
            q = new LIB_PriorityQueue<KeyValuePair<TK, TV>>(cap, (x, y) => cmp(x.Key, y.Key), asc);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_PriorityQueue(Comparison<TK> cmp, bool asc = true)
        {
            q = new LIB_PriorityQueue<KeyValuePair<TK, TV>>((x, y) => cmp(x.Key, y.Key), asc);
        }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_PriorityQueue(long cap, bool asc = true) : this(cap, Comparer<TK>.Default.Compare, asc) { }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public LIB_PriorityQueue(bool asc = true) : this(Comparer<TK>.Default.Compare, asc) { }
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Push(TK k, TV v) => q.Push(new KeyValuePair<TK, TV>(k, v));
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public KeyValuePair<TK, TV> Pop() => q.Pop();
    }
}


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

class Myon
{
    static Scanner cin;
    public Myon() { }
    public static int Main()
    {
        //Console.SetOut(new Printer(Console.OpenStandardOutput()));
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }

    int MAX = 400;
    int[] vy = { 1, 1, 0, -1, -1, -1, 0, 1 };
    int[] vx = { 0, 1, 1, 1, 0, -1, -1, -1};

    public void calc()
    {
        int[,] field = new int[MAX, MAX];
        bool[,] check = new bool[MAX, MAX];
        field[MAX / 2, MAX / 2] = 1;

        int N = cin.nextInt();
        for (int i = 0; i < N; i++)
        {
            int t = cin.nextInt();
            //step
            for (int j = 0; j < t; j++)
            {
                int[,] nextfield = new int[MAX, MAX];
                for (int y = 0; y < MAX; y++)
                {
                    for (int x = 0; x < MAX; x++)
                    {
                        if (field[y, x] == 0) continue;
                        for (int k = 0; k < 8; k++)
                        {
                            if(((field[y,x] >> k) & 1) == 1)
                            {
                                nextfield[y + vy[k], x + vx[k]] |= 1 << k;
                                check[y + vy[k], x + vx[k]] = true;
                            }
                        }

                    }
                }
                field = nextfield;
            }

            //change
            for (int y = 0; y < MAX; y++)
            {
                for (int x = 0; x < MAX; x++)
                {
                    if (field[y, x] == 0) continue;
                    int first = field[y, x] & 1;
                    int last = (field[y, x] >> 7) & 1;
                    field[y, x] = (field[y, x] << 1) | (field[y, x] >> 1);
                    field[y, x] &= 0xFF;
                    field[y, x] |= last;
                    field[y, x] |= first << 7;
                }
            }
        }
        int ans = 0;
        for (int y = 0; y < MAX; y++)
        {
            for (int x = 0; x < MAX; x++)
            {
                if (check[y, x]) ans++;
            }
        }
        Console.WriteLine(ans);

    }

}

class Printer : StreamWriter
{
    public override IFormatProvider FormatProvider { get { return CultureInfo.InvariantCulture; } }
    public Printer(Stream stream) : base(stream, new UTF8Encoding(false, true)) { }
    public Printer(Stream stream, Encoding encoding) : base(stream, encoding) { }
}

class Scanner
{
    string[] s;
    int i;

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

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

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

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

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

    public double nextDouble()
    {
        return double.Parse(next());
    }

}


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

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

            var arr = Console.ReadLine().Split(' ');
            var n = Int32.Parse(arr[0]);
            var k = Int32.Parse(arr[1]);

            Console.WriteLine(GetVal(n,k));
        }

        const int MOD_VAL = 1000000007;

        private static int GetVal(int n, int k)
        {
            var res = 1;
            if(k >= n)
            {
                for(var i = 0;i<n;i++)
                {
                    res = (res * 2) % MOD_VAL;
                }
                return res;
            }

            var factorials = GetFactorials(n);
            var revals = GetRevals(n, factorials[n]);

            for(var i = 1;i<=k;i++)
            {
                res = (int)((res + (long)factorials[n]*revals[i] % MOD_VAL * revals[n-i] % MOD_VAL) % MOD_VAL);
            }
            return res;
        }

        private static (int,int) ExGcd(int num0, int num1)
        {
            if (num0 % num1 == 0)
            {
                return (0, 1);
            }
            // a0 * num0 + b0 * num1 = num2
            var num2 = num0 % num1;
            var a0 = 1;
            var b0 = - (num0 / num1);
            // a1 * num1 + b1 * num2 = gcd
            var (a1,b1) = ExGcd(num1, num2);
            // (a0*b1) * num0 + (a1 + b0*b1) * num1 = gcd
            return (a0*b1, a1 + b0*b1);
        }

        private static int[] GetRevals(int n, int factorial)
        {
            var (_, tmpVal) = ExGcd(MOD_VAL, factorial);
            if(tmpVal < 0) tmpVal+=MOD_VAL;
            var revals = new int[n+1];
            revals[n] = tmpVal;
            for(var i = n-1;i>=0;i--)
            {
                revals[i] = (int)((long)revals[i+1] * (i+1) % MOD_VAL);
            }
            return revals;
        }

        private static int[] GetFactorials(int n)
        {
            var factorials = new int[n+1];
            factorials[0] = 1;
            for(var i = 1;i<=n;i++)
            {
                factorials[i] = (int)((long)factorials[i-1] * i % MOD_VAL);
            }
            return factorials;
        }

    }
}


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

namespace Codeforces_235_2
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] _bitcounts = new int[512];
            int pos1 = -1, pos2 = -1, i;
            for (i = 1; i < 512; i++, pos1++) {
                if (pos1 == pos2) {
                    pos1 = 0;
                    pos2 = i;
                }
                _bitcounts[i] = _bitcounts[pos1] + 1;
            }

            long n, m;
            string[] d = Console.ReadLine().Split(' ');
            n = long.Parse(d[0]);
            m = long.Parse(d[1]);

            int b, dictlen;
            long[] D = new long[18];
            int[] stat = new int[10];

            for (b = 0; 0 < n; ++b, n /= 10)
            {
                D[b] = n % 10;
                ++stat[D[b]];
            }

            long bb = 1L << b;
            long[,] dp = new long[bb, m];

            for (i = 0; i < b; ++i)
                if (0 < D[i]) dp[1 << i, D[i] % m] = 1;

            for (dictlen = 1; dictlen < b; ++dictlen)
            {
                for (long mask = 1; mask < bb; ++mask)
                    if ((_bitcounts[mask >> 9] + _bitcounts[mask & 0x1FF]) == dictlen)
                    {
                        for (i = 0; i < b; ++i)
                        {
                            long mask2 = mask | (1L << i);
                            if (mask2 != mask)
                                for (int x = 0; x < m; ++x)
                                    dp[mask2, (x * 10 + D[i]) % m] += dp[mask, x];
                        }
                    }
            }

            long ret = dp[bb - 1, 0];
            for (i = 0; i < 10; ++i)
                while (1 < stat[i])
                    ret /= stat[i]--;
            Console.WriteLine( ret );
        }
    }
}


using System;
using System.Linq;
using CompLib.Util;
using System.Threading;
using CompLib.Mathematics;

public class Program
{
    private int N, K;

    public void Solve()
    {
        var sc = new Scanner();
        N = sc.NextInt();
        K = sc.NextInt();

        /*
         * N*Nグリッド
         *
         * 各ますには 1~K書かれてる
         *
         * 各行、列の最小値は1
         *
         * 何通りか?
         */

        var c = new BinomialCoefficient(500);

        // i行目まで見る
        // j列に1がある
        ModInt[,] dp = new ModInt[N + 1, N + 1];
        dp[0, 0] = 1;
        for (int i = 0; i < N; i++)
        {
            for (int j = 0; j <= N; j++)
            {
                var cur = dp[i, j];
                for (int k = j; k <= N; k++)
                {
                    if (j == 0 && k == 0) continue;

                    ModInt mul;
                    if (j == k)
                    {
                        mul = (ModInt.Pow(K, j) - ModInt.Pow(K - 1, j)) * ModInt.Pow(K-1, N - j);
                    }
                    else
                    {
                        mul = ModInt.Pow(K, j) * c[N - j, k - j] * ModInt.Pow(K - 1, N - k);
                    }

                    dp[i + 1, k] += cur * mul;
                }
            }
        }

        Console.WriteLine(dp[N, N]);
    }

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

// https://bitbucket.org/camypaper/complib
namespace CompLib.Mathematics
{
    #region ModInt

    /// <summary>
    /// [0,<see cref="Mod"/>) までの値を取るような数
    /// </summary>
    public struct ModInt
    {
        /// <summary>
        /// 剰余を取る値．
        /// </summary>
        public const long Mod = (int) 1e9 + 7;
        // public const long Mod = 998244353;

        /// <summary>
        /// 実際の数値．
        /// </summary>
        public long num;

        /// <summary>
        /// 値が <paramref name="n"/> であるようなインスタンスを構築します．
        /// </summary>
        /// <param name="n">インスタンスが持つ値</param>
        /// <remarks>パフォーマンスの問題上，コンストラクタ内では剰余を取りません．そのため，<paramref name="n"/> ∈ [0,<see cref="Mod"/>) を満たすような <paramref name="n"/> を渡してください．このコンストラクタは O(1) で実行されます．</remarks>
        public ModInt(long n)
        {
            num = n;
        }

        /// <summary>
        /// このインスタンスの数値を文字列に変換します．
        /// </summary>
        /// <returns>[0,<see cref="Mod"/>) の範囲内の整数を 10 進表記したもの．</returns>
        public override string ToString()
        {
            return num.ToString();
        }

        public static ModInt operator +(ModInt l, ModInt r)
        {
            l.num += r.num;
            if (l.num >= Mod) l.num -= Mod;
            return l;
        }

        public static ModInt operator -(ModInt l, ModInt r)
        {
            l.num -= r.num;
            if (l.num < 0) l.num += Mod;
            return l;
        }

        public static ModInt operator *(ModInt l, ModInt r)
        {
            return new ModInt(l.num * r.num % Mod);
        }

        public static implicit operator ModInt(long n)
        {
            n %= Mod;
            if (n < 0) n += Mod;
            return new ModInt(n);
        }

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

        /// <summary>
        /// 与えられた 2 つの数値からべき剰余を計算します．
        /// </summary>
        /// <param name="v">べき乗の底</param>
        /// <param name="k">べき指数</param>
        /// <returns>繰り返し二乗法により O(N log N) で実行されます．</returns>
        public static ModInt Pow(long v, long k)
        {
            long ret = 1;
            for (k %= Mod - 1; k > 0; k >>= 1, v = v * v % Mod)
                if ((k & 1) == 1)
                    ret = ret * v % Mod;
            return new ModInt(ret);
        }

        /// <summary>
        /// 与えられた数の逆元を計算します．
        /// </summary>
        /// <param name="v">逆元を取る対象となる数</param>
        /// <returns>逆元となるような値</returns>
        /// <remarks>法が素数であることを仮定して，フェルマーの小定理に従って逆元を O(log N) で計算します．</remarks>
        public static ModInt Inverse(ModInt v)
        {
            return Pow(v, Mod - 2);
        }
    }

    #endregion

    #region Binomial Coefficient

    public class BinomialCoefficient
    {
        public ModInt[] fact, ifact;

        public BinomialCoefficient(int n)
        {
            fact = new ModInt[n + 1];
            ifact = new ModInt[n + 1];
            fact[0] = 1;
            for (int i = 1; i <= n; i++)
                fact[i] = fact[i - 1] * i;
            ifact[n] = ModInt.Inverse(fact[n]);
            for (int i = n - 1; i >= 0; i--)
                ifact[i] = ifact[i + 1] * (i + 1);
            ifact[0] = ifact[1];
        }

        public ModInt this[int n, int r]
        {
            get
            {
                if (n < 0 || n >= fact.Length || r < 0 || r > n) return 0;
                return fact[n] * ifact[n - r] * ifact[r];
            }
        }

        public ModInt RepeatedCombination(int n, int k)
        {
            if (k == 0) return 1;
            return this[n + k - 1, k];
        }
    }

    #endregion
}

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

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

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

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

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

            return _line[_index++];
        }

        public string ReadLine()
        {
            _index = _line.Length;
            return Console.ReadLine();
        }

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

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

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


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

class Myon
{
    public Myon() { }
    public static int Main()
    {
        new Myon().calc();
        return 0;
    }

    Scanner cin;

    long[] dp;

    void calc()
    {
        cin = new Scanner();
        int N = cin.nextInt();
        int MAX = 100005;
        long MAX2 = (long)1e18 + 10;

        dp = new long[MAX];
        dp[0] = f0.Length;
        for (int i = 1; i < MAX; i++)
        {
            if (dp[i - 1] > MAX2 / 2)
            {
                dp[i] = MAX2;
            }
            else
            {
                dp[i] = dp[i - 1] * 2 + s0.Length + s1.Length + s2.Length;
            }

        }

        for (int i = 0; i < N; i++)
        {
            a = cin.nextInt();
            b = cin.nextLong() - 1;

            while (a != -1) dfs();
            Console.Write(c);

        }
        Console.WriteLine();
    }

    int a;
    long b;
    char c = '.';

    string f0 = "What are you doing at the end of the world? Are you busy? Will you save us?";
    string s0 = "What are you doing while sending \"";
    string s1 = "\"? Are you busy? Will you send \"";
    string s2 = "\"?";

    void dfs()
    {
        if (b >= dp[a])
        {
            c = '.'; a = -1;
            return;
        }
        if(a == 0)
        {
            c = f0[(int)b]; a = -1;
            return;
        }
        if (b < s0.Length)
        {
            c = s0[(int)b]; a = -1;
            return;
        }
        b -= s0.Length;
        if (b < dp[a - 1])
        {
            a--;
            return;
        }
        b -= dp[a - 1];
        if (b < s1.Length)
        {
            c = s1[(int)b]; a = -1;
            return;
        }
        b -= s1.Length;
        if (b < dp[a - 1])
        {
            a--;
            return;
        }
        b -= dp[a - 1];
        c = s2[(int)b];
        a = -1;
        return;
    }
}

class Scanner
{
    string[] s;
    int i;

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

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

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

    public int nextInt()
    {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0)
    {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

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

    public long[] ArrayLong(int N, long add = 0)
    {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0)
    {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++)
        {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}


using System;

namespace Орехус_и_лифт
{
    class Program
    {
        static void Main(string[] args)
        {
            int T = 0;
            int n = Int32.Parse(Console.ReadLine());
            int[] A = Array.ConvertAll(Console.ReadLine().Split(), Convert.ToInt32);
            for (int i = 0; i < n; i++) T += A[i] * i * 4;
            Console.WriteLine(T);
        }
    }
}


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

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(s => int.Parse(s));
            var ps = input.Take(4);
            var a = input.Skip(4).First();
            var b = input.Skip(5).First();
            int count =0;
            for (int i = a; i <= b; i++)
            {
                var t = i;
                foreach (var x in ps)
                {
                    t  %= x;
                }
                if (t == i) count++;
            }
            Console.WriteLine(count);
        }
    }
}


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

namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int a ,b, c, d,m,n;
            a =int.Parse(Console.ReadLine());
            b = int.Parse(Console.ReadLine());
            c = int.Parse(Console.ReadLine());
            d = int.Parse(Console.ReadLine());
            m = (a * 2) + (b) + (c);
            n = (d * 2) + (b) + (c);
            if ((a == 0 && d == 0 && c != 0) || m!= n)
            {
                    Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(1);
            }

        }
    }
}


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

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

        private static void Main(string[] args)
        {
            int p = Next();
            int x = Next();
            int y = Next();

            for (int i = x; i >= y; i -= 50)
            {
                if (Check(p, (i/50)%475))
                {
                    writer.WriteLine("0");
                    writer.Flush();
                    return;
                }
            }

            for (int w = 1;; w++)
            {
                if (Check(p, ((x + w*100 - 50)/50)%475) || Check(p, ((x + w*100)/50)%475))
                {
                    writer.WriteLine(w);
                    break;
                }
            }

            writer.Flush();
        }

        private static bool Check(int p, int i)
        {
            for (int j = 0; j < 25; j++)
            {
                i = (i*96 + 42)%475;
                if (26 + i == p)
                {
                    return true;
                }
            }
            return false;
        }

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


/*
У вас есть два друга. Вы хотите подарить каждому другу некоторое количество целых положительных чисел. Первому другу вы хотите подарить cnt1 чисел, второму — cnt2 чисел. Более того, вы хотите, чтобы все подаренные числа были различными, в частности, ни одно число не должно достаться обоим друзьям.

Кроме этого, первый друг не любит числа, которые делятся без остатка на простое число x. Второй друг не любит числа, которые делятся без остатка на простое число y. Конечно, вы не будете дарить друзьям числа, которые они не любят.

Ваша задача — найти такое минимальное число v, такое что из набора чисел 1, 2, ..., v можно составить подарки друзьям. Естественно, некоторые числа можно не дарить никому из них.

Положительное целое число, большее единицы, называется простым, если оно не делится нацело ни на одно положительное целое число кроме единицы и себя самого.
Входные данные

В первой строке записано четыре целых положительных числа cnt1, cnt2, x, y (1 ≤ cnt1, cnt2 < 109; cnt1 + cnt2 ≤ 109; 2 ≤ x < y ≤ 3·104) — описанные в условии числа. Гарантируется, что числа x, y являются простыми числами.
Выходные данные

Выведите единственное целое число — ответ на задачу.*/
using System;

namespace _483B
{
    class Program
    {
        private static long HigherDividend(long x, long diveder)
        {
            if (x%diveder == 0)
                return x;
            if (x < diveder)
                return 0;
            var left = x - diveder;
            var right = x;
            var middle = (left + right)/2;
            while (middle%diveder != 0)
            {
                if (middle/diveder < x/diveder)
                    left = middle;
                else
                    right = middle;
                middle = (left + right)/2;
            }
            return middle;
        }

        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ');
            var cnt1 = long.Parse(input[0]);
            var cnt2 = long.Parse(input[1]);
            var x = long.Parse(input[2]);
            var y = long.Parse(input[3]);

            long count = 0;
            long barrier = cnt1 + cnt2;
            while (count != cnt1 + cnt2)
            {
                long bad = HigherDividend(barrier, x*y)/(x*y);
                long xCountCommon = HigherDividend(barrier, y) / y - bad;
                long yCountCommon = HigherDividend(barrier, x) / x - bad;
                long xCount = Math.Min(xCountCommon, cnt1);
                long yCount = Math.Min(yCountCommon, cnt2);
                if (xCount < xCountCommon)
                    bad += xCountCommon - xCount;
                if (yCount < yCountCommon)
                    bad += yCountCommon - yCount;
                long good = barrier - bad - xCount - yCount;
                count = good + xCount + yCount;
                barrier += cnt1 + cnt2 - count;
            }

            Console.Write(barrier);
        }
    }
}


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

namespace tc_cf_c_sharp
{
    class MyIO
    {
        TextReader reader;
        TextWriter writer=Console.Out;
        string[] tokens;
        int pointer;
        public MyIO(TextReader rd)
        {
            reader = rd;
        }
        public string NextLine()
        {
            try
            {
                return reader.ReadLine();
            }
            catch (IOException)
            {
                return null;
            }
        }
        public string NextString()
        {
            try
            {
                while (tokens == null || pointer >= tokens.Length)
                {
                    tokens = NextLine().Split(new char[]{' '},System.StringSplitOptions.RemoveEmptyEntries);
                    pointer = 0;
                }
                return tokens[pointer++];
            }
            catch (IOException)
            {
                return null;
            }
        }
        public int NextInt()
        {
            return int.Parse(NextString());
        }
        public long NextLong()
        {
            return long.Parse(NextString());
        }
        public double NextDouble()
        {
            return double.Parse(NextString());
        }
        public void Write(string format, params object[] args)
        {
            writer.Write(format, args);
        }
        public void WriteLine(string format, params object[] args)
        {
            writer.WriteLine(format, args);
        }
    }
    class Program
    {
        static long[, , ,] dp;
        const long mod = 100000000;
        static void Main(string[] args)
        {
            MyIO myio = new MyIO(Console.In);
            //MyIO myio = new MyIO(new StreamReader(File.OpenRead(@"D:\project\tc cf c sharp\tc cf c sharp\in.txt")));
            int n1 = myio.NextInt(), n2 = myio.NextInt(), k1 = myio.NextInt(), k2 = myio.NextInt();
            dp=new long [105,105,12,12];
            for (int i = 0; i < 105; i++) for (int j = 0; j < 105; j++) for (int k = 0; k < 12; k++) for (int l = 0; l < 12; l++)
                            dp[i, j, k, l] = 0;
            dp[0,0,0,0] = 1;
            for (int i = 0; i <= n1; i++) for (int j = 0; j <= n2; j++) for (int k = 0; k <= k1; k++) for (int l = 0; l <= k2; l++)
                        {
                            dp[i, j, k, l] %= mod;
                            dp[i + 1, j, k + 1, 0] += dp[i, j, k, l];
                            dp[i, j + 1, 0, l + 1] += dp[i, j, k, l];
                        }
            long res = 0;
            for (int k = 0; k <= k1; k++) for (int l = 0; l <= k2; l++) res += dp[n1, n2, k, l];
            res %= mod;
            myio.WriteLine("{0}",res);
        }
    }
}


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

namespace Solution {

    class Solution {

        class StdIn {
            int currPos = 0;
            string[] tokens = new string[0];

            private string getNextToken() {
                if (currPos < tokens.Length) return tokens[currPos++];
                currPos = 0;
                tokens = Console.ReadLine().Split(new char[] { ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                return tokens[currPos++];
            }

            public int nextInt() {
                return int.Parse(getNextToken());
            }

            public string nextString() {
                return getNextToken();
            }

            public double nextDouble() {
                return double.Parse(getNextToken());
            }

            public long nextLong() {
                return long.Parse(getNextToken());
            }
        }

        public static void swap<T>(ref T a, ref T b) {
            T c = a;
            a = b;
            b = c;
        }

        static int countPowers(int p, int n) {
            int result = 0;
            int curr = 1;
            while (n / p >= curr) {
                ++result;
                curr *= p;
                if (n/curr >= curr) Used.Add(curr);
            }
            return result;
        }

        static HashSet<int> Used = new HashSet<int>();
        static Dictionary<int, int> D = new Dictionary<int, int>();

        static int bitmask(ref List<int> p) {
            int result = 0;
            for (int i = 0; i < p.Count; ++i)
                result = 2 * result + p[i];
            return result;
        }

        static int fun(ref List<int> p) {
            if (D.ContainsKey(bitmask(ref p))) {
                return D[bitmask(ref p)];
            }
            HashSet<int> s = new HashSet<int>();
            for (int i = 0; i < p.Count; ++i) if (p[i] == 1) {
                List<int> n = new List<int>(p);
                for (int j = 0; j < n.Count; ++j) if ((j + 1) % (i + 1) == 0) n[j] = 0;
                s.Add(fun(ref n));
            }
            int result = 0;
            while (s.Contains(result)) ++result;
            D[bitmask(ref p)] = result;
            return result;
        }

        static int getSprague(int len) {
            int[] ans = new int[] {0, 1,
2,
1,
4,
3,
2,
1,
5,
6,
2,
1,
8,
7,
5,
9,
8,
7,
3,
4,
7,
4,
2,
1,
10,
9,
3,
6,
11,
12};

            // SG for group of powers
            /*
            D.Clear();
            D[0] = 0;

            List<int> p = new List<int>();
            for (int i = 0; i < len; ++i) p.Add(1);
            //Console.WriteLine(len + " " + fun(ref p));
            return fun(ref p);
             */
            return ans[len];
        }

        public static void Main(string[] args) {
            StdIn std = new StdIn();

            int n = std.nextInt();
            int ans = 0;

            int totcnt = n;

            for (int i = 2; i * i <= n; ++i) if (!Used.Contains(i)) {
                int cnt = countPowers(i, n);
                totcnt -= cnt;
                ans ^= getSprague(cnt);
            }

            if (totcnt % 2 > 0) ans ^= 1;

            if (ans > 0) Console.WriteLine("Vasya");
            else Console.WriteLine("Petya");

            Console.ReadLine();
        }
    }
}