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

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

namespace Codeforces
{
    public class Input
    {
        private static string _line;

        public static bool Next()
        {
            _line = Console.ReadLine();
            return _line != null;
        }

        public static bool Next(out long a)
        {
            var ok = Next();
            a = ok ? long.Parse(_line) : 0;
            return ok;
        }

        public static bool Next(out long a, out long b)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
            }
            else
            {
                a = b = 0;
            }

            return ok;
        }

        public static bool Next(out long a, out long b, out long c)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
            }
            else
            {
                a = b = c = 0;
            }
            return ok;
        }

        public static bool Next(out long a, out long b, out long c, out long d)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
            }
            else
            {
                a = b = c = d = 0;
            }
            return ok;
        }

        public static bool Next(out long a, out long b, out long c, out long d, out long e)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(long.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
                e = array[4];
            }
            else
            {
                a = b = c = d = e = 0;
            }
            return ok;
        }

        public static bool Next(out int a)
        {
            var ok = Next();
            a = ok ? int.Parse(_line) : 0;
            return ok;
        }

        public static bool Next(out int a, out int b)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(int.Parse).ToArray();
                a = array[0];
                b = array[1];
            }
            else
            {
                a = b = 0;
            }

            return ok;
        }

        public static bool Next(out int a, out int b, out int c)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(int.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
            }
            else
            {
                a = b = c = 0;
            }
            return ok;
        }

        public static bool Next(out int a, out int b, out int c, out int d)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(int.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
            }
            else
            {
                a = b = c = d = 0;
            }
            return ok;
        }

        public static bool Next(out int a, out int b, out int c, out int d, out int e)
        {
            var ok = Next();
            if (ok)
            {
                var array = _line.Split(' ').Select(int.Parse).ToArray();
                a = array[0];
                b = array[1];
                c = array[2];
                d = array[3];
                e = array[4];
            }
            else
            {
                a = b = c = d = e = 0;
            }
            return ok;
        }

        public static IEnumerable<long> ArrayLong()
        {
            return !Next() ? new List<long>() : _line.Split().Select(long.Parse);
        }

        public static IEnumerable<int> ArrayInt()
        {
            return !Next() ? new List<int>() : _line.Split().Select(int.Parse);
        }

        public static bool Next(out string value)
        {
            value = string.Empty;
            if (!Next()) return false;
            value = _line;
            return true;
        }
    }

    public class DisjointSet
    {
        private readonly int[] _parent;
        private readonly int[] _rank;
        public int Count { get; private set; }

        public DisjointSet(int count, int initialize = 0)
        {
            Count = count;
            _parent = new int[Count];
            _rank = new int[Count];
            for (var i = 0; i < initialize; i++) _parent[i] = i;
        }

        private DisjointSet(int count, int[] parent, int[] rank)
        {
            Count = count;
            _parent = parent;
            _rank = rank;
        }

        public void Add(int v)
        {
            _parent[v] = v;
            _rank[v] = 0;
        }

        public int Find_Recursive(int v)
        {
            if (_parent[v] == v) return v;
            return _parent[v] = Find(_parent[v]);
        }

        public int Find(int v)
        {
            if (_parent[v] == v) return v;
            var last = v;
            while (_parent[last] != last) last = _parent[last];
            while (_parent[v] != v)
            {
                var t = _parent[v];
                _parent[v] = last;
                v = t;
            }
            return last;
        }

        public int this[int v]
        {
            get { return Find(v); }
            set { Union(v, value); }
        }

        public void Union(int a, int b)
        {
            a = Find(a);
            b = Find(b);
            if (a == b) return;
            if (_rank[a] < _rank[b])
            {
                var t = _rank[a];
                _rank[a] = _rank[b];
                _rank[b] = t;
            }
            _parent[b] = a;
            if (_rank[a] == _rank[b]) _rank[a]++;
        }

        public int GetSetCount()
        {
            var result = 0;
            for (var i = 0; i < Count; i++)
            {
                if (_parent[i] == i) result++;
            }
            return result;
        }

        public DisjointSet Clone()
        {
            var rank = new int[Count];
            _rank.CopyTo(rank, 0);
            var parent = new int[Count];
            _parent.CopyTo(parent, 0);
            return new DisjointSet(Count, parent, rank);
        }

        public override string ToString()
        {
            return string.Join(",", _parent.Take(50));
        }
    }

    public class Matrix
    {
        public static Matrix Create(int i, int j)
        {
            var m = new Matrix(i, j);
            return m;
        }

        public static Matrix Create(int i)
        {
            var m = new Matrix(i, i);
            return m;
        }

        public long Modulo { get; set; }

        private readonly int _width;
        private readonly int _height;
        private readonly long[,] _data;
        public int Width { get { return _width; } }
        public int Height { get { return _height; } }

        private Matrix(int i, int j)
        {
            Modulo = 1000000000000000000L;
            _width = j;
            _height = i;
            _data = new long[_height, _width];
        }

        public static Matrix operator *(Matrix m1, Matrix m2)
        {
            if (m1.Width != m2.Height) throw new InvalidDataException("m1.Width != m2.Height");
            var m = Create(m2.Width, m1.Height);
            m.Modulo = m1.Modulo;
            for (var i = 0; i < m2.Width; i++)
                for (var j = 0; j < m1.Height; j++)
                {
                    for (var k = 0; k < m1.Width; k++)
                        m[j, i] += (m1[j, k] * m2[k, i]) % m1.Modulo;
                    m[j, i] %= m1.Modulo;
                }
            return m;
        }

        public static Matrix operator +(Matrix m1, Matrix m2)
        {
            var m = m1.Clone();
            for (var i = 0; i < m2.Width; i++)
                for (var j = 0; j < m1.Height; j++)
                    m[j, i] = (m[j, i] + m2[j, i]) % m1.Modulo;
            return m;
        }

        public static Matrix operator -(Matrix m1, Matrix m2)
        {
            var m = m1.Clone();
            for (var i = 0; i < m2.Width; i++)
                for (var j = 0; j < m1.Height; j++)
                    m[j, i] = (m[j, i] - m2[j, i]) % m1.Modulo;
            return m;
        }

        public static Matrix operator *(Matrix m1, long l)
        {
            var m = m1.Clone();
            for (var i = 0; i < m1.Width; i++)
                for (var j = 0; j < m1.Height; j++)
                    m[j, i] = (m[j, i] * l) % m.Modulo;
            return m;
        }

        public static Matrix operator *(long l, Matrix m1)
        {
            return m1 * l;
        }

        public static Matrix operator +(Matrix m1, long l)
        {
            var m = m1.Clone();
            for (var i = 0; i < m1.Width; i++)
                m[i, i] = (m[i, i] + l) % m.Modulo;
            return m;
        }

        public static Matrix operator +(long l, Matrix m1)
        {
            return m1 + l;
        }

        public static Matrix operator -(Matrix m1, long l)
        {
            return m1 + (-l);
        }

        public static Matrix operator -(long l, Matrix m1)
        {
            var m = m1.Clone() * -1;
            return m + l;
        }

        public Matrix BinPower(long l)
        {
            var n = 1;
            var m = Clone();
            var result = new Matrix(m.Height, m.Width) + 1;
            result.Modulo = m.Modulo;
            while (l != 0)
            {
                var i = l & ~(l - 1);
                l -= i;
                while (n < i)
                {
                    m = m * m;
                    n <<= 1;
                }
                result *= m;
            }
            return result;
        }

        public void Fill(long l)
        {
            l %= Modulo;
            for (var i = 0; i < _height; i++)
                for (var j = 0; j < _width; j++)
                    _data[i, j] = l;
        }

        public Matrix Clone()
        {
            var m = new Matrix(_width, _height);
            Array.Copy(_data, m._data, _data.Length);
            m.Modulo = Modulo;
            return m;
        }

        public long this[int i, int j]
        {
            get { return _data[i, j]; }
            set { _data[i, j] = value % Modulo; }
        }
    }

    public class RedBlackTree<TKey, TValue> : IEnumerable<KeyValuePair<TKey, TValue>>
    {
        private readonly List<Node> _items = new List<Node>();
        private Node _root;
        private readonly IComparer<TKey> _comparer;

        public RedBlackTree()
        {
            _comparer = Comparer<TKey>.Default;
        }

        private Node _search(TKey key)
        {
            var node = _root;
            while (node != null)
            {
                var i = _comparer.Compare(key, node.Key);
                if (i == 0) return node;
                node = i > 0 ? node.Right : node.Left;
            }
            return null;
        }

        public void Add(TKey key, TValue value)
        {
            var node = new Node { Key = key, Value = value, Red = true };
            _items.Add(node);
            if (_root == null)
            {
                _root = node;
                _root.Red = false;
                return;
            }
            var x = _root;
            Node y = null;
            while (x != null)
            {
                y = x;
                x = _comparer.Compare(key, x.Key) > 0 ? x.Right : x.Left;
            }
            node.Parent = y;
            if (y == null) _root = node;
            else if (_comparer.Compare(key, y.Key) > 0) y.Right = node;
            else y.Left = node;
            InsertFixup(node);
        }

        private void InsertFixup(Node node)
        {
            while (true)
            {
                var parent = node.Parent;
                if (parent == null || !parent.Red || parent.Parent == null) break;
                var grand = parent.Parent;

                if (parent == grand.Left)
                {
                    var uncle = grand.Right;
                    if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */
                    {
                        parent.Red = false;
                        uncle.Red = false;
                        grand.Red = true;
                        node = grand; /* and continue fixing tree for grand */
                    }
                    else if (node == parent.Right) /* we rotate around the parent */
                    {
                        node = parent;
                        RotateLeft(node);
                    }
                    else /* rotate around grand and switch colors of grand and parent */
                    {
                        parent.Red = false;
                        grand.Red = true;
                        RotateRight(grand);
                        if (grand == _root) _root = parent;
                        break; /* and finish since tree is fixed */
                    }
                }
                else
                {
                    if (_root.Parent != null) Debugger.Break();

                    var uncle = grand.Left;
                    if (uncle != null && uncle.Red) /* parent and uncle both red: we could swap colors of them with grand */
                    {
                        parent.Red = false;
                        uncle.Red = false;
                        grand.Red = true;
                        node = grand; /* and continue fixing tree for grand */
                    }
                    else if (node == parent.Left) /* we rotate around the parent */
                    {
                        node = parent;
                        RotateRight(node);
                    }
                    else /* rotate around grand and switch colors of grand and parent */
                    {
                        parent.Red = false;
                        grand.Red = true;
                        RotateLeft(grand);
                        if (grand == _root) _root = parent;
                        break; /* and finish since tree is fixed */
                    }
                }
            }
            _root.Red = false;
        }

        private void RotateLeft(Node node)
        {
            if (node.Right == null)
                throw new NotSupportedException("Cannot rotate left: right node is missing");
            var parent = node.Parent;
            var right = node.Right;
            right.Parent = parent;
            if (parent != null)
            {
                if (parent.Left == node) parent.Left = right;
                else parent.Right = right;
            }
            node.Right = right.Left;
            if (node.Right != null)
                node.Right.Parent = node;
            right.Left = node;
            node.Parent = right;
        }

        private void RotateRight(Node node)
        {
            if (node.Left == null)
                throw new NotSupportedException("Cannot rotate right: left node is missing");
            var parent = node.Parent;
            var left = node.Left;
            left.Parent = parent;
            if (parent != null)
            {
                if (parent.Left == node) parent.Left = left;
                else parent.Right = left;
            }
            node.Left = left.Right;
            if (node.Left != null)
                node.Left.Parent = node;
            left.Right = node;
            node.Parent = left;
        }

        public void Remove(TKey key)
        {
            var node = _search(key);
            if (node == null) return;

            var deleted = node.Left == null || node.Right == null ? node : Next(node);
            var child = deleted.Left ?? deleted.Right;
            if (child != null)
                child.Parent = deleted.Parent;
            if (deleted.Parent == null) /* root */
                _root = child;
            else if (deleted == deleted.Parent.Left)
                deleted.Parent.Left = child;
            else
                deleted.Parent.Right = child;
            if (node != deleted)
            {
                node.Key = deleted.Key;
                node.Value = deleted.Value;
            }

            if (!deleted.Red)
            {
                DeleteFixup(child, deleted.Parent);
            }
        }

        private void DeleteFixup(Node node, Node parent)
        {
            while (parent != null && (node == null || !node.Red))
            {
                if (node == parent.Left)
                {
                    var brother = parent.Right;
                    if (brother.Red)
                    {
                        brother.Red = false;
                        parent.Red = true;
                        RotateLeft(parent);
                        brother = parent.Right;
                    }
                    if ((brother.Left == null || !brother.Left.Red) && (brother.Right == null || !brother.Right.Red))
                    {
                        node = parent.Red ? _root : parent;
                        brother.Red = true;
                        parent.Red = false;
                    }
                    else
                    {
                        if (brother.Right == null || !brother.Right.Red)
                        {
                            if (brother.Left != null)
                                brother.Left.Red = false;
                            brother.Red = true;
                            RotateRight(brother);
                            brother = parent.Right;
                        }
                        if (!brother.Right.Red) Debugger.Break();
                        brother.Red = parent.Red;
                        parent.Red = false;
                        if (brother.Right != null)
                            brother.Right.Red = false;
                        RotateLeft(parent);
                        node = _root;
                    }
                }
                else
                {
                    var brother = parent.Left;
                    if (brother.Red)
                    {
                        brother.Red = false;
                        parent.Red = true;
                        RotateRight(parent);
                        brother = parent.Left;
                    }
                    if ((brother.Right == null || !brother.Right.Red) && (brother.Left == null || !brother.Left.Red))
                    {
                        node = parent.Red ? _root : parent;
                        brother.Red = true;
                        parent.Red = false;
                    }
                    else
                    {
                        if (brother.Left == null || !brother.Left.Red)
                        {
                            if (brother.Right != null)
                                brother.Right.Red = false;
                            brother.Red = true;
                            RotateLeft(brother);
                            brother = parent.Left;
                        }
                        brother.Red = parent.Red;
                        parent.Red = false;
                        if (brother.Left != null)
                            brother.Left.Red = false;
                        RotateRight(parent);
                        node = _root;
                    }
                }
                parent = node.Parent;
            }

            node.Red = false;
        }

        public TValue this[TKey key]
        {
            get
            {
                var node = _search(key);
                return node == null ? default(TValue) : node.Value;
            }
            set
            {
                var node = _search(key);
                if (node == null) Add(key, value);
                else node.Value = value;
            }
        }

        public bool Check()
        {
            int count;
            return _root == null || _root.Check(out count);
        }

        private Node Minimum(Node node)
        {
            var result = node;
            while (result.Left != null) result = result.Left;
            return result;
        }

        private Node Maximum(Node node)
        {
            var result = node;
            while (result.Right != null) result = result.Right;
            return result;
        }

        private Node Next(Node node)
        {
            Node result;
            if (node.Right != null)
            {
                result = Minimum(node.Right);
            }
            else
            {
                while (node.Parent != null && node.Parent.Right == node)
                    node = node.Parent;
                result = node.Parent;
            }
            return result;
        }

        private Node Previous(Node node)
        {
            Node result;
            if (node.Left != null)
            {
                result = Maximum(node.Left);
            }
            else
            {
                while (node.Parent != null && node.Parent.Left == node)
                    node = node.Parent;
                result = node.Parent;
            }
            return result;
        }

        public void Print()
        {
            var node = Minimum(_root);
            while (node != null)
            {
                Console.Write(node.Red ? '*' : ' ');
                Console.Write(node.Key);
                Console.Write('\t');
                node = Next(node);
            }
        }

        #region Nested classes

        [DebuggerDisplay("{ToString()}")]
        private sealed class Node
        {
            public TKey Key;
            public TValue Value;
            public bool Red;

            public Node Parent;
            public Node Left;
            public Node Right;

            public bool Check(out int count)
            {
                count = 0;
                if (Red)
                {
                    if (Left != null && Left.Red) return false;
                    if (Right != null && Right.Red) return false;
                }
                var left = 0;
                var right = 0;
                if (Left != null && !Left.Check(out left)) return false;
                if (Right != null && !Right.Check(out right)) return false;
                count = left + (Red ? 0 : 1);
                if (left != right)
                {
                    ;
                }
                return left == right;
            }

            public override string ToString()
            {
                return ToShortString(2);
            }

            private string ToShortString(int depth = 0)
            {
                return depth == 0
                    ? string.Format("{0}{1}", Red ? "*" : "", Key)
                    : string.Format("({1}<{0}>{2})", ToShortString(), Left == null ? "null" : Left.ToShortString(depth - 1), Right == null ? "null" : Right.ToShortString(depth - 1));
            }
        }

        #endregion

        #region IEnumerable

        public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
        {
            throw new NotImplementedException();
        }

        IEnumerator IEnumerable.GetEnumerator()
        {
            return GetEnumerator();
        }

        #endregion
    }

    /// <summary>
    /// Prime numbers
    /// </summary>
    public class Primes
    {
        /// <summary>
        /// Returns prime numbers in O(n)
        /// Returns lowet divisors as well
        /// Memory O(n)
        /// </summary>
        public static void ImprovedSieveOfEratosthenes(int n, out int[] lp, out List<int> pr)
        {
            lp = new int[n];
            pr = new List<int>();
            for (var i = 2; i < n; i++)
            {
                if (lp[i] == 0)
                {
                    lp[i] = i;
                    pr.Add(i);
                }
                foreach (var prJ in pr)
                {
                    var prIj = i * prJ;
                    if (prJ <= lp[i] && prIj <= n - 1)
                    {
                        lp[prIj] = prJ;
                    }
                    else
                    {
                        break;
                    }
                }
            }
        }

        /// <summary>
        /// Returns prime numbers in O(n*n)
        /// </summary>
        public static void SieveOfEratosthenes(int n, out List<int> pr)
        {
            var m = 50000;//(int)(3l*n/(long)Math.Log(n)/2);
            pr = new List<int>();
            var f = new bool[m];
            for (var i = 2; i * i <= n; i++)
                if (!f[i])
                    for (var j = (long)i * i; j < m && j * j < n; j += i)
                        f[j] = true;
            pr.Add(2);
            for (var i = 3; i * i <= n; i += 2)
                if (!f[i])
                    pr.Add(i);
        }

        /// <summary>
        /// Greatest common divisor
        /// </summary>
        public static int Gcd(int x, int y)
        {
            while (y != 0)
            {
                var c = y;
                y = x % y;
                x = c;
            }
            return x;
        }

        /// <summary>
        /// Greatest common divisor
        /// </summary>
        public static long Gcd(long x, long y)
        {
            while (y != 0)
            {
                var c = y;
                y = x % y;
                x = c;
            }
            return x;
        }

        /// <summary>
        /// Greatest common divisor
        /// </summary>
        public static BigInteger Gcd(BigInteger x, BigInteger y)
        {
            while (y != 0)
            {
                var c = y;
                y = x % y;
                x = c;
            }
            return x;
        }

        /// <summary>
        /// Returns all divisors of n in O(√n)
        /// </summary>
        public static IEnumerable<long> GetDivisors(long n)
        {
            long r;
            while (true)
            {
                var x = Math.DivRem(n, 2, out r);
                if (r != 0) break;
                n = x;
                yield return 2;
            }
            var i = 3;
            while (i <= Math.Sqrt(n))
            {
                var x = Math.DivRem(n, i, out r);
                if (r == 0)
                {
                    n = x;
                    yield return i;
                }
                else i += 2;
            }
            if (n != 1) yield return n;
        }
    }

}

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

        void Solve()
        {
            long n, M;
            Input.Next(out n, out M);
            var str = n.ToString(CultureInfo.InvariantCulture);
            var a = str.ToCharArray().Select(c => int.Parse(c.ToString())).ToArray();
            var N = str.Count();
            var setsCount = 1 << N;
            var counts = new int[10];

            var factor = 1L;
            foreach (var ch in a)
                factor *= ++counts[ch];

            var dp = new long[setsCount, M];

            for(var i=0;i<N;i++)
                if (a[i] != 0)
                    dp[1 << i, a[i] % M] = 1;

            for (var i = 1; i < setsCount; i++)
                for (var m = 0; m < M; m++)
                    if (dp[i,m] != 0)
                        for (var j = 0; j < N; j++)
                            if ((i & (1 << j)) == 0)
                                dp[i | (1 << j), (m*10 + a[j])%M] += dp[i, m];

            var result = dp[setsCount-1, 0]/factor;
            Console.WriteLine(result);
        }
    }
}


using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics;
using Debug = System.Diagnostics.Trace;
using SB = System.Text.StringBuilder;
using static System.Math;
using Number = System.Int32;
using System.Numerics;

namespace Program {
	public class Solver {
		Random rnd = new Random();
		public void Solve() {
			var n = ri;
			var a = Enumerate(n, x => ri);
			var dp = new int[n + 5, n + 5, 2];
			for (int i = 0; i <= n; i++)
				for (int j = 0; j <= n; j++)
					dp[i, j, 0] = dp[i, j, 1] = 1000000000;
			dp[0, 0, 0] = dp[0, 0, 1] = 0;
			for (int i = 0; i <= n; i++)
				for (int j = 0; i + j < n; j++)
					for (int k = 0; k < 2; k++)
						for (int l = 0; l < 2; l++) {
							var next = (i + j);
							if (a[next] != 0 && a[next] % 2 != l) continue;
							var ni = i; var nj = j;
							if (l == 0) ni++;
							else nj++;
							var nx = dp[i, j, k] + (k ^ l);
							dp[ni, nj, l] = Min(dp[ni, nj, l], nx);
						}
			var ans = new int[] { dp[n / 2, (n + 1) / 2, 0], dp[n / 2, (n + 1) / 2, 1] }.Min();
			Console.WriteLine(ans);

		}

		const long INF = 1L << 60;
		static int[] dx = { -1, 0, 1, 0 };
		static int[] dy = { 0, 1, 0, -1 };
		int ri { get { return sc.Integer(); } }
		long rl { get { return sc.Long(); } }
		double rd { get { return sc.Double(); } }
		string rs { get { return sc.Scan(); } }
		public IO.StreamScanner sc = new IO.StreamScanner(Console.OpenStandardInput());

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

#region main
static class Ex {
	static public string AsString(this IEnumerable<char> ie) { return new string(ie.ToArray()); }
	static public string AsJoinedString<T>(this IEnumerable<T> ie, string st = " ") {
		return string.Join(st, ie);
	}
	static public void Main() {
		Console.SetOut(new Program.IO.Printer(Console.OpenStandardOutput()) { AutoFlush = true });
		var solver = new Program.Solver();
		//*
		var t = new System.Threading.Thread(solver.Solve, 50000000);
		t.Start();
		t.Join();
		//*/
		// solver.Solve();
		Console.Out.Flush();
	}
}
#endregion
#region Ex
namespace Program.IO {
	using System.IO;
	using System.Text;
	using System.Globalization;

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

	public class StreamScanner {
		public StreamScanner(Stream stream) { str = stream; }

		public readonly Stream str;
		private readonly byte[] buf = new byte[1024];
		private int len, ptr;
		public bool isEof = false;
		public bool IsEndOfStream { get { return isEof; } }

		private byte read() {
			if (isEof) return 0;
			if (ptr >= len) {
				ptr = 0;
				if ((len = str.Read(buf, 0, 1024)) <= 0) {
					isEof = true;
					return 0;
				}
			}
			return buf[ptr++];
		}

		public char Char() {
			byte b = 0;
			do b = read(); while ((b < 33 || 126 < b) && !isEof);
			return (char)b;
		}
		public string Scan() {
			var sb = new StringBuilder();
			for (var b = Char(); b >= 33 && b <= 126; b = (char)read()) sb.Append(b);
			return sb.ToString();
		}
		public string ScanLine() {
			var sb = new StringBuilder();
			for (var b = Char(); b != '\n' && b != 0; b = (char)read()) if (b != '\r') sb.Append(b);
			return sb.ToString();
		}
		public long Long() { return isEof ? long.MinValue : long.Parse(Scan()); }
		public int Integer() { return isEof ? int.MinValue : int.Parse(Scan()); }
		public double Double() { return isEof ? double.NaN : double.Parse(Scan(), CultureInfo.InvariantCulture); }
	}
}

#endregion


using System;
using System.Collections.Generic;
using System.Linq;
using Solver.Ex;
using Debug = System.Diagnostics.Debug;
using Watch = System.Diagnostics.Stopwatch;
using StringBuilder = System.Text.StringBuilder;
using System.Numerics;
namespace Solver
{
    public class Solver
    {
        public void Solve()
        {
            var n = sc.Integer();
            var m = sc.Integer();
            if (n == 1)
                IO.Printer.Out.WriteLine("1.000000");
            else
            {
                double N = n;
                double M = m;
                var p = 1 / N;
                var q = (M - 1) / (N * M - 1);
                IO.Printer.Out.WriteLine(p+(1-p)*q);
            }
        }

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

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

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

    }
    #endregion
}

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

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

    }
}
#endregion


using System;
using System.Linq;

namespace VK_Cup
{
    public class Program
    {
        static void Main(string[] args)
        {
            var number = Convert.ToInt64(Console.ReadLine());
            long res = MaxSumNumbers(number);
            Console.WriteLine(res);
        }

        public static long MaxSumNumbers(long number)
        {
            var str = number.ToString();
            str = String.Concat(str.Reverse());
            var matrix = new long[str.Length];
            matrix[0] = Convert.ToInt32(str[0].ToString());

            string current = string.Empty;
            for(int i = 1; i< matrix.Length; i++)
            {
                current = str[i].ToString() + matrix[i - 1].ToString();
                var Long = Convert.ToInt64(current);
                var num = Helper(Long);

                var sub = str.Substring(0, i + 1);
                sub = String.Concat(sub.Reverse());
                var curLong = Convert.ToInt64(sub);
                curLong = Helper(curLong);

                var sum1 = 0;
                var sum2 = 0;

                foreach (var ch in curLong.ToString())
                    sum1+= Convert.ToInt32(ch.ToString());
                foreach (var ch in num.ToString())
                    sum2 += Convert.ToInt32(ch.ToString());

                if (sum1 == sum2)
                    matrix[i] = Math.Max(curLong, num);
                if (sum1 > sum2)
                    matrix[i] = curLong;
                if (sum2 > sum1)
                    matrix[i] = num;
            }
            return matrix.Last();
        }

        private static long Helper(long number)
        {
            var str = number.ToString();
            var newNumber = string.Empty;

            int dif = 0;
            for (int i = str.Length - 1; i > 0; i--)
            {
                var top = Convert.ToInt32(str[i].ToString());
                dif += 9 - top;
                newNumber += 9.ToString();
            }
            dif -= 1;
            if (dif <= 0)
                return number;

            var lastNumber = Convert.ToInt32(str[0].ToString()) - 1;
            if (lastNumber > 0)
                newNumber += lastNumber;
            newNumber = String.Concat(newNumber.Reverse());
            var newNum = Convert.ToInt64(newNumber);

            return newNum;
        }

        public static string GetPassword(int n, int k)
        {
            string alphabet = "abcdefghijklmnopqrstuvwxyz";

            char[] chars = alphabet.Substring(0, k).ToCharArray();
            var result = String.Concat(chars);

            char first = result.Last();

            int i = 0;
            while (result.Last() == first)
                first = chars[i++];

            char second = chars[0] == first ? chars[1] : chars[0];

            bool isSecond = false;
            for (i = 0; i < n - k; i++)
            {
                if (isSecond)
                    result += second;
                else
                    result += first;
                isSecond = !isSecond;
            }

            return result;
        }
    }
}


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

namespace Test
{
    class IOHelper : IDisposable
    {
        StreamReader reader;
        StreamWriter writer;

        public IOHelper(string inputFile, string outputFile, Encoding encoding)
        {
            StreamReader iReader;
            StreamWriter oWriter;
            if (inputFile == null)
                iReader = new StreamReader(Console.OpenStandardInput(), encoding);
            else
                iReader = new StreamReader(inputFile, encoding);

            if (outputFile == null)
                oWriter = new StreamWriter(Console.OpenStandardOutput(), encoding);
            else
                oWriter = new StreamWriter(outputFile, false, encoding);

            reader = iReader;
            writer = oWriter;

            curLine = new string[] { };
            curTokenIdx = 0;
        }

        string[] curLine;
        int curTokenIdx;

        char[] whiteSpaces = new char[] { ' ', '\t', '\r', '\n' };

        public 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++];
        }

        public int ReadNextInt()
        {
            return int.Parse(ReadNextToken());
        }

        public double ReadNextDouble()
        {
            var nextToken = ReadNextToken();
            var result = 0.0;
            nextToken = nextToken.Replace(".", System.Threading.Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator);
            result = double.Parse(nextToken);
            return result;
        }

        public void Write(string stringToWrite)
        {
            writer.Write(stringToWrite);
        }

        public void WriteLine(string stringToWrite)
        {
            writer.WriteLine(stringToWrite);
        }

        public void WriteLine(double valueToWrite)
        {
            long intPart = (long)valueToWrite;
            double fracPart = valueToWrite - intPart;
            var fracPartStr = fracPart.ToString();
            if (fracPartStr.Length > 1)
                fracPartStr = fracPartStr.Substring(2);
            var strToWrite = string.Format("{0}.{1}", intPart, fracPartStr);
            writer.WriteLine(strToWrite);
        }

        public void Dispose()
        {
            try
            {
                if (reader != null)
                {
                    reader.Dispose();
                }
                if (writer != null)
                {
                    writer.Dispose();
                }
            }
            catch { };
        }

        public void Flush()
        {
            if (writer != null)
            {
                writer.Flush();
            }
        }
    }

    class Program
    {
        protected IOHelper ioHelper;

        int n,k;

        long[] cstToGet;

        long Cost(int x)
        {
            int j;
            long best = -1;
            for(j=1;j<x;j++)
            {
                long cand = cstToGet[j] + cstToGet[x - j] + j * (x - j);
                if (cand > 100000)
                    return -1;

                if (best == -1)
                    best = cand;
                else if (cand < best)
                    best = cand;
            }
            return best;
        }

        public bool Solvable(int kk)
        {
            char ch = 'a';
            int i;
            long size = 0;
            for (i = n - 1; i >= 0; i--)
            {
                if (cstToGet[i] > kk)
                    continue;
                kk -= (int)cstToGet[i];
                size += i;
                ch++;
                i++;
                if (kk == 0)
                    break;
            }

            return kk == 0 && ch <= 'z' && size <= 100000;
        }

        public void Solve()
        {
            k = ioHelper.ReadNextInt();
            cstToGet = new long[1000];

            cstToGet[0] = 0;
            cstToGet[1] = 0;
            cstToGet[2] = 1;
            int i;
            for (i = 3; i < 1000; i++)
            {
                cstToGet[i] = Cost(i);
                if (cstToGet[i] == -1)
                    break;
            }

            n = i;
            char ch = 'a';
            StringBuilder sb = new StringBuilder();
            for(i=n-1;i>=0;i--)
            {
                if (cstToGet[i] > k)
                    continue;
                sb.Append(ch, i);
                k -= (int)cstToGet[i];
                ch++;
                i++;
                if (k == 0)
                    break;
            }
            if(k!=0)
            {
                throw new ApplicationException("Alabala");
            }

            var res = sb.ToString();
            ioHelper.WriteLine(res);
            ioHelper.Flush();

            //Console.ReadKey();
        }

        public Program(string inputFile, string outputFile)
        {
            ioHelper = new IOHelper(inputFile, outputFile, Encoding.Default);
            Solve();
            ioHelper.Dispose();
        }

        static void Main(string[] args)
        {
            Program myProgram = new Program(null, null);
        }
    }
}


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

namespace Codeforces
{
    public class ProblemG568
    {
        static void Main(string[] args)
        {
            var nt = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int n = nt[0];
            int t = nt[1];
            var songs = new List<Tuple<int, int>>();
            int modulo = 1000000000 + 7;
            for (int i = 0; i < n; i++)
            {
                var ns = Console.ReadLine().Split().Select(int.Parse).ToArray();
                songs.Add(Tuple.Create(ns[0], ns[1]));
            }
            var playlists = new SortedDictionary<int, Dictionary<Tuple<int, int>, int>>();
            playlists.Add(0, new Dictionary<Tuple<int, int>, int>());
            playlists[0][Tuple.Create(0, -1)] = 1;
            int count = 0;
            while (playlists.Count > 0)
            {
                var kvp = playlists.First();
                int refTime = kvp.Key;
                if (refTime == t)
                {
                    // on compte
                    foreach (var kvp2 in kvp.Value)
                    {
                        count = (count + kvp2.Value) % modulo;
                    }
                    break;
                }
                else if (refTime > t)
                {
                    // too much
                    break;
                }

                playlists.Remove(refTime);
                foreach (var kvp2 in kvp.Value)
                {
                    int play = kvp2.Key.Item1;
                    int last = kvp2.Key.Item2;
                    int lastgenre = last == -1 ? -1 : songs[last].Item2;
                    int counting = kvp2.Value;
                    for (int i = 0; i < n; i++)
                    {
                        // not already played
                        if ((play & (1 << i)) > 0)
                            continue;
                        int nextplay = play | (1 << i);

                        // no two consecutive genre
                        if (songs[i].Item2 == lastgenre)
                            continue;
                        int nexttime = refTime + songs[i].Item1;
                        // playlist too long
                        if (nexttime > t)
                            continue;
                        if (!playlists.ContainsKey(nexttime))
                        {
                            playlists[nexttime] = new Dictionary<Tuple<int, int>, int>();
                        }
                        var nextkey = Tuple.Create(nextplay, i);
                        if (!playlists[nexttime].ContainsKey(nextkey))
                        {
                            playlists[nexttime][nextkey] = 0;
                        }
                        playlists[nexttime][nextkey] = (playlists[nexttime][nextkey] + counting) % modulo;
                    }
                }
            }
            Console.WriteLine(count);
        }
    }
}


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

class Program
{

    //////////////////////////////////////////////////
    void Solution()
    {
        var p = rl;
        var k = rl;

        if (p < k)
        {
            wln(1);
            wln(p);
            return;
        }

        var w = p;
        var a = new List<long>();
        int count = 0;
        for (; ; )
        {
            var z = 1 - w / k;
            if (z * k + w >= k)
                z--;
            if (z * k + w >= k)
            {
                wln(-1);
                return;
            }
            a.Add(z * k + w);
            w = z;
            if (0 < z && z < k)
            {
                a.Add(z);
                break;
            }
            count++;
            if (count > 1000000)
            {
                wln(-1);
                return;
            }
        }
        wln(a.Count);
        foreach (var o in a)
            wsp(o);

    }
    //////////////////////////////////////////////////

    static void swap<T>(ref T o1, ref T o2) { var o = o1; o1 = o2; o2 = o; }

    static void wln() { Console.WriteLine(); }
    static void wln<T>(T o) { Console.WriteLine(o); }
    static void wsp<T>(T o) { Console.Write(o + " "); }
    static void wrt<T>(T o) { Console.Write(o); }

    static void wln(double o) { Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0:F12}", o)); }
    static void wsp(double o) { Console.Write(string.Format(CultureInfo.InvariantCulture, "{0:F12} ", o)); }
    static void wrt(double o) { Console.Write(string.Format(CultureInfo.InvariantCulture, "{0:F12}", o)); }

    static long gcd(long a, long b) { return (b != 0) ? gcd(b, a % b) : a; }
    static long lcm(long a, long b) { return a / gcd(a, b) * b; }

    int ri
    {
        get
        {
            _read(); while (_str[_ind] == ' ') ++_ind;
            int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }
            int p = 0;
            while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';
            while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;
        }
    }
    long rl
    {
        get
        {
            _read(); while (_str[_ind] == ' ') ++_ind;
            int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }
            long p = 0;
            while (_ind < _count && _str[_ind] != ' ') p = p * 10 + _str[_ind++] - '0';
            while (_ind < _count && _str[_ind] == ' ') ++_ind; return p * sign;
        }
    }
    double rd
    {
        get
        {
            _read(); while (_str[_ind] == ' ') ++_ind; int sign = 1; if (_str[_ind] == '-') { sign = -1; ++_ind; }
            long p = 0, q = 1; while (_ind < _count && _str[_ind] != ' ' && _str[_ind] != '.') p = p * 10 + _str[_ind++] - '0';
            if (_ind < _count && _str[_ind] == '.') { ++_ind; while (_ind < _count && _str[_ind] != ' ') { p = p * 10 + _str[_ind++] - '0'; q *= 10; } }
            while (_ind < _count && _str[_ind] == ' ') ++_ind; return (double)p / q * sign;
        }
    }
    string rs
    {
        get
        {
            _read(); while (_ind < _count && _str[_ind] == ' ') ++_ind;
            var tmp = _str.IndexOf(' ', _ind);
            if (tmp == -1) { var res = _str.Substring(_ind); _count = 0; _ind = 0; return res; }
            var s = _str.Substring(_ind, tmp - _ind); _ind = tmp + 1;
            while (_ind < _count && _str[_ind] == ' ') ++_ind; return s;
        }
    }

    int[] ria(int n)
    {
        var res = new int[n];
        for (int k = 0; k < n;)
        {
            var s = Console.ReadLine(); var m = s.Length;
            for (int i = 0; i < m && k < n; ++i)
            {
                while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }
                int p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;
            }
        }
        _count = 0; _ind = 0; return res;
    }
    long[] rla(int n)
    {
        var res = new long[n];
        for (int k = 0; k < n;)
        {
            var s = Console.ReadLine(); var m = s.Length;
            for (int i = 0; i < m && k < n; ++i)
            {
                while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }
                long p = 0; while (i < m && s[i] != ' ') p = p * 10 + s[i++] - '0'; res[k++] = p * sign;
            }
        }
        _count = 0; _ind = 0; return res;
    }
    double[] rda(int n)
    {
        var res = new double[n];
        for (int k = 0; k < n;)
        {
            var s = Console.ReadLine(); var m = s.Length;
            for (int i = 0; i < m && k < n; ++i)
            {
                while (i < m && s[i] == ' ') ++i; if (i == m) break; int sign = 1; if (s[i] == '-') { sign = -1; ++i; }
                long p = 0, q = 1; while (i < m && s[i] != ' ' && s[i] != '.') p = p * 10 + s[i++] - '0';
                if (i < m && s[i] == '.') { ++i; while (i < m && s[i] != ' ') { p = p * 10 + s[i++] - '0'; q *= 10; } }
                res[k++] = (double)p / q * sign;
            }
        }
        _count = 0; _ind = 0; return res;
    }
    string[] rsa(int n) { var res = new string[n]; for (int k = 0; k < n; ++k) res[k] = Console.ReadLine(); _count = 0; _ind = 0; return res; }
    string _str = null; int _count = 0; int _ind = 0;
    void _read() { if (_ind == _count) { _str = Console.ReadLine(); _count = _str.Length; _ind = 0; } }
    static void Main()
    {
        //Console.SetIn(new StreamReader("input.txt"));
        //Console.SetOut(new StreamWriter("output.txt"));
        new Program().Solution();
        //Console.In.Close();
        //Console.Out.Close();
    }
}


// Problem: 1041B - Buying a TV Set
// Author: Gusztav Szmolik

using System;

class BuyingATVSet
    {
    static int Main ()
        {
        string[] words = ReadSplitLine (4);
        if (words == null)
            return -1;
        ulong a;
        if (!UInt64.TryParse (words[0], out a))
            return -1;
        if (a < 1 || a > 1000000000000000000)
            return -1;
        ulong b;
        if (!UInt64.TryParse (words[1], out b))
            return -1;
        if (b < 1 || b > 1000000000000000000)
            return -1;
        ulong x;
        if (!UInt64.TryParse (words[2], out x))
            return -1;
        if (x < 1 || x > 1000000000000000000)
            return -1;
        ulong y;
        if (!UInt64.TryParse (words[3], out y))
            return -1;
        if (y < 1 || y > 1000000000000000000)
            return -1;
        bool xLess = (x < y);
        ulong d1 = (xLess ? x : y);
        ulong d2 = (xLess ? y : x);
        ulong r = d2%d1;
        while (r > 0)
            {
            d2 = d1;
            d1 = r;
            r = d2%d1;
            }
        ulong xRed = x/d1;
        ulong yRed = y/d1;
        ulong ans = (Math.Min (a/xRed,b/yRed));
        Console.WriteLine (ans);
        return 0;
        }

    static string[] ReadSplitLine (uint numWordNeed)
        {
        string line = Console.ReadLine ();
        if (line == null)
            return null;
        char[] delims = new char[2] {' ', '\t'};
        string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        return (words.Length == numWordNeed ? words : null);
        }
    }


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

namespace _749B
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] x = new int[3], y = new int[3];
            for (int i = 0; i < 3; i++)
            {
                string[] line = Console.ReadLine().Split(' ');
                x[i] = int.Parse(line[0]);
                y[i] = int.Parse(line[1]);
            }

            Console.WriteLine(3);
            Console.WriteLine((-x[0] + x[1] + x[2]) + " " + (-y[0] + y[1] + y[2]));
            Console.WriteLine((x[0] - x[1] + x[2]) + " " + (y[0] - y[1] + y[2]));
            Console.WriteLine((x[0] + x[1] - x[2]) + " " + (y[0] + y[1] - y[2]));
            //Console.ReadLine();
        }
    }
}


using System;

namespace task124D
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] splitStr = Console.ReadLine().Split(' ');
            int a = Convert.ToInt32(splitStr[0]);
            int b = Convert.ToInt32(splitStr[1]);
            int x1 = Convert.ToInt32(splitStr[2]);
            int y1 = Convert.ToInt32(splitStr[3]);
            int x2 = Convert.ToInt32(splitStr[4]);
            int y2 = Convert.ToInt32(splitStr[5]);
            int x, y;
            x = x1;
            y = y1;
            x1 = x + y;
            y1 = y - x;
            x = x2;
            y = y2;
            x2 = x + y;
            y2 = y - x;
            a *= 2;
            b *= 2;
            x1 = x1 / a + ((x1 > 0) ? 1 : 0);
            x2 = x2 / a + ((x2 > 0) ? 1 : 0);
            y1 = y1 / b + ((y1 > 0) ? 1 : 0);
            y2 = y2 / b + ((y2 > 0) ? 1 : 0);
            Console.WriteLine(Math.Max(Math.Abs(y2-y1), Math.Abs(x2-x1)));
        }
    }
}


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

namespace Arpa_and_an_exam_about_geometry
{
    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)
        {
            writer.WriteLine(Solve(args) ? "Yes" : "No");
            writer.Flush();
        }

        private static bool Solve(string[] args)
        {
            long ax = Next(), ay = Next(), bx = Next(), by = Next(), cx = Next(), cy = Next();

            if ((ax - bx)*(ax - bx) + (ay - by)*(ay - by) == (cx - bx)*(cx - bx) + (cy - by)*(cy - by))
            {
                return (cx - ax)*(cy - by) != (cy - ay)*(cx - bx);
            }

            return false;
        }

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


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

#region testlib
public delegate bool ParserDelegate<T>(string word, out T item);

public class Input : IDisposable
{
private static EventArgs DefaultEventArgs = new EventArgs();

public TextReader TextReader { get; private set; }

public event EventHandler OnEndOfStream;
public event EventHandler OnParseError;
public event EventHandler OnReadError;

public bool CanRead { get; private set; }
public bool ThrowExceptions { get; set; }

string line = string.Empty;
int pos = 0;

static EventHandler emptyHandler;

public Input(string path)
: this(File.OpenRead(path))
{
}
public Input(Stream s)
: this(new StreamReader(s))
{

}
public Input(TextReader tr)
{
TextReader = tr;

if (emptyHandler == null)
emptyHandler = (a, b) => { };

OnEndOfStream = emptyHandler;
OnParseError = emptyHandler;
OnReadError = emptyHandler;

CanRead = true;
}

public static implicit operator Input(Stream s)
{
return new Input(s);
}
public static implicit operator Input(TextReader tr)
{
return new Input(tr);
}

private bool ReadStream()
{
if (!CanRead) return false;
if (pos < line.Length) return true;

Clear();

string s = TextReader.ReadLine();
if (s == null)
{
CanRead = false;
return false;
}

line = s;
return true;
}

public void SkipChar()
{
if (pos < line.Length) pos++;
else
{
ReadStream();
}
}
public void SkipChars(int length)
{
while (length > 0)
{
int dt = line.Length - pos;
if (dt <= 0)
{
length--;
if (!ReadStream()) return;
}
dt = Math.Min(length, dt);
pos += dt;
length -= dt;
}
}

public void SkipWhiteSpace()
{
while (true)
{
for (; pos < line.Length; pos++)
{
if (!char.IsWhiteSpace(line[pos])) return;
}
if (!ReadStream())
{
OnEndOfStream(this, DefaultEventArgs);
return;
}
}
}
public bool CanReadData()
{
SkipWhiteSpace();
return CanRead;
}

public T[] ReadArray<T>()
{
int length = ReadInt32();
return ReadArray<T>(length);
}
public T[] ReadArray<T>(int length)
{
ParserDelegate<T> parser = Parser.GetPrimitiveParser<T>();
return ReadArray<T>(length, parser);
}
public T[] ReadArray<T>(ParserDelegate<T> parser)
{
int length = ReadInt32();
return ReadArray<T>(length, parser);
}
public T[] ReadArray<T>(int length, ParserDelegate<T> parser)
{
T[] res = new T[length];
for (int i = 0; i < length; i++)
{
res[i] = ReadData<T>(parser);
}
return res;
}

public Decimal ReadDecimal()
{
return ReadData<Decimal>(Parser.DecimalParser);
}
public Double ReadDouble()
{
return ReadData<Double>(Parser.DoubleParser);
}
public Single ReadSingle()
{
return ReadData<Single>(Parser.SingleParser);
}
public UInt64 ReadUInt64()
{
return ReadData<UInt64>(UInt64.TryParse);
}
public UInt32 ReadUInt32()
{
return ReadData<UInt32>(UInt32.TryParse);
}
public UInt16 ReadUInt16()
{
return ReadData<UInt16>(UInt16.TryParse);
}
public Int64 ReadInt64()
{
return ReadData<Int64>(Int64.TryParse);
}
public Int32 ReadInt32()
{
return ReadData<Int32>(Int32.TryParse);
}
public Int16 ReadInt16()
{
return ReadData<Int16>(Int16.TryParse);
}
public Boolean ReadYesNo()
{
return ReadData<Boolean>(Parser.YesNoParser);
}
public Boolean ReadBoolean()
{
return ReadData<Boolean>(Boolean.TryParse);
}
public Byte ReadByte()
{
return ReadData<Byte>(Byte.TryParse);
}

private bool ReadCheck()
{
if (!CanRead)
{
OnReadError(this, DefaultEventArgs);
if (ThrowExceptions)
{
throw new Exception("!CanRead");
}
return false;
}
return true;
}
public T ReadData<T>()
{
return ReadData<T>(true);
}
public T ReadData<T>(bool skipWhiteSpace)
{
ParserDelegate<T> parser = Parser.GetPrimitiveParser<T>();
return ReadData<T>(parser, skipWhiteSpace);
}
public T ReadData<T>(ParserDelegate<T> parser)
{
return ReadData<T>(parser, true);
}
public T ReadData<T>(ParserDelegate<T> parser, bool skipWhiteSpace)
{
if (skipWhiteSpace)
SkipWhiteSpace();

if (!ReadCheck()) return default(T);

string s = ReadWord(false);

T res;
if (!parser.Invoke(s, out res))
{
OnParseError(this, DefaultEventArgs);
if (ThrowExceptions)
{
throw new Exception("!validate, word = " + Output.ToString(s, 256));
}
}
return res;
}

public string ReadWord()
{
return ReadWord(true);
}
public string ReadWord(bool skipWhiteSpace)
{
if (skipWhiteSpace)
SkipWhiteSpace();

if (!ReadCheck()) return string.Empty;

int from = pos;
int to = pos;
for (int i = pos; i < line.Length; i++)
{
if (char.IsWhiteSpace(line[i])) break;
to = i + 1;
}
pos = to;

return line.Substring(from, to - from);
}

public string ReadLine()
{
if (!ReadCheck()) return string.Empty;

ReadStream();
string res = line.Substring(pos);
pos = line.Length;

return res;
}

public void Close()
{
TextReader.Close();
}
public void Clear()
{
pos = 0;
line = string.Empty;
}

private bool disposed = false;
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
line = string.Empty;
TextReader.Dispose();
}
disposed = true;
}
}
~Input()
{
Dispose(false);
}
}
public class Output : IDisposable
{
static char[] space = new char[] { ' ' };

public TextWriter TextWriter { get; private set; }
public bool AutoFlush { get; set; }

public static string ToString(object obj, int maxLength)
{
return ToString(FormatReal(obj), maxLength);
}
public static string ToString(string s, int maxLength)
{
if (s.Length <= maxLength) return s;
else return s.Substring(0, maxLength) + "...";
}
public static object FormatReal(object v, string format)
{
if (v is decimal) return ((decimal)v).ToString(format).Replace(',', '.');
if (v is double) return ((double)v).ToString(format).Replace(',', '.');
if (v is float) return ((float)v).ToString(format).Replace(',', '.');

return v;
}
public static object FormatReal(object v)
{
if (v is decimal || v is double || v is float)
{
return v.ToString().Replace(',', '.');
}
return v;
}

public Output()
: this(new MemoryStream())
{
}
public Output(string path)
: this(File.Create(path))
{

}
public Output(Stream s)
: this(new StreamWriter(s))
{
}
public Output(TextWriter tw)
{
TextWriter = tw;
}

public static implicit operator Output(Stream s)
{
return new Output(s);
}

public static implicit operator Output(TextWriter tw)
{
return new Output(tw);
}

public static Output operator +(Output output, object obj)
{
output.Write(obj);
return output;
}
public Output WriteArray<T>(params T[] array)
{
return WriteArray<T>(array, false);
}
public Output WriteArray<T>(T[] array, bool appendLength)
{
return WriteArray<T>(array, 0, array.Length, appendLength);
}
public Output WriteArray<T>(T[] array, int index, int count)
{
return WriteArray<T>(array, index, count, false);
}
public Output WriteArray<T>(T[] array, int index, int count, bool appendLength)
{
if (index + count > array.Length)
{
string message = string.Format(
"Index out of range: {0} + {1} >= {2}",
index,
count,
array.Length);
throw new Exception(message);
}
if (appendLength)
{
WriteLine(count);
}
for (int i = 0; i < count; i++)
{
Write(array[i]);
Write(space, 0, space.Length);
}
WriteLine();

return this;
}
public Output WriteLine(object obj)
{
obj = FormatReal(obj);
return WriteLine(obj.ToString());
}
public Output WriteLine(string format, params object[] args)
{
return WriteLine(string.Format(format, args));
}
public Output WriteLine(string s)
{
return WriteLine(s.ToCharArray());
}
public Output WriteLine(char[] buffer)
{
return WriteLine(buffer, 0, buffer.Length);
}
public Output WriteLine(char[] buffer, int index, int count)
{
TextWriter.WriteLine(buffer, index, count);
if (AutoFlush) TextWriter.Flush();
return this;
}
public Output WriteLine()
{
TextWriter.WriteLine();
if (AutoFlush) TextWriter.Flush();
return this;
}
public Output Write(object obj)
{
obj = FormatReal(obj);
return Write(obj.ToString());
}
public Output Write(string format, params object[] args)
{
return Write(string.Format(format, args));
}
public Output Write(string s)
{
return Write(s.ToCharArray());
}
public Output Write(char[] buffer)
{
return Write(buffer, 0, buffer.Length);
}
public Output Write(char[] buffer, int index, int count)
{
TextWriter.Write(buffer, index, count);
if (AutoFlush) TextWriter.Flush();
return this;
}

public void Close()
{
TextWriter.Close();
}
public void Flush()
{
TextWriter.Flush();
}

private bool disposed = false;
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}

protected virtual void Dispose(bool disposing)
{
if (!this.disposed)
{
if (disposing)
{
TextWriter.Dispose();
}
disposed = true;
}
}
~Output()
{
Dispose(false);
}
}
public static class Parser
{
public static ParserDelegate<T> GetPrimitiveParser<T>()
{
if (!typeof(T).IsPrimitive) throw new Exception("Unknown type");
else if (default(T) is Byte) return new ParserDelegate<Byte>(Byte.TryParse) as ParserDelegate<T>;
else if (default(T) is Boolean) return new ParserDelegate<Boolean>(Boolean.TryParse) as ParserDelegate<T>;
else if (default(T) is Int16) return new ParserDelegate<Int16>(Int16.TryParse) as ParserDelegate<T>;
else if (default(T) is Int32) return new ParserDelegate<Int32>(Int32.TryParse) as ParserDelegate<T>;
else if (default(T) is Int64) return new ParserDelegate<Int64>(Int64.TryParse) as ParserDelegate<T>;
else if (default(T) is UInt16) return new ParserDelegate<UInt16>(UInt16.TryParse) as ParserDelegate<T>;
else if (default(T) is UInt32) return new ParserDelegate<UInt32>(UInt32.TryParse) as ParserDelegate<T>;
else if (default(T) is UInt64) return new ParserDelegate<UInt64>(UInt64.TryParse) as ParserDelegate<T>;
else if (default(T) is Single) return new ParserDelegate<Single>(Parser.SingleParser) as ParserDelegate<T>;
else if (default(T) is Double) return new ParserDelegate<Double>(Parser.DoubleParser) as ParserDelegate<T>;
else if (default(T) is Decimal) return new ParserDelegate<Decimal>(Parser.DecimalParser) as ParserDelegate<T>;
else if (default(T) is String) return new ParserDelegate<String>(Parser.StringParser) as ParserDelegate<T>;
else throw new Exception("Unknown type");
}
public static bool YesNoParser(string s, out Boolean result)
{
s = s.ToLower();
if (s == "yes") result = true;
else if (s == "no") result = false;
else
{
result = false;
return false;
}
return true;
}
public static bool StringParser(string s, out string result)
{
result = s;
return string.IsNullOrEmpty(s);
}
public static bool DecimalParser(string s, out Decimal result)
{
return Decimal.TryParse(s.Replace('.', ','), out result);
}
public static bool DoubleParser(string s, out Double result)
{
return Double.TryParse(s.Replace('.', ','), out result);
}
public static bool SingleParser(string s, out Single result)
{
return Single.TryParse(s.Replace('.', ','), out result);
}
}
#endregion

class V : IComparable<V>
{
    public int Index;
    public int StartT;
    public int EndT;
    public int Count;

    public int CompareTo(V a)
    {
        var r = EndT.CompareTo(a.EndT);
        if (r == 0) r = Count.CompareTo(a.Count);
        if (r == 0) r = Index.CompareTo(a.Index);
        return r;
    }
}
static class Program
{
    #region Streams
    static string endl = Environment.NewLine;
    static Input cin = new Input(Console.In);
    static Output cout = new Output(Console.Out);
    static Output cerr = new Output(Console.Error);

    static void InitIO()
    {
#if !DEBUG
        cin = new Input("input.txt");
        cout = new Output("output.txt");
#endif
    }
    #endregion
    #region Time
    static Stopwatch sw = new Stopwatch();
    static void Start()
    {
        sw.Reset();
        sw.Start();
    }
    static void Restart(string text = "")
    {
        Stop(text);
        Start();
    }
    static void Time(string text = "")
    {
        if (string.IsNullOrEmpty(text))
        {
            cerr.WriteLine(sw.Elapsed);
        }
        else
        {
            cerr.WriteLine(text + ": " + sw.Elapsed);
        }
    }
    static void Stop(string text = "")
    {
        sw.Stop();
        Time(text);
    }
    //*/
    #endregion
    #region Prewriten
    static void Swap<T>(ref T a, ref T b)
    {
        T c = a;
        a = b;
        b = c;
    }
    static long Gcd(long a, long b)
    {
        while (a > 0)
        {
            b %= a;
            Swap(ref a, ref b);
        }
        return b;
    }
    static int[] ZFunction(string s)
    {
        var z = new int[s.Length];
        for (int i = 1, l = 0, r = 0; i < s.Length; ++i)
        {
            if (i <= r)
            {
                z[i] = Math.Min(r - i + 1, z[i - l]);
            }
            while (i + z[i] < s.Length && s[z[i]] == s[i + z[i]])
            {
                z[i]++;
            }
            if (i + z[i] - 1 > r)
            {
                l = i;
                r = i + z[i] - 1;
            }
        }
        return z;
    }
    static long Pow(long a, long p)
    {
        var b = 1L;
        while (p > 0)
        {
            if ((p & 1) == 0)
            {
                a *= a;
                p >>= 1;
            }
            else
            {
                b *= a;
                p--;
            }
        }
        return b;
    }
    #endregion
    const string nyan = "^_^";
    const string name = "canalization";
    const long mod = 1000000007;

    static int Find(string[] a, char x)
    {
        var blocked = new bool[8];
        for (var i = 0; i < 8; i++)
        {
            for (var j = 0; j < 8; j++)
            {
                if (a[i][j] == x && !blocked[j]) return i;
                if (a[i][j] != '.') blocked[j] = true;
            }
        }
        return -1;
    }
    static void Solve()
    {
        var x = cin.ReadInt64() - 2;
        cout.WriteLine(x * x);
    }

    static string[] Tests =
    {
        @"5",
        @"3",
        @"6",
        @"54321"
    };

    static string Generate(int k, int n)
    {
        var sb = new StringWriter();
        var output = new Output(sb);

        output.WriteLine("{0} {1}", k, n);

        return sb.ToString();
    }
    static void Main()
    {
#if DEBUG
        if (Tests.Length == 0)
        {
            Solve();
        }
        else
        {
            foreach(var test in Tests)
            {
                cin = new Input(new StringReader(test));
                Start();
                Solve();
                Stop();
            }
            /*
            for (var i = 0; i <= 10; i++)
            {
                var test = Generate(1, i);
                Start();
                cin = new Input(new StringReader(test));
                Solve();
                Stop();
            }
            //*/
        }
#else
        /*
        cin = new Input(name + ".in");
        cout = new Output(name + ".out");
        //*/
        //Solve();

                var th = new Thread(Solve, 1024 * 1024 * 64);
                th.Start();
                th.Join();
        cout.Flush();
        cout.Dispose();
#endif
    }
}


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

public class E167
{
    public static void Main()
    {
        new E167().Entry();
    }//Main

    void Entry()
    {
        int[] tmp = intSplit(' ');
        int n = tmp[0];
        int m = tmp[1];
        int[] type = new int[n];
        List<int>[] edges = new List<int>[n];
        for (int i = 0; i < n; i++)
            edges[i] = new List<int>();
        for (int i = 0; i < m; i++)
        {
            tmp = intSplit(' ');
            int a = tmp[0] - 1;
            int b = tmp[1] - 1;
            edges[a].Add(b);
            edges[b].Add(a);
        }//for i
        Queue<int> que = new Queue<int>();
        for (int i = 0; i < n; i++)
            que.Enqueue(i);
        while (que.Count!=0)
        {
            int deq = que.Dequeue();
            int cnt = 0;
            foreach (int item in edges[deq])
            {
                if (type[item] == type[deq])
                    cnt++;
            }//foreach item
            if (cnt>=2)
            {
                type[deq] ^= 1;
                foreach (int item in edges[deq])
                {
                    if (type[item] == type[deq])
                        que.Enqueue(item);
                }//foreach item
            }//if
        }//while
        StringBuilder sb = new StringBuilder();
        foreach (int item in type)
        {
            sb.Append(item);
        }//foreach item
        Console.WriteLine(sb.ToString());
    }

    string strRead()
    {
        return Console.ReadLine();
    }

    int intRead()
    {
        return int.Parse(Console.ReadLine());
    }

    long longRead()
    {
        return long.Parse(Console.ReadLine());
    }

    double doubleRead()
    {
        return double.Parse(Console.ReadLine());
    }

    string[] strSplit(char a)
    {
        return Console.ReadLine().Split(a);
    }

    int[] intSplit(char a)
    {
        return Array.ConvertAll<string, int>(Console.ReadLine().Split(a), int.Parse);
    }

    long[] longSplit(char a)
    {
        return Array.ConvertAll<string, long>(Console.ReadLine().Split(a), long.Parse);
    }

    double[] doubleSplit(char a)
    {
        return Array.ConvertAll<string, double>(Console.ReadLine().ToString().Split('a'), double.Parse);
    }

}//Template


using System;
using System.Linq;

namespace Sqare
{
    class Program
    {
        static void Main(string[] args)
        {
            long [] numbers = Console.ReadLine().Split().Select(x => long.Parse(x)).ToArray();
            long tile1, tile2;
            if (numbers[0] % numbers[2] == 0)
            {
                tile1 = numbers[0] / numbers[2];
            }
            else
            {
                tile1 = numbers[0] / numbers[2] + 1;
            }
            if (numbers[1] % numbers[2] == 0)
            {
                tile2 = numbers[1] / numbers[2];
            }
            else
            {
                tile2 = numbers[1] / numbers[2] + 1;
            }
            Console.WriteLine(tile2 * tile1);
        }
    }
}


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

class A
{
    static void Main(string[] args)
    {
#if ONLINE_JUDGE
#else
        Console.SetIn(new StreamReader("in.txt"));
#endif
        string[] read = Console.ReadLine().Split(' ');
        int n = Convert.ToInt32(read[0]);
        int x = Convert.ToInt32(read[1]);
        int y = Convert.ToInt32(read[2]);
        int clones = 0;
        float need = n * ((float)y / 10);
        if (need % 10 > 0) need = need/10+1;
        else need = need / 10;
        if (x < need) clones = (int)need - x;
        Console.WriteLine(clones);
#if ONLINE_JUDGE
#else
        Console.ReadKey();
#endif
    }
}


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

namespace ConsoleApplication1
{
    class Program
    {
        const long mod = 1000000007;
        static long phi(long n)
        {
            if (n == 1)
                return 1;
            long result = n;
            for (long i = 2; i * i <= n; ++i)
                if (n % i == 0)
                {
                    while (n % i == 0)
                        n /= i;
                    result -= result / i;
                }
            if (n > 1)
                result -= result / n;
            return result;
        }

        static void Main()
        {
            string[] token = Console.ReadLine().Split(' ');
            long n = long.Parse(token[0]);
            long k = long.Parse(token[1]);
            long t = 1;
            long ans = n;
            if (k >= n)
            {
                Console.WriteLine(1);
                return;
            }
            else
            {
                if (k >= 71)
                {
                    Console.WriteLine("1");
                    return;
                }
                else
                {
                    while (t <= k)
                    {
                        if (t % 2 == 1)
                        {
                            ans = phi(ans);
                            t++;
                        }
                        else
                        {
                            t++;
                            continue;
                        }
                    }
                }
            }
            Console.WriteLine(ans % mod);
            Console.Read();
        }
    }
}


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

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

        }
    }
}


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

namespace A.Theatre_Square
{
    class Program
    {

        const double eps = 0.01;

        static int dcmp(double x)
        {
            if (x < -eps) return -1;
            if (x > eps) return 1;
            return 0;
        }

        static void Main(string[] args)
        {
            Int64 data = Int64.Parse(Console.ReadLine().Trim());
            if (data == 0)
            {
                Console.WriteLine("0");
                return;
            }
            Int64 count = 0;
            Int64 n = (Int64)((Math.Sqrt((((double)data * data) - 0.5 * 0.5) / 0.75) + 1) / 2);
            count=3*n*n-3*n+1;

                Int64 need = 0;
                Int64 j = 0;
                do
                {
                    double yy = ( 0.5+n ) * Math.Sqrt(3);
                    double xx = 0.5;
                    need = 0;
                    for (Int64 i = j; i < (n + 1)/2+2; i++)
                    {
                        double x = xx + 1.5 * i;
                        double y = yy - (double)i * Math.Sqrt(3)/2;
                        if (dcmp(x * x + y * y - (double)(data) * data) <= 0)
                        {
                            need = (n + 1 - i * 2) < 0 ? 0 : (n + 1 - i * 2);
                            j = i;
                            break;
                        }
                    }
                    count += need * 6;
                    n++;
                } while (need != 0);

            Console.WriteLine(count);

        }

    }
}


#define Online

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

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

    class Program
    {

        static void Main(string[] args)
        {

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

            A();

#if Online
            Console.ReadLine();
#endif

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

        static void A()
        {
            string[] input = ReadArray(':');
            int h = int.Parse(input[0]);
            int m = int.Parse(input[1]);
            while (true)
            {
                if (m == 59)
                {
                    if (h == 23)
                    {
                        h = 0;
                    }
                    else
                    {
                        h++;
                    }
                    m = 0;
                }
                else
                {
                    m++;
                }
                if (h == (m % 10) * 10 + m / 10)
                {
                    Console.WriteLine((h < 10 ? "0" + h.ToString() : h.ToString()) + ":" + (m < 10 ? "0" + m.ToString() : m.ToString()));
                    return;
                }
            }
        }

        static void B()
        {

        }

        static void C()
        {

        }

        static void D()
        {

        }

        static void E()
        {

        }

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

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

        static string ReadLine()
        {
            return Console.ReadLine();
        }
    }

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

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

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

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

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

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

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

    class Graph
    {
        public List<int>[] g;
        public int[] color; //0-white, 1-gray, 2-black
        public int[] o; //open
        public int[] c; //close
        public int[] p;
        public int[] d;
        public List<Edge> e;
        public Stack<int> ans = new Stack<int>();
        public Graph(int n)
        {
            g = new List<int>[n + 1];
            for (int i = 0; i <= n; i++)
                g[i] = new List<int>();
            color = new int[n + 1];
            o = new int[n + 1];
            c = new int[n + 1];
            p = new int[n + 1];
            d = new int[n + 1];
        }

        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public bool DFS(int u, ref int time)
        {
            color[u] = gray;
            time++;
            o[u] = time;
            for (int i = 0; i < g[u].Count; i++)
            {
                int v = g[u][i];
                if (color[v] == gray)
                {
                    return true;
                }
                if (color[v] == white)
                {
                    p[v] = u;
                    if (DFS(v, ref time)) return true;
                }
            }
            color[u] = black;
            ans.Push(u);
            c[u] = time;
            time++;
            return false;
        }
    }

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

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

        public static bool DFS(int u, ref int time, Graph g, Stack<int> st)
        {
            g.color[u] = gray;
            time++;
            g.o[u] = time;
            for (int i = 0; i < g.g[u].Count; i++)
            {
                int v = g.g[u][i];
                if (g.color[v] == gray)
                {
                    return true;
                }
                if (g.color[v] == white)
                {
                    g.p[v] = u;
                    if (DFS(v, ref time, g, st)) return true;
                }
            }
            g.color[u] = black;
            st.Push(u);
            g.c[u] = time;
            time++;
            return false;
        }

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

            g.d[u] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < g.e.Count; j++)
                {
                    if (g.d[g.e[j].a] != int.MaxValue)
                    {
                        if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])
                        {
                            g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;
                            g.p[g.e[j].b] = g.e[j].a;
                        }
                    }
                }
            }
        }
    }

    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

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

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

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

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

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

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

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

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

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

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

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

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