Little Petya likes numbers a lot. He found that number 123 in base 16 consists of two digits: the first is 7 and the second is 11. So the sum of digits of 123 in base 16 is equal to 18.Now he wonders what is an average value of sum of digits of the number A written in all bases from 2 to A - 1.Note that all computations should be done in base 10. You should find the result as an irreducible fraction, written in base 10.

Input contains one integer number A (3 ≤ A ≤ 1000).

Output should contain required average value in format «X/Y», where X is the numerator and Y is the denominator.

NoteIn the first sample number 5 written in all bases from 2 to 4 looks so: 101, 12, 11. Sums of digits are 2, 3 and 2, respectively.

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

namespace _13A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());
            int count = 0;
            int sum = 0;
            for (int i = 2; i < A; i++)
            {
                sum += Program.sum(A,i);
                count++;
            }
            List<int> delitel = new List<int>();
            for (int i = 2; i <= count; i++)
            {
                if (count % i == 0)
                {
                    delitel.Add(i);
                }
            }
            bool f = true;
            while(f)
            {
                f = false;
                for (int i = 0; i < delitel.Count; i++)
                {
                    if ((sum % delitel[i] == 0) && (count % delitel[i] == 0))
                    {
                        f = true;
                        sum /= delitel[i];
                        count /= delitel[i];
                    }
                }
            }

            Console.WriteLine(sum+"/"+count);
            Console.ReadLine();
        }

        static int sum(int A, int t)
        {
            int res = 0;
            List<int> a = new List<int>();
            while (A > 0)
            {
                res += A % t;
                A /= t;
            }
            return res;
        }
    }
}

using System;

namespace Task_13A
{
    class Program
    {
        static int SumInBase(int num,int Base)
        {
            int ans = 0;
            while (num != 0)
            {
                ans += num % Base;
                num /= Base;
            }
            return ans;
        }
        static int GCD(int a,int b)
        {
            if (b == 0) return a;
            return GCD(b, a % b);
        }
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine()), sum = 0;
            for (int i = 2; i < A; i++)
                sum += SumInBase(A, i);
            int t = GCD(sum, A - 2);
            Console.WriteLine("{0}/{1}", sum / t, (A - 2) / t);
        }
    }
}

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

namespace cfbr13_a
{
    class Program
    {
        static int gcd(int a, int b)
        {
            return (b == 0) ? a : gcd(b, a % b);
        }

        static void Main(string[] args)
        {
            int sum = 0, count = 0;
            int A =  int.Parse(Console.ReadLine());
            int tmp = 0;
            for (int i = 2; i < A; i++)
            {
                tmp = A;
                count++;
                while (tmp > 0)
                {
                    sum += tmp % i;
                    tmp /= i;
                }
            }
            int gcd_ = gcd(sum, count);
            Console.WriteLine("{0}/{1}", sum/gcd_, count/gcd_);
        }
    }
}

using System;
static class P {
    static void Main() {
        int A = int.Parse(Console.ReadLine()), sum = 0, cnt = A - 2, _base = 2, i = 2;
        for (; _base <= A - 1; ++_base) {
            int a = A;
            while (true) {
                sum += a % _base;
                a /= _base;
                if (a == 0) { break; }
            }
        }
        for (; i <= cnt; ++i) { while (sum % i == 0 && cnt % i == 0) { sum /= i; cnt /= i; } }
        Console.WriteLine("{0}/{1}", sum, cnt);
    }
}

using System;

namespace Zero
{
    class Program
    {
        static void Main(string[] args)
        {
            int a, x, y, z, s = 0;
            a = Convert.ToInt32(Console.ReadLine());
            for (x = 2; x < a; x++)
                for (z = a; z > 0; s += z % x, z /= x) ;
            for (x = s, y = a - 2; (z = x % y) > 0; x = y, y = z) ;
            Console.WriteLine(s / y + "/" + (a - 2) / y);
        }
    }
}

using System;

class P {
  static void Main() {
    var a = int.Parse(Console.ReadLine());
    var sum = 0;
    for (var b = 2; b < a; b++) {
      var tmp = a;
      while (tmp > 0) { sum += tmp % b; tmp /= b; }
    }
    var denom = a - 2;
    for (var d = 2 ; d <= denom ; d++) if (sum % d + denom % d == 0) {
      sum /= d;
      denom /= d;
      d--;
    }
    Console.Write("{0}/{1}", sum, denom);
  }
}

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

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

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

            int sum = 0;
            for (int i = 2; i < A; i++)
            {
                int a = A;
                while (a>0)
                {
                    sum += a%i;
                    a /= i;
                }
            }

            int g = Gcd(sum, A - 2);

            writer.Write(sum/g);
            writer.Write('/');
            writer.WriteLine((A - 2)/g);
            writer.Flush();
        }

        public static int Gcd(int a, int b)
        {
            return b == 0 ? a : Gcd(b, a%b);
        }

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

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

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

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

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

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

        static void solution()
        {
            #region SOLUTION
            var a = readInt();
            var sum = 0L;
            for (int i = 2; i < a; i++)
            {
                var val = 0;
                var b = a;
                //var count = 1;
                while (true)
                {
                    var next = b % i;
                    var nextv = b / i;
                    val += next;
                    if (nextv == 0)
                    {
                        break;
                    }

                    //if (next == 0)
                    //{
                    //    val += nextv;
                    //    break;
                    //}
                    //else
                    //{
                    //    val += next;
                    //}

                    b = nextv;
                }

                sum += val;
            }

            long count = a - 2;
            var n = nod(Math.Max(sum, count), Math.Min(sum, count));
            sum /= n;
            count /= n;

            //var res = sum / ((double)(a - 2));
            Console.WriteLine("{0}/{1}", sum, count);

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

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

        static long nod(long a, long b)
        {
            var rem = a % b;
            if (rem == 0)
            {
                return b;
            }

            return nod(b, rem);
        }

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

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

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

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

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

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

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

namespace Main
{
    class Program
    {
        public static void Main(String[] args)
        {
            //Console.SetIn(new StreamReader("c:\\a.txt"));

            int n = int.Parse(Console.ReadLine());

            long sum = 0;

            for (int i = 2; i < n; i++)
                sum += GetConvertedSum(n, i);

            Console.WriteLine(sum / GCD(sum, n - 2) + "/" + (n - 2) / GCD(sum, n - 2));
        }

        private static long GetConvertedSum(int n, int radix)
        {
            long sum = 0;

            int a = 23;

            if (radix == 16)
                a++;

            while (n != 0)
            {
                sum += n%radix;
                n /= radix;
            }

            return sum;
        }

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

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

namespace ConsoleApplication29
{

    class Program
    {
        static int FindByBase(int x,int bas)
        {
            int rem = 0;
            while (x>0)
            {
                 rem += (x %bas);
                 x /= bas;
            }
            return rem;

        }
         static long gcd(long a, long b)
        {
            return b == 0 ? a : gcd(b, a % b);
        }
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int sum = 0;

                for (int i = 2; i <= a - 1; i++)
                {
                    sum += FindByBase(a, i);
                }
                Console.WriteLine(sum / gcd(sum, a - 2) + "/" + (a - 2) / gcd(sum, a - 2));

        }
    }
}

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

namespace Sharp
{
  class Program
  {
    static void Main(string[] args)
    {
      int a = int.Parse(Console.ReadLine());
      int sum = 0;
      int count = a - 2;

      for (int i = 2; i < a; i++)
      {
        int degree = 0;
        int tmp = a;
        while (tmp >= i)
        {
          tmp /= i;
          degree++;
        }
        tmp = a;
        while (degree >= 0)
        {
          int mod = tmp / ((int)Math.Pow(i, degree));
          tmp -= mod * ((int)Math.Pow(i, degree));
          degree--;
          sum += mod;
        }
      }

      if (sum % count != 0)
      {
        int nod = Program.NOD(sum, count);
        sum /= nod;
        count /= nod;
      }

      Console.WriteLine(sum + "/" + count);
      return;
    }

    static int NOD(int a, int b)
    {
      while (a != 0 && b != 0)
      {
        if (a >= b)
          a = a % b;
        else
          b = b % a;
      }
      return a + b;
    }
  }

}

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

// (づ°ω°)づﾐe★゜・。。・゜゜・。。・゜☆゜・。。・゜゜・。。・゜
public class Solver
{
    long Gcd(long a, long b)
    {
        return b > 0 ? Gcd(b, a % b) : a;
    }

    public void Solve()
    {
        int a = ReadInt();
        long sum = 0;
        for (int b = 2; b < a; b++)
        {
            int x = a;
            while (x > 0)
            {
                sum += x % b;
                x /= b;
            }
        }

        long den = a - 2;
        long g = Gcd(sum, den);
        writer.WriteLine("{0}/{1}", sum / g, den / g);
    }

    #region Main

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

    #endregion

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

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

namespace Codeforces
{
    class Functions
    {
        public static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

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

        public static string[] ReadLineWithSplit(char split)
        {
            return Console.ReadLine().Split(split);
        }

        public static string[] ReadLines(int count)
        {
            string[] lines = new string[count];
            for (int x = 0; x < count; x++)
            {
                lines[x] = ReadLine();
            }
            return lines;
        }
        public static string ReverseInts(string s)
        {
            string[] charArray = s.Split(' ');
            Array.Reverse(charArray);
            return charArray.Aggregate("", (current, s1) => current + (s1 + " "));
        }
        public static string Reverse(string s)
        {
            char[] charArray = s.ToCharArray();
            Array.Reverse(charArray);
            return charArray.Aggregate("", (current, s1) => current + (s1 + " "));
        }
    }
    class Program
    {
        private static void Main()
        {
            int num = Functions.ReadInt();

            List<int> converted = new List<int>();
            List<int> sums = new List<int>();

            for (var x = 2; x < num; x++)
            {
                converted = ConvertToBase(num, x);
                sums.Add(converted.Sum());
            }

            int gcd = GCD(sums.Sum(), sums.Count);
            Console.WriteLine(sums.Sum()/gcd + "/" + sums.Count/gcd);
        }

        private static int GCD(int sum, int sumsCount)
        {
            int min = Math.Min(sum, sumsCount);
            var gcd = 0;
            for (var i = 1; i <= min; i++)
            {
                if (sum % i == 0 && sumsCount % i == 0 && i > gcd)
                {
                    gcd = i;
                }
            }

            return gcd;
        }

        private static List<int> ConvertToBase(int num, int i)
        {
            List<int> basei = new List<int>();
            for (var x = 15; x >= 0; x--)
            {
                if (num >= Math.Pow(i, x))
                {
                    basei.Add((int)Math.Floor(num/Math.Pow(i,x)));
                    num -= (int) (Math.Floor(num/Math.Pow(i, x))*Math.Pow(i, x));
                }
                else
                {
                    basei.Add(0);
                }
            }

            return basei;
        }
    }
}

using System;
using System.Linq;
class Program
{
    static void Main()
    {
        var a = int.Parse(Console.ReadLine());
        var sums = new int[a - 2];
        var index = 0;
        for (int i = 2; i < a; i++)
        {
            var num = a;
            while (num != 0)
            {
                var rem = num % i;
                num /= i;
                sums[index] += rem;
            }
            index++;
        }
        int x = sums.Sum();
        int y = sums.Length;
        while (y > 0)
        {
            int rem = x % y;
            x = y;
            y = rem;
        }
        Console.WriteLine(sums.Sum() / x + "/" + sums.Length / x);
    }
}

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

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

        return ret;
    }

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

        return ret;
    }

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

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

        int sum_sum = 0;
        int count = 0;
        for (int b = 2; b < n; b++)
        {
            int sum = 0;
            int a = n;
            while (a > 0)
            {
                sum += a % b;
                a /= b;
            }
            sum_sum += sum;
            count++;
        }

        int div = 2;
        while (div < count)
        {
            while ((sum_sum % div) == 0 && (count % div) == 0)
            {
                sum_sum /= div;
                count /= div;
            }
            div++;
        }

        Console.WriteLine("{0}/{1}", sum_sum, count);
    }
}

using System;
using System.Collections.Generic;

namespace ConsoleApplication11
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int a = Int32.Parse(str);
            List<int> ii = new List<int>();
            int result = 0;

            for (int sysch = 2; sysch < a; sysch++)
            {
                int chislo = perevod(a, sysch);
                result += chislo;
                ii.Add(chislo);
            }

            int o = Nod(result, ii.Count);

            if (o == 1)
            {
                Console.WriteLine("{0}/{1}", result, ii.Count);
            }
            else
            {
                Console.WriteLine("{0}/{1}", result/o, ii.Count/o);
            }

        }

        private static int Nod(int n, int d)
        {
            int temp;
            n = Math.Abs(n);
            d = Math.Abs(d);
            while (d != 0 && n != 0)
            {
                if (n%d > 0)
                {
                    temp = n;
                    n = d;
                    d = temp%d;
                }
                else break;
            }
            if (d != 0 && n != 0) return d;
            else return 0;
        }

        public static int perevod(int a, int sysch)
        {
            int temp1 = 0;
            int result = 0;
            List<int> s = new List<int>();
            while (a > 0)
            {
                temp1 = a%sysch;
                a = a/sysch;
                s.Add(temp1);
                result += temp1;
            }
            return result;
        }
    }
}

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

namespace Task13A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());
            List<int> summaryNums = new List<int>();

            for (int i = 2; i < A; i++)
                summaryNums.Add(sumOfInBase(A, i));

            int sum = summaryNums.Sum();
            int gcd = GCD(sum, summaryNums.Count);

            Console.WriteLine("{0}/{1}",sum/gcd,summaryNums.Count/gcd);

        }

        private static int sumOfInBase(int number, int Base)
        {
            int ans = 0;
            while (number != 0) {
                int remains = number % Base;
                ans += remains;
                number /= Base;
            }

            return ans;
        }

        private static int GCD(int a, int b) {

            if (b == 0)
                return a;

            return GCD(b, a % b);
        }

    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static int Div(int a, int b)
        {
            for (int i = 2; i <= b; i++)
            {
                if (a % i == 0 && b % i == 0)
                    return i;
            }
            return 1;
        }
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());

            int rez = 0;
            for (int i = 2; i < t; i++)
            {
                int number = t;
                while (number >= i)
                {
                    rez += number % i;
                    number /= i;
                }
                rez += number;
            }
            int count = t - 2;
            int r;
            while ((r = Div(rez, count)) > 1)
            {
                rez /= r; count /= r;
            }
            Console.WriteLine($"{rez}/{count}");
        }
    }
}

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

namespace CodeForces
{
    static class Reader
    {
        public static int NextInt()
        {
            int ret = 0;
            char c;

            while (!char.IsDigit(c = (char)Console.Read()))
            {
                if (c == '-')
                    return -NextInt();
            }
            do
            {
                ret = ret * 10 + c - '0';
            } while (char.IsDigit(c = (char)Console.Read()));

            return ret;
        }

        public static double NextDouble()
        {
            double ret = 0;
            char c;

            while (!char.IsDigit(c = (char)Console.Read()))
            {
                if (c == '-')
                    return -NextDouble();
            }
            do
            {
                ret = ret * 10 + c - '0';
            } while (char.IsDigit(c = (char)Console.Read()));
            if (c != '.') return ret;

            double p10 = 0.1;
            while (char.IsDigit(c = (char)Console.Read()))
            {
                ret += p10 * (c - '0');
                p10 *= 0.1;
            }

            return ret;
        }
    }

    class Program
    {
        static int GCD(int n, int m)
        {
            return m == 0 ? n : GCD(m, n % m);
        }

        static void Main(string[] args)
        {
            int A = Reader.NextInt();
            int num = 0, den = 0;

            for (int b = 2; b < A; ++b)
            {
                den++;
                for (int t = A; t > 0; t /= b)
                    num += t % b;
            }

            int g = GCD(num, den);
            Console.WriteLine("{0}/{1}", num / g, den / g);
        }
    }
}

using System;
class Test {
    static void Main() {
        int n = int.Parse(Console.ReadLine());
        int sum = 0;
        int div = n-2;
        for(int i = 2 ; i < n ; i++){
            int tmp = n;
            while(true){
                sum += tmp%i;
                tmp -= tmp%i;
                tmp /= i;
                if(tmp==1){
                    sum ++;
                    break;
                }
                if(tmp==0){
                    break;
                }
            }
        }
        int len = 0;
        if(sum<div){
            len = sum;
        }else{
            len = div;
        }
        for(int j = len ; j >1 ; j--){
            if(sum%j==0 && div%j == 0){
                sum /= j;
                div /= j;
                break;
            }
        }
        Console.WriteLine(sum+"/"+div);
    }
}

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

namespace ProgrammingContest.Codeforces.Round13
{
    class A
    {
        public static void Main()
        {
            string s = Console.ReadLine();
            long n = long.Parse(s);
            long sum = 0;
            for (long i = 2; i < n; i++)
            {
                for (long x = n; x != 0; x /= i)
                {
                    sum += x % i;
                }
            }
            long nume = sum;
            long deno = n - 2;
            for (long i = 2; i <= Math.Min(nume, deno); i++)
            {
                while (nume % i == 0 && deno % i == 0)
                {
                    nume /= i;
                    deno /= i;
                }
            }
            Console.WriteLine("{0}/{1}", nume, deno);
        }
    }
}

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

namespace CodeForce
{
    class _13a
    {
        public static void Main()
        {
            var line = Console.ReadLine();
            var n = int.Parse(line);
            var sum = 0;
            for (var i = 2; i < n; i++)
            {
                var num = n;
                while (num != 0)
                {
                    sum += num % i;
                    num /= i;
                }
            }
            var low = n - 2;
            for (var i = 2; i < 1010; i++)
            {
                while (low % i == 0 && sum % i == 0)
                {
                    low /= i;
                    sum /= i;
                }
            }
            Console.WriteLine("{0}/{1}", sum, low);
        }
    }
}

using System;

public class Program
{
	public static void Main()
	{
		int n,total =0;
		n = Convert.ToInt32(Console.ReadLine());
		for(int i=2;i<=(n-1);i++)
		{
			int nilai=n;
			while(nilai !=0)
			{
				total += nilai%i;
				nilai = nilai/i;
			}
		}
		int temp = n-2;
		for(int i=2;i<=(n-2);i++)
		{
			while(total%i == 0 && temp%i == 0)
			{
				total /= i;
				temp /=i;
			}
		}

		Console.WriteLine("{0}/{1}", total,temp);
	}
}

using System;

namespace Task_13A
{
    class Program
    {
        static int suminBase(int A , int baza)
        {
            int ans = 0;
            while (A!= 0)
            {
                ans += A % baza;
                A /= baza;
            }
            return ans;
        }

        static int GCD(int a, int b)
        {
            if (b == 0) return a;
            return GCD(b, a % b);
        }
        static void Main(string[] args)
        {
            int a=int.Parse(Console.ReadLine());
            int sum=0;
            for (int i = 2; i < a; i++)
                sum += suminBase(a, i); //funqcia

            int temp = GCD(sum, a - 2);// udidesi  saerTo gamyofi
            Console.WriteLine("{0}/{1}", sum / temp, (a - 2) / temp);
        }
    }
}

/*******************************************************************************
* Author: Nirushuu
*******************************************************************************/

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

/*******************************************************************************
* IO from Kattio.cs from open.kattis.com/help/csharp                          */
public class NoMoreTokensException : Exception
{
}

public class Tokenizer
{
    string[] tokens = new string[0];
    private int pos;
    StreamReader reader;

    public Tokenizer(Stream inStream)
    {
        var bs = new BufferedStream(inStream);
        reader = new StreamReader(bs);
    }

    public Tokenizer() : this(Console.OpenStandardInput())
    {
        // Nothing more to do
    }

    private string PeekNext()
    {
        if (pos < 0)
            // pos < 0 indicates that there are no more tokens
            return null;
        if (pos < tokens.Length)
        {
            if (tokens[pos].Length == 0)
            {
                ++pos;
                return PeekNext();
            }
            return tokens[pos];
        }
        string line = reader.ReadLine();
        if (line == null)
        {
            // There is no more data to read
            pos = -1;
            return null;
        }
        // Split the line that was read on white space characters
        tokens = line.Split(null);
        pos = 0;
        return PeekNext();
    }

    public bool HasNext()
    {
        return (PeekNext() != null);
    }

    public string Next()
    {
        string next = PeekNext();
        if (next == null)
            throw new NoMoreTokensException();
        ++pos;
        return next;
    }
}

public class Scanner : Tokenizer
{

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

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

    public float NextFloat()
    {
        return float.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }
}

public class BufferedStdoutWriter : StreamWriter
{
    public BufferedStdoutWriter() : base(new BufferedStream(Console.OpenStandardOutput()))
    {
    }
}
/******************************************************************************/

/*******************************************************************************
* DisjointSet datastructure                                                   */
public struct DisjointSet {
    public int[] parent;
    public int[] rank;
    public DisjointSet(int n) {
        parent = new int[n];
        for (int i = 0; i < n; ++i) {
            parent[i] = i;
        }
        rank = new int[n];
    }

    public int Find(int i) {
        int idx = i;
        var compress = new List<int>();
        while (idx != parent[idx]) {
            compress.Add(idx);
            idx = parent[idx];
        }

        foreach (var e in compress) {   // path compress
            parent[e] = idx;
        }
        return idx;
    }

    public void Union(int a, int b) {
        int aPar = this.Find(a);
        int bPar = this.Find(b);

        if (rank[aPar] > rank[bPar]) {  // by rank
            parent[bPar] = aPar;
        } else {
            parent[aPar] = bPar;
        }
        if (rank[aPar] == rank[bPar]) {
            ++rank[bPar];
        }
    }
}

class MaxHeap {
    List<int> data;

    public MaxHeap() {
        data = new List<int>();
    }

    public void Add(int a) {
        data.Add(a);
        int idx = data.Count - 1;
        int parent = (int) Math.Floor((double) (idx - 1) / 2);
        while (idx != 0 && (data[idx] > data[parent])) {
            int tmp = data[parent];
            data[parent] = data[idx];
            data[idx] = tmp;

            idx = parent;
            parent = (int) Math.Floor((double) (idx - 1) / 2);
        }
    }

    public int Pop() {
        int res = data[0];
        data[0] = data[data.Count - 1];
        data.RemoveAt(data.Count - 1);

        int idx = 0;
        while (true) {
            int child1 = (2 * idx) + 1;
            int child2 = (2 * idx) + 2;

            if (child1 >= data.Count) { // no children
                break;
            } else if (child2 >= data.Count) {  // one child
                if (data[idx] < data[child1]) {
                    int tmp = data[idx];
                    data[idx] = data[child1];
                    data[child1] = tmp;
                }
                break;
            } else {    // two children
                int maxChild = data[child1] > data[child2] ? child1 : child2;
                if (data[idx] < data[maxChild]) {
                    int tmp = data[idx];
                    data[idx] = data[maxChild];
                    data[maxChild] = tmp;
                    idx = maxChild;
                    continue;
                } else {    // no swap
                    break;
                }
            }
        }

        return res;
    }

}

class Dequeue {
    public Dictionary<int, int> data = new Dictionary<int, int>();
    int firstIdx;
    public int Count;
    public Dequeue() {
        data = new Dictionary<int, int>();
        firstIdx = 1;
        Count = 0;
    }

    public void PushFront(int a) {
        data[firstIdx - 1] = a;
        ++Count;
        --firstIdx;
    }

    public void PushBack(int a) {
        data[firstIdx + Count] = a;
        ++Count;
    }

    public int PopFront() {
        --Count;
        ++firstIdx;
        return data[firstIdx - 1];
    }

    public int PopBack() {
        --Count;
        return data[firstIdx + Count];
    }

    public int Get(int n) {
        return data[firstIdx + n];
    }
}
/******************************************************************************/

class MainClass {

    // Debug functions
    static void debug<T>(IEnumerable<T> a, string s = "") {
        Console.WriteLine($"name: {s}");
        int i = 0;
        foreach (var e in a) {
            Console.WriteLine($"value {i}: {e}");
            ++i;
        }
    }
    static void dbg<T>(T a, string s = "") {
        Console.WriteLine($"name: {s} value: {a}");
    }
    ////////////////////

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

    static bool between(int a, int b, int c) {
        return (a >= b && a <= c);
    }

    static int findIn(string s, string a) {
        for (int i = 0; i < s.Length - (a.Length - 1); ++i) {
            bool found = true;
            for (int j = 0; j < a.Length; ++j) {
                if (s[i + j] != a[j]) {
                    found = false;
                    break;
                }
            }

            if (found) {
                return i;
            }
        }

        return -1;
    }

    static double dist(double a, double b, double c, double d) {
        return Math.Sqrt(Math.Pow((a - c), 2) + Math.Pow((b - d), 2));
    }

    public static void Main() {

        var sc = new Scanner();
        var wr = new BufferedStdoutWriter();
        var dot = new NumberFormatInfo();
        dot.NumberDecimalSeparator = ".";

        var a = sc.NextInt();

        // 11
        // var sums = new List<int>();
        int sum = 0;
        for (int i = 2; i < a; ++i) {
            int n = a;
            var digits = new List<int>();
            for (int j = 11; j >= 0; --j) {
                sum += n / (int)Math.Pow(i, j);
                n %= (int)Math.Pow(i, j);
            }

            // int sum = 0;
            // foreach (var e in digits) {
            //     sum += e;
            // }
            // sums.Add(sum);
        }

        // int sum = 0;
        // foreach (var e in sums) {
        //     sum += e;
        // }

        int numerator = sum;
        int denominator = a - 2;

        for (int i = 2; i <= denominator; ++i) {
            while (numerator % i == 0 && denominator % i == 0) {
                numerator /= i;
                denominator /= i;
            }
        }

        wr.Write($"{numerator}/{denominator}");

        wr.Flush();

    }
}

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

namespace CodeforcesCs
{
    class Program
    {
        static void Main(string[] args)
        {
            long a = long.Parse(Console.ReadLine());
            long sum = 0;
            for (long i = 2; i < a; i++)
            {
                long[] bytes = getBytes(a, i);

                //string s = bytes.Aggregate("", (prev, cur) => prev + " " + cur.ToString());
                //Console.WriteLine("{0}: {1}", i, s);

                long curSum = bytes.Sum();
                sum += curSum;
            }

            long d = gcd(sum, a - 2);
            //Console.WriteLine("sum = {0}, d = {1}", sum, d);
            sum /= d;
            Console.WriteLine("{0}/{1}", sum, (a - 2) / d);
        }

        private static long[] getBytes(long num, long radix)
        {
            List<long> bytes = new List<long>();
            while (num >= radix)
            {
                bytes.Add(num % radix);
                num /= radix;
            }
            bytes.Add(num);
            bytes.Reverse();
            return bytes.ToArray();
        }

        private static long gcd(long a, long b)
        {
            long x, y = a, z = b;
            do
            {
                x = y;
                y = z;
                z = x % y;
            } while (z != 0);
            return y;
        }
    }
}

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

class Program
{

    void solve()
    {

        int A = nextInt();
        int s = 0;
        for (int i = 2; i <= A - 1; i++)
        {
            s += sum(A, i);
        }
        int g = gcd(s, A - 2);
        s /= g;
        int d = (A - 2)/g;
        Console.WriteLine(s + "/" + d);

    }
    int gcd(int a, int b)
    {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    int sum(int num, int b)
    {
        int ret=0;
        while (num > 0)
        {
            ret += num % b;
            num /= b;
        }
        return ret;
    }

    //

    string[] inputLine = new string[0];
    int inputInd = 0;
    string nextLine()
    {
        return Console.ReadLine();
    }
    void readInput()
    {
        if (inputInd != inputLine.Length)
            throw new Exception();
        inputInd = 0;
        inputLine = Console.ReadLine().Split();

    }
    int nextInt()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return int.Parse(inputLine[inputInd++]);
    }
    long nextLong()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return long.Parse(inputLine[inputInd++]);
    }
    double nextDouble()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return double.Parse(inputLine[inputInd++]);
    }
    string nextString()
    {
        if (inputInd == inputLine.Length)
            readInput();
        return inputLine[inputInd++];
    }
    static void Main(string[] args)
    {
        new Program().solve();
    }
}

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

namespace codeforces
{
    class C
    {
        static CodeforcesUtils CF = new CodeforcesUtils(
@"
5000
");

        static void Main(string[] args)
        {
            int A = int.Parse(CF.ReadLine());

            int sum = 0;
            for (int a = 2; a <= A - 1; a++)
            {
                List<int> ds = _b(A, a);
                foreach (int d in ds)
                    sum += d;
            }

            int x = sum;
            int y = A - 2;
            for (int i = y; i>=2; i--)
            {
                if ((x % i) == 0 && (y % i) == 0)
                {
                    x /= i;
                    y /= i;
                }
            }

            CF.WriteLine(x+"/"+y);
        }

        static List<int> _b(int a, int b)
        {
            List<int> ds = new List<int>();
            for (; ; )
            {
                int d = a % b;
                ds.Add(d);
                a /= b;
                if (a == 0)
                    break;
            }
            return ds;
        }

        #region test

        class CodeforcesUtils
        {
            public string ReadLine()
            {
#if DEBUG
                if (_lines == null)
                {
                    _lines = new List<string>();
                    string[] ss = _test_input.Replace("\n", "").Split('\r');
                    for (int i = 0; i < ss.Length; i++)
                    {
                        if (
                            (i == 0 || i == ss.Length - 1) &&
                            ss[i].Length == 0
                            )
                            continue;

                        _lines.Add(ss[i]);
                    }
                }

                string s = null;
                if (_lines.Count > 0)
                {
                    s = _lines[0];
                    _lines.RemoveAt(0);
                }
                return s;
#else
            return Console.In.ReadLine();
#endif
            }

            public void WriteLine(object o)
            {
#if DEBUG
                System.Diagnostics.Trace.WriteLine(o);
#else
            Console.WriteLine(o);
#endif
            }

            public void Write(object o)
            {
#if DEBUG
                System.Diagnostics.Trace.Write(o);
#else
            Console.Write(o);
#endif
            }

            public CodeforcesUtils(string test_input)
            {
                _test_input = test_input;
            }

            string _test_input;

            List<string> _lines;
        }

        #endregion
    }
}

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

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

            int sum = 0;
            int tempnum = num;

            for (int i = 2; i < num; i++)
            {
                tempnum = num;
                while (tempnum > 0)
                {
                    sum += tempnum % i;
                    tempnum /= i;
                }
            }

            int denom = num - 2;
            int gcd = 0;
            while (gcd != 1)
            {
                gcd = GCD(sum, denom);
                sum = sum / gcd;
                denom = denom / gcd;
            }

            Console.WriteLine(sum + "/" + denom);

            // Console.WriteLine(sum + "/" + (num - 2).ToString());
            //Console.WriteLine(FindSumOfDigits(5));

           // StreamReader f1 = new StreamReader("C-small-practice.in");
         //   string line = f1.ReadLine();

         //   FileStream f2 = new FileStream("Output.txt",FileMode.Open);
         //   byte[] bytes = Encoding.ASCII.GetBytes("Hello");
         //   f2.Write(bytes, 0, bytes.Length);

        }

        public static int GCD(int a,int b)

        {
            if (b == 0)
       return a;
    else
       return GCD(b, a % b);
        }

    }
}

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

namespace code_25
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int sum = 0;
            int k;
            for (int i = 2; i < a ; i++)
            {
                k = a;
                while (k >= i)
                {
                    int z = k / i;
                    sum += k - i * z;
                    k = k / i;
                }
                sum += k;
            }
            k=a-2;

            for (int i = a-2; i >=2;i-- )
                if (sum % i == 0 && k % i == 0)
                {
                    sum /= i;
                    k /= i;
                }
                Console.WriteLine(sum + "/" + k);
        }
    }
}

using System;

class A {
	static int gcd(int a, int b)
	{
		int r = 0;
		while (b > 0) {
			r = a % b;
			a = b;
			b = r;
		}
		return a;
	}

	public static void Main()
	{
		int A = int.Parse(Console.ReadLine());

		int n = 0;
		for (int b = 2; b < A; ++b) {
			int a = A;
			while (a > 0) {
				n += a % b;
				a /= b;
			}
		}

		int d = A - 2;
		Console.WriteLine("{0}/{1}", n / gcd(n, d), d / gcd(n, d));
	}
}

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

class Problem
{
    const string inFile = "..\\..\\test.in";

    public void Process()
    {
        TextReader reader = Console.In;

        // comment out this line when submit
        //reader = new StreamReader(inFile);
        int A = int.Parse(reader.ReadLine());

        string res = Solve(A);
        Console.WriteLine(res);

        if (reader != Console.In)
        {
            Console.WriteLine("Successful.");
        }
    }

    private string Solve(int A)
    {
        int sum = 0;
        for (int i = 2; i < A; i++)
        {
            int temp = 0;
            int k = A;
            while (k > 0)
            {
                int t = k % i;
                temp += t;
                k /= i;
            }

            sum += temp;
        }

        int a = sum;
        int b = A - 2;
        int c = gcd(a, b);

        a /= c;
        b /= c;

        return string.Format("{0}/{1}", a, b);
    }

    static int gcd(int a, int b)
    {
        while (a % b > 0) { int x = a % b; a = b; b = x; }
        return b;
    }

    public static void Main()
    {
        Problem p = new Problem();
        p.Process();
    }
}

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

namespace CF_013A {
  class Program {
    static int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
    static void Main(string[] args) {
      //while(true) {
      int A=int.Parse(Console.ReadLine());
      int u=0;
      for(int i=2;i<A;i++) {
        int t=A;
        while(t>0) {
          u+=t%i;
          t/=i;
        }
      }
      int g=gcd(u,A-2);
      Console.WriteLine("{0}/{1}",u/g,(A-2)/g);
      //}
    }
  }
}

using System;
using System.Linq;

namespace SDA
{
    class A13
    {
        static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());
            var sum = 0;
            for (int i = 2; i < a; i++)
            {
                for (int x = a; x != 0; x /= i)
                {
                    sum += x % i;
                }
            }
            var num = sum;
            var den = a - 2;
            for (int i = 2; i <= Math.Min(num, den); i++)
            {
                while (num % i == 0 && den % i == 0)
                {
                    num /= i;
                    den /= i;
                }
            }
            Console.WriteLine(num+"/"+den);
        }
    }
}

using System;

namespace Codeforces
{
    public class Numbers
    {
        public static void Main(string[] args)
        {
            var a = int.Parse(Console.ReadLine());
            var x = 0;
            for (int i = 2; i < a; i++)
            {
                var temp = a;
                while(temp > 0)
                {
                    x += temp%i;
                    temp /= i;
                }
            }
            var y = a - 2;
            var z = GCD(x, y);
            Console.WriteLine((x / z) + "/" + (y / z));
        }

        private static int GCD(int x, int y)
        {
            return x%y == 0 ? y : GCD(y, x%y);
        }
    }
}

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

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

           // Array.ConvertAll((Console.ReadLine().Split(' ')), (x => int.Parse(x)));
           int n = int.Parse(Console.ReadLine());
            int k = 0;
            for (int i = 2; i < n; i++)
                k += Col(n, i);
            int del = 0;
            n -= 2;
            for (int i = 1; i <= Math.Min(n, k); i++)
                if (n % i == 0 && k % i == 0)
                    del = i;
            Console.WriteLine(k / del + "/" + n / del);
        }

        static int Col(int num, int k)
        {
            int result = 0;
            while (num > 0)
            {
                result += num % k;
                num /= k;
            }
            return result;
        }

    }
}

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

namespace CodeForces
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = Convert.ToInt32(Console.ReadLine());

            (new Program()).Numbers(A);
            Console.ReadLine();
        }

        public void Numbers(int A)
        {
            int i = 0;
            int a1 = 0;
            int a2 = A - 2;

            for (i = 2; i < A; i++)
            {
                a1 += ChangeBase(i, A);
            }

            i = GCD(a1, a2);
            a1 /= i;
            a2 /= i;

            Console.WriteLine(a1 + "/" + a2);
        }

        private int ChangeBase(int b, int A)
        {
            int i = 0;
            int count = 0;
            int[] d = new int[15];

            for (; i < 15 && A >= 1; i++)
            {
                d[i] = A % b;
                A = (int)(A / b);
            }

            for (i = 0; i < 15; i++)
            {
                count += d[i];
            }

            return count;
        }

        private int GCD(int a, int b)
        {
            int g = 0;

            if (b == 0)
            {
                g = a;
            }
            else
            {
                g = GCD(b, a % b);
            }

            return g;
        }
    }
}

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

namespace Codeforces.TaskA
{
    public class Task
    {
        void Solve()
        {
            Input.Next(out int A);
            int Y = A - 2;
            int X = 0;
            for (int i = 2; i <= A - 1; i++)
            {
                var nums = Convert(A, i);
                X += nums.Sum();
            }

            var gcd = Primes.Gcd(X, Y);
            Console.WriteLine($"{X/gcd}/{Y/gcd}");
        }

        List<int> Convert(int num, int bas)
        {
            var res = new List<int>();

            while (num > 0)
            {
                res.Add(num % bas);
                num /= bas;
            }

            res.Reverse();
            return res;
        }

        public static void Main()
        {
            var task = new Task();
            #if DEBUG
            task.Solve();
            #else
            try
            {
                task.Solve();
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(ex);
            }
            #endif
        }
    }
}

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 bool Next(out int a, out int b, out int c, out int d, out int e, out int f)
        {
            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];
                f = array[5];
            }
            else
            {
                a = b = c = d = e = f = 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;
        private Node _root;
        private readonly IComparer<TKey> _comparer;

        public RedBlackTree(int capacity = 10)
        {
            _items = new List<Node>(capacity);
            _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;
        }

        /// <summary>
        /// Returns lower or equal key
        /// </summary>
        public TKey Lower(TKey key, TKey notFound = default(TKey))
        {
            var node = _root;
            Node good = null;
            while (node != null)
            {
                var i = _comparer.Compare(key, node.Key);
                if (i == 0) return key;
                if (i > 0)
                {
                    good = node;
                    node = node.Right;
                }
                else
                    node = node.Left;
            }
            return good == null ? notFound : good.Key;
        }

        /// <summary>
        /// Returns higher or equal key
        /// </summary>
        public TKey Higher(TKey key, TKey notFound = default(TKey))
        {
            var node = _root;
            Node good = null;
            while (node != null)
            {
                var i = _comparer.Compare(key, node.Key);
                if (i == 0) return key;
                if (i < 0)
                {
                    good = node;
                    node = node.Left;
                }
                else
                    node = node.Right;
            }
            return good == null ? notFound : good.Key;
        }

        /// <summary>
        /// Returns minimum region, which encloses given key
        /// </summary>
        public Tuple<TKey, TKey> Bounds(TKey key, TKey notFound = default(TKey))
        {
            var node = _root;
            Node lower = null;
            Node higher = null;
            while (node != null)
            {
                var i = _comparer.Compare(key, node.Key);
                if (i == 0) return new Tuple<TKey, TKey>(key, key);
                if (i < 0)
                {
                    higher = node;
                    node = node.Left;
                }
                else
                {
                    lower = node;
                    node = node.Right;
                }
            }
            return new Tuple<TKey, TKey>(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);
        }

        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
    }

    public class RedBlackTreeSimple<TKey>
    {
        private readonly List<Node> _items;
        private Node _root;
        private readonly IComparer<TKey> _comparer;

        public RedBlackTreeSimple(int capacity = 10)
        {
            _items = new List<Node>(capacity);
            _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;
        }

        /// <summary>
        /// Returns lower or equal key
        /// </summary>
        public TKey Lower(TKey key, TKey notFound = default(TKey))
        {
            var node = _root;
            Node good = null;
            while (node != null)
            {
                var i = _comparer.Compare(key, node.Key);
                if (i == 0) return key;
                if (i > 0)
                {
                    good = node;
                    node = node.Right;
                }
                else
                    node = node.Left;
            }
            return good == null ? notFound : good.Key;
        }

        /// <summary>
        /// Returns higher or equal key
        /// </summary>
        public TKey Higher(TKey key, TKey notFound = default(TKey))
        {
            var node = _root;
            Node good = null;
            while (node != null)
            {
                var i = _comparer.Compare(key, node.Key);
                if (i == 0) return key;
                if (i < 0)
                {
                    good = node;
                    node = node.Left;
                }
                else
                    node = node.Right;
            }
            return good == null ? notFound : good.Key;
        }

        /// <summary>
        /// Returns minimum region, which encloses given key
        /// </summary>
        public Tuple<TKey, TKey> Bounds(TKey key, TKey notFound = default(TKey))
        {
            var node = _root;
            Node lower = null;
            Node higher = null;
            while (node != null)
            {
                var i = _comparer.Compare(key, node.Key);
                if (i == 0) return new Tuple<TKey, TKey>(key, key);
                if (i < 0)
                {
                    higher = node;
                    node = node.Left;
                }
                else
                {
                    lower = node;
                    node = node.Right;
                }
            }
            return new Tuple<TKey, TKey>(lower == null ? notFound : lower.Key, higher == null ? notFound : higher.Key);
        }

        public void Add(TKey key)
        {
            var node = new Node(key);
            _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;
            }

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

        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

        private sealed class Node
        {
            public Node(TKey key)
            {
                Key = key;
            }

            public TKey Key;
            public bool Red = true;

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

        #endregion
    }

    /// <summary>
    /// Fenwick tree for summary on the array
    /// </summary>
    public class FenwickSum
    {
        public readonly int Size;
        private readonly int[] _items;
        public FenwickSum(int size)
        {
            Size = size;
            _items = new int[Size];
        }

        public FenwickSum(IList<int> items)
            : this(items.Count)
        {
            for (var i = 0; i < Size; i++)
                Increase(i, items[i]);
        }

        private int Sum(int r)
        {
            if (r < 0) return 0;
            if (r >= Size) r = Size - 1;
            var result = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1)
                result += _items[r];
            return result;
        }

        private int Sum(int l, int r)
        {
            return Sum(r) - Sum(l - 1);
        }

        public int this[int r]
        {
            get { return Sum(r); }
        }

        public int this[int l, int r]
        {
            get { return Sum(l, r); }
        }

        public void Increase(int i, int delta)
        {
            for (; i < Size; i = i | (i + 1))
                _items[i] += delta;
        }
    }

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

    /// <summary>
    /// Graph matching algorithms
    /// </summary>
    public class GraphMatching
    {
        #region Kuhn algorithm

        /// <summary>
        /// Kuhn algorithm for finding maximal matching
        /// in bipartite graph
        /// Vertexes are numerated from zero: 0, 1, 2, ... n-1
        /// Return array of matchings
        /// </summary>
        public static int[] Kuhn(List<int>[] g, int leftSize, int rightSize)
        {
            Debug.Assert(g.Count() == leftSize);

            var matching = new int[leftSize];
            for (var i = 0; i < rightSize; i++)
                matching[i] = -1;
            var used = new bool[leftSize];

            for (var v = 0; v < leftSize; v++)
            {
                Array.Clear(used, 0, leftSize);
                _kuhn_dfs(v, g, matching, used);
            }

            return matching;
        }

        private static bool _kuhn_dfs(int v, List<int>[] g, int[] matching, bool[] used)
        {
            if (used[v]) return false;
            used[v] = true;
            for (var i = 0; i < g[v].Count; i++)
            {
                var to = g[v][i];
                if (matching[to] == -1 || _kuhn_dfs(matching[to], g, matching, used))
                {
                    matching[to] = v;
                    return true;
                }
            }
            return false;
        }

        #endregion
    }
}

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

namespace ConsoleApplication1
{
    class Program
    {

        static void Main(string[] args)
        {

            string s = Console.ReadLine();
            int A = Convert.ToInt32(s);
            int buf;
            int sum = 0;
            int ct=0;
            for(int i=2;i<=A-1;i++)
            {
                buf=A;
                while(buf>0)
                {
                    sum+=buf%i;

                    buf = buf / i;

                }
            }
            ct = A - 1 - 2+1;

            for(int i=1000000;i>=1;i--)
            {
                if(sum%i==0 && ct%i==0)
                {
                    sum/=i;
                    ct/=i;
                }
            }
            Console.Write(sum);
            Console.Write("/");
            Console.WriteLine(ct);

        }

    }
}

using System;

namespace Numbers_13
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = Convert.ToInt32(Console.ReadLine());
            int ans = 0;
            for (int i = 2; i <= n - 1; i++)
            {
                ans += SumOfDigitsInBase(n, i);
            }

            int gcd = GCD(ans, n - 2);
            Console.WriteLine("{0}/{1}", ans / gcd, (n - 2) / gcd);

        }
        private static int GCD(int a, int b)
        {

            if (b == 0)
                return a;
            return GCD(b, a % b);

        }
        private static int SumOfDigitsInBase(int numb, int Base)
        {
            int ans = 0;

            /*for(int i=0;i<=1000;i++){

               ans+=n%m;
               n/=m;
               if(n/m==0){
               ans+=n%m;
               break;}

               }*/
            while (numb != 0)
            {
                ans += numb % Base;
                numb /= Base;
            }
            return ans;
        }

    }
}

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

static class Program {

    public static void Main (string[] args) {

        string line = Console.ReadLine ();
        int A = int.Parse (line);

        int sum = 0;
        for (int  i = 2; i < A; ++i) {
            int B = A;
            while (B >= i) {
                sum += B % i;
                B /= i;
            }
            sum += B;
        }
        int d = gcd (sum, A - 2);

        Console.WriteLine ("{0}/{1}", sum / d, (A - 2) / d);
    }

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

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

namespace ConsoleApplication5
{
    class Program
    {

        static int NOD(int a, int b)
        {
            while (a > 0 && b > 0)
            {
                if (a > b)
                    a = a % b;
                else
                    b = b % a;
            }
            return a + b;
        }

        static void Main()
        {
            int a = int.Parse(Console.ReadLine());
            int summa = 0;
            int ostatok = 0;

            for (int i = 2; i < a; i++)
            {

                int b = a;
                while (b > 0)
                {
                    ostatok = b % i;
                    b = b / i;
                    summa = summa + ostatok;
                }
            }

            int count = a - 2;
            int nod = NOD(summa, count);
            while (summa % nod == 0 && count % nod == 0 && nod != 1)
            {
                summa = summa / nod;
                count = count / nod;
                nod = NOD(summa, count);
            }

            Console.WriteLine(summa + "/" + count);

        }
    }
}

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
           int a = int.Parse(Console.ReadLine());
           int summa = 0;
           string result = "";
           for (int i = 2; i < a; i++)
           {
               int s = a;
               //result += i.ToString() + ": ";
               while (s >= i)
               {
                   summa += s % i;
                   //result += s % i;
                   s = s / i;
                   if (s < i)
                   {
                       summa += s;
                       //result += s.ToString();
                   }
               }
              // if (i < a - 1)
                   //result += ", ";
           }
           int num = a - 2;
           for (int i = num; i > 0; i--)
           {
               if (summa % i == 0 && num % i == 0)
               {
                   summa /= i;
                   num /=  i;
               }
           }
           //Console.WriteLine(result);
           Console.WriteLine(summa.ToString() + "/" + num.ToString());
           //Console.ReadLine();
        }
    }
}

using System;
// you can also use other imports, for example:
using System.Collections.Generic;
using System.Linq;

// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");

//mcs HelloWorld.cs
//mono HelloWorld.exe
public class HelloWorld {

	public static void Main(string[] args)
	{
		var line  = Console.ReadLine();
		var n = Convert.ToInt32(line);
		//var arr = Array.ConvertAll(Console.ReadLine().Split(' '), t=> Convert.ToInt32(t));
		solve(n);
		//tests();
	}

	public static void tests()
	{
		// solve(30, 5, 20, 20, 3, 5);
		// solve(10, 4, 100, 5, 5, 1);
		// solve(0, 7, 30, 50, 3, 4);
		// solve(40, 1, 40, 5, 11, 2);
		// solve(64, 12, 258, 141, 10, 7);
		// solve(64, 12, 141, 258, 7, 10);
		// solve(50,34);
		// solve(387420489,225159023);
		// solve(5,5);

	}

	public static void solve(int n)
	{
		var sum = 0;
		for (var i = 2; i < n; i++)
		{
			sum += GetSumOfDigis(n,i);
		}
		var lb = n - 2;
		if (sum % lb == 0)
		{
			Console.WriteLine($"{sum / lb}/{1}");
			return;
		}

		for (var i = 2; i < lb / 2; i++)
		{
			while (sum % i == 0 && lb % i == 0)
			{
				sum = sum / i;
				lb = lb / i;
			}
		}
		Console.WriteLine($"{sum}/{lb}");
	}

 	public static int GetSumOfDigis(int n, int b)
	{
		var sum = 0;
		while(n != 0)
		{
			sum += n % b;
			n = n / b;
		}
		return sum;
	}
}

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

namespace project
{
    class Program
    {
        static void Main(string[] args)
        {
            int n = int.Parse(Console.ReadLine());
            int i , ans1 = 0 , ans2 = n - 2 , g;
            for (i = 2; i <= n - 1; i++)
                ans1 += getValue(n, i);
            g = gcd(ans1, ans2);
            ans1 /= g;
            ans2 /= g;
            Console.WriteLine(ans1 + "/" + ans2);
        }
        static int getValue(int num, int d)
        {
            int sum = 0;
            while (num > 0)
            {
                sum += num % d;
                num /= d;
            }
            return sum;
        }
        static int gcd(int a, int b)
        {
            while (b > 0)
            {
                int t = a;
                a = b;
                b = t % a;
            }
            return a;
        }
    }
}

using System;

namespace Codeforces
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			int i, j = 2;
			double res, result, numerator, denominator, total = 0;

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

			i = input;
			double num = Convert.ToDouble (input - 2);

			while (j != Convert.ToInt32 (input)) {
				i -= 1;
				res = input;
				result = 1;
				while (result != 0) {
					result = Math.Floor (Convert.ToDouble (res) / Convert.ToDouble (i));
					if (result != 0) {
						total += res - result * i;
					} else if (res == i) {
						total += 1;
					} else {
						total += res;
					}
					res = Convert.ToDouble (result);
				}
				j += 1;
			}

			res = total;
			result = num;
			numerator = total;
			denominator = num;
			int[] array = new int[20] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71 };

			int amt = 0;
			while (amt <= 19) {
				res = numerator % array [amt];
				result = denominator % array [amt];
				if (res == 0 && result == 0) {
					numerator = numerator / array [amt];
					denominator = denominator / array [amt];
				} else {
					amt += 1;
				}
			}

			Console.WriteLine (numerator + "/" + denominator);
		}
	}
}

using System;

namespace Codeforces
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			int i, a, b, numerator, denominator, j = 2;
			double res, result, total = 0;

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

			i = input;
			double num = Convert.ToDouble (input - 2);

			while (j != Convert.ToInt32 (input)) {
				i -= 1;
				res = input;
				result = 1;
				while (result != 0) {
					result = Math.Floor (Convert.ToDouble (res) / Convert.ToDouble (i));
					if (result != 0) {
						total += res - result * i;
					} else if (res == i) {
						total += 1;
					} else {
						total += res;
					}
					res = Convert.ToDouble (result);
				}
				j += 1;
			}

			a = Convert.ToInt32 (total);
			b = Convert.ToInt32 (num);
			while (b != 0)
				b = a % (a = b);
			numerator = Convert.ToInt32 (total) / a;
			denominator = Convert.ToInt32 (num) / a;

			Console.WriteLine (numerator + "/" + denominator);
		}
	}
}

using System;

namespace Task_13A
{
    class Program
    {
        private static int GCD(int a , int b )
        {
            if (b == 0)
                return a;
            return GCD(b, a % b);
        }
        private static int SumInBase( int num , int nBase)
        {
            int ans = 0;
            while(num !=0)
            {
                ans += num % nBase;
                num = num / nBase;
            } return ans;
        }
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine()), TotalSum=0;
            for(int i=2; i<=A-1;i++)
            {
                TotalSum += SumInBase(A, i);

            }
            int temps = GCD(TotalSum, A - 2);
            Console.WriteLine("{0}/{1}", TotalSum / temps, (A - 2) / temps);
        }
    }
}

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

namespace task13A
{
    class Program
    {
        static int gcd(int a, int b)
        {
            if (b == 0)
                return a;
            else
                return gcd(b, a % b);
        }

        static short GetSumNumbers(string str)
        {
            short result = 0;
            for (Int32 i = 0; i < str.Length; i++)
            {
                result += (short)(str[i] - 48);
            }
            return result;
        }
        static Int32 GetSum(Int32 number, Int32 pos)
        {
            Int32 sum = 0;
            while (number > 0)
            {
                Int32 mod = number % pos;
                sum += mod;
                number = number / pos;
            }
            return sum;
        }
        static void Main(string[] args)
        {
            Int32 dim = Int32.Parse(Console.ReadLine());
            Int32 sum = 0;
            for (Int32 i = 2; i < dim; i++)
            {
                sum += GetSum(dim, i);
            }
            Int32 temp = gcd(sum, dim - 2);
            Console.WriteLine("{0}/{1}", sum / temp, (dim - 2)/temp);
            //Console.ReadLine();
        }
    }
}

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

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

            int counter = 0;
            for (int i = 2; i < A; i++)
            {
                int helper = A;
                while (helper > 0)
                {
                    counter += helper % i;
                    helper /= i;
                }
            }

            int d = A - 2;

            Console.WriteLine("{0}/{1}", counter / gcd(counter, d), d / gcd(counter, d));
        }
        private static int gcd(int a, int b)
        { return b == 0 ? a : gcd(b, a % b); }
    }
}

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

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

            int counter = 0;
            for (int i = 2; i < A; i++)
                counter += sumOfBase(A, i);

            Console.WriteLine("{0}/{1}", counter / gcd(counter, A-2), (A-2) / gcd(counter, A-2));
        }
        private static int gcd(int a, int b)
        {
            return b == 0 ? a : gcd(b, a % b);
        }
        private static int sumOfBase(int A, int Base)
        {
            int ans = 0;
            while (A > 0)
            {
                ans += A % Base;
                A /= Base;
            }
            return ans;
        }

    }
}

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

namespace _13A
{
    class Program
    {
        static void Main(string[] args)
        {
            int A = int.Parse(Console.ReadLine());
            int count = 0;
            int sum = 0;
            for (int i = 2; i < A; i++)
            {
                sum += Program.sum(A,i);
                count++;
            }
            Console.WriteLine(sum+"/"+count);
            Console.ReadLine();
        }

        static int sum(int A, int t)
        {
            int res = 0;
            List<int> a = new List<int>();
            while (A > 0)
            {
                res += A % t;
                A /= t;
            }
            return res;
        }
    }
}

using System;
using System.Linq;
static class P {

    static void Main() {
        int A = int.Parse(Console.ReadLine()), sum = 0, cnt = A - 2, k = 0, _base = 2, i = 2;
        var list = new string[cnt];
        for (; _base <= A - 1; ++_base) {
            string num_base = "";
            int a = A;
            while (true) {
                int rem = a % _base;
                a = a / _base;
                num_base += rem;
                if (a == 0) { break; }
            }
            list[k++] = string.Join("", num_base.Reverse());
        }
        foreach (string s in list) {
            var arr = s.Select(x => int.Parse(x.ToString()));
            sum += arr.Sum(x => x);
        }
        for (; i <= cnt; ++i) { while (sum % i == 0 && cnt % i == 0) { sum /= i; cnt /= i; } }
        Console.WriteLine("{0}/{1}", sum, cnt);
    }
}

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

namespace ConsoleApplication29
{

    class Program
    {
        static int FindByBase(int x,int bas)
        {
            int rem = 0;
            while (x>0)
            {
                 rem += (x % bas);
                 x /= bas;
            }
            return rem;

        }

        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int sum = 0;
            for (int i = 2; i <= a-1; i++)
            {
                sum += FindByBase(a, i);
            }
            Console.WriteLine(sum +"/"+(a-2));

        }
    }
}

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

namespace Sharp
{
  class Program
  {
    static void Main(string[] args)
    {
      int a = int.Parse(Console.ReadLine());
      int sum = 0;
      int count = a - 2;

      for (int i = 2; i < a; i++)
      {
        int degree = 0;
        int tmp = a;
        while (tmp >= i)
        {
          tmp /= i;
          degree++;
        }
        tmp = a;
        while (degree >= 0)
        {
          int mod = tmp / ((int)Math.Pow(i, degree));
          tmp -= mod * ((int)Math.Pow(i, degree));
          degree--;
          sum += mod;
        }
      }
      if (sum % count == 0)
      {
        Console.WriteLine(sum / count + "/1");
        return;
      }
      int k = 2;
      while (k < sum && k < count)
      {
        if (sum % k == 0 && count % k == 0)
        {
          sum /= k;
          count /= k;
        }
        k++;
      }
      Console.WriteLine(sum + "/" + count);
      return;
    }
  }
}

using System;
using System.Collections.Generic;
class Program
{
    static int ToBaseN(int number, int Base)
    {
        var n = number;
        var d = 0;
        var digit = new Queue<int>();
        while (n > 0)
        {
            digit.Enqueue((int)n % Base);
            n /= Base;
        }
        var m = 1;
        foreach (var item in digit)
        {
            d += (item * m);
            m *= 10;
        }
        return d;
    }
    static void Main()
    {
        var a = int.Parse(Console.ReadLine());
        int sum = 0;
        for (int i = 2; i < a; i++)
        {
            var n = ToBaseN(a, i);
            while (n > 0)
            {
                sum += n % 10;
                n /= 10;
            }
        }
        Console.WriteLine("{0}/{1}", sum, a - 2);
    }
}

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

namespace ConsoleApplication11
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int a = Int32.Parse(str);
            List<int> ii = new List<int>();
            int result = 0;

            for (int sysch = 2; sysch < a; sysch++)
            {
                int chislo = perevod(a, sysch);
                result+= chislo.ToString().Select(i => Int32.Parse(i.ToString())).Sum();
                ii.Add(chislo);
            }

            int o = Nod(result, ii.Count);

            if (o == 0)
            {
                Console.WriteLine("{0}/{1}", result, ii.Count);
            }
            else
            {
                Console.WriteLine("{0}/{1}", result/o, ii.Count/o);
            }

        }

        static int Nod(int n, int d)
        {
            int temp;
            n = Math.Abs(n);
            d = Math.Abs(d);
            while (d != 0 && n != 0)
            {
                if (n % d > 0)
                {
                    temp = n;
                    n = d;
                    d = temp % d;
                }
                else break;
            }
            if (d != 0 && n != 0) return d;
            else return 0;
        }

        public static int perevod(int a, int sysch)
        {
            int temp1 = 0;
            List<int> s = new List<int>();
            while (a > 0)
            {
                temp1 = a%sysch;
                a = a/sysch;
                s.Add(temp1);
            }
            return obrat(s);
        }

        public static int obrat(List<int> norm)
        {
            int[] s = new int[norm.Count];
            for (int i = norm.Count - 1; i >= 0; i--)
            {
                s[norm.Count - 1 - i] = norm[i];
            }
            return Convert.ToInt32(string.Join<int>("", s));
        }
    }
}

using System;
using System.Collections.Generic;

namespace ConsoleApplication11
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int a = Int32.Parse(str);
            List<int> ii = new List<int>();
            int result = 0;

            for (int sysch = 2; sysch < a; sysch++)
            {
                int chislo = perevod(a, sysch);
                char[] f = chislo.ToString().ToCharArray();
                for (int p = 0; p < f.Length; p++)
                {
                    result += Int32.Parse(f[p].ToString());
                }
                ii.Add(chislo);
            }

            Console.WriteLine("{0}/{1}", result, ii.Count);
        }

        public static int perevod(int a, int sysch)
        {
            int temp1 = 0;
            List<int> s = new List<int>();
            while (a > 0)
            {
                temp1 = a%sysch;
                a = a/sysch;
                s.Add(temp1);
            }
            return obrat(s);
        }

        public static int obrat(List<int> norm)
        {
            int[] s = new int[norm.Count];
            for (int i = norm.Count - 1; i >= 0; i--)
            {
                s[norm.Count - 1 - i] = norm[i];
            }
            return Convert.ToInt32(string.Join<int>("", s));
        }
    }
}

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

namespace ConsoleApplication11
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int a = Int32.Parse(str);
            List<int> ii = new List<int>();
            int result = 0;

            for (int sysch = 2; sysch < a; sysch++)
            {
                int chislo = perevod(a, sysch);
                result+= a.ToString().Select(i => Int32.Parse(i.ToString())).Sum();
                ii.Add(chislo);
            }

            int o = Nod(result, ii.Count);

            if (o == 0)
            {
                Console.WriteLine("{0}/{1}", result, ii.Count);
            }
            else
            {
                Console.WriteLine("{0}/{1}", result/o, ii.Count/o);
            }

        }

        static int Nod(int n, int d)
        {
            int temp;
            n = Math.Abs(n);
            d = Math.Abs(d);
            while (d != 0 && n != 0)
            {
                if (n % d > 0)
                {
                    temp = n;
                    n = d;
                    d = temp % d;
                }
                else break;
            }
            if (d != 0 && n != 0) return d;
            else return 0;
        }

        public static int perevod(int a, int sysch)
        {
            int temp1 = 0;
            List<int> s = new List<int>();
            while (a > 0)
            {
                temp1 = a%sysch;
                a = a/sysch;
                s.Add(temp1);
            }
            return obrat(s);
        }

        public static int obrat(List<int> norm)
        {
            int[] s = new int[norm.Count];
            for (int i = norm.Count - 1; i >= 0; i--)
            {
                s[norm.Count - 1 - i] = norm[i];
            }
            return Convert.ToInt32(string.Join<int>("", s));
        }
    }
}

using System;
using System.Collections.Generic;

namespace ConsoleApplication11
{
    internal class Program
    {
        private static void Main(string[] args)
        {
            string str = Console.ReadLine();
            int a = Int32.Parse(str);
            List<int> ii = new List<int>();
            int result = 0;

            for (int sysch = 2; sysch < a; sysch++)
            {
                int chislo = perevod(a, sysch);
                char[] f = chislo.ToString().ToCharArray();
                for (int p = 0; p < f.Length; p++)
                {
                    result += Int32.Parse(f[p].ToString());
                }
                ii.Add(chislo);
            }

            int o = Nod(result, ii.Count);

            if (o == 0)
            {
                Console.WriteLine("{0}/{1}", result, ii.Count);
            }
            else
            {
                Console.WriteLine("{0}/{1}", result/o, ii.Count/o);
            }

        }

        static int Nod(int n, int d)
        {
            int temp;
            n = Math.Abs(n);
            d = Math.Abs(d);
            while (d != 0 && n != 0)
            {
                if (n % d > 0)
                {
                    temp = n;
                    n = d;
                    d = temp % d;
                }
                else break;
            }
            if (d != 0 && n != 0) return d;
            else return 0;
        }

        public static int perevod(int a, int sysch)
        {
            int temp1 = 0;
            List<int> s = new List<int>();
            while (a > 0)
            {
                temp1 = a%sysch;
                a = a/sysch;
                s.Add(temp1);
            }
            return obrat(s);
        }

        public static int obrat(List<int> norm)
        {
            int[] s = new int[norm.Count];
            for (int i = norm.Count - 1; i >= 0; i--)
            {
                s[norm.Count - 1 - i] = norm[i];
            }
            return Convert.ToInt32(string.Join<int>("", s));
        }
    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static int Div(int a, int b)
        {
            for (int i = 2; i <= b; i++)
            {
                if (a % i == 0 && b % i == 0)
                    return i;
            }
            return 1;
        }
        static void Main(string[] args)
        {
            int t = int.Parse(Console.ReadLine());

            int rez = 0;
            for (int i = 2; i < t; i++)
            {
                int number = t;
                string ch = "";
                while (number >= i)
                {
                    ch += number % i;
                    number /= i;
                }
                ch += number;
                rez += ch.ToCharArray().Select(x => int.Parse(x.ToString())).Sum();
            }
            int count = t - 2;
            int r;
            while ((r = Div(rez, count)) > 1)
            {
                rez /= r; count /= r;
            }
            Console.WriteLine($"{rez}/{count}");
        }
    }
}

using System;
class Test {
    static void Main() {
        int n = int.Parse(Console.ReadLine());
        int sum = 0;
        for(int i = 2 ; i < n ; i++){
            int tmp = n;
            while(true){
                sum += tmp%i;
                tmp -= tmp%i;
                tmp /= i;
                if(tmp==1){
                    sum ++;
                    break;
                }
                if(tmp==0){
                    break;
                }
            }
        }
        Console.WriteLine(sum+"/"+(n-2));
    }
}

using System;
class Test {
    static string Base(int n,int b){
        string ans = "";
        while(n>1){
            ans = Convert.ToString(n%b)+ans;
            n = n/b;
            if(n==1){
                ans = Convert.ToString(n)+ans;
            }
        }
        return ans;
    }
    static void Main(){
        int n = int.Parse(Console.ReadLine());
        int sum = 0;
        for(int i=2 ; i<n ; i++){
           string tmp = Base(n,i);
            foreach(char c in tmp){
                sum+=int.Parse(Convert.ToString(c));
            }
        }
        Console.WriteLine(sum+"/"+(n-2));
    }
}

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

namespace ProgrammingContest.Codeforces.Round13
{
    class A
    {
        public static void Main()
        {
            string s = Console.ReadLine();
            int n = int.Parse(s);
            int[] m = new int[100];
            int sum = 0;
            for (int i = 2; i < n; i++)
            {
                int j = 0;
                for (int x = n; x != 0; j++, x /= i)
                {
                    m[j] = x % i;
                    sum += x % i;
                }
            }
            int nume = sum;
            int deno = n-2;
            for (int i = 2; i * i <= Math.Min(nume, deno); i++ )
            {
                if (nume % i == 0 && deno % i == 0)
                {
                    nume /= i;
                    deno /= i;
                }
            }
            Console.WriteLine("{0}/{1}", nume, deno);
        }
    }
}

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

namespace ProgrammingContest.Codeforces.Round13
{
    class A
    {
        public static void Main()
        {
            string s = Console.ReadLine();
            int n = int.Parse(s);
            int sum = 0;
            for (int i = 2; i < n; i++)
            {
                for (int x = n; x != 0; x /= i)
                {
                    sum += x % i;
                }
            }
            int nume = sum;
            int deno = n-2;
            for (int i = 2; i <= Math.Min(nume, deno); i++ )
            {
                if (nume % i == 0 && deno % i == 0)
                {
                    nume /= i;
                    deno /= i;
                }
            }
            Console.WriteLine("{0}/{1}", nume, deno);
        }
    }
}

using System;

public class Program
{
	public static void Main()
	{
		int n,total =0;
		n = Convert.ToInt32(Console.ReadLine());
		for(int i=2;i<=(n-1);i++)
		{
			int nilai=n;
			while(nilai !=0)
			{
				total += nilai%i;
				nilai = nilai/i;
			}
		}
		Console.WriteLine("{0}/{1}", total,(n-2));
	}
}

using System;

public class Program
{
	public static void Main()
	{
		int n,total =0;
		n = Convert.ToInt32(Console.ReadLine());
		for(int i=2;i<=(n-1);i++)
		{
			int nilai=n;
			while(nilai !=0)
			{
				total += nilai%i;
				nilai = nilai/i;
			}
		}
		if(total%2 == 0 && (n-2)%2 == 0)
			Console.WriteLine("{0}/{1}", total/2,(n-2)/2);
		else
			Console.WriteLine("{0}/{1}", total,(n-2));
	}
}

using System;

public class Program
{
	public static void Main()
	{
		int n,total =0;
		n = Convert.ToInt32(Console.ReadLine());
		for(int i=2;i<=(n-1);i++)
		{
			int nilai=n;
			while(nilai !=0)
			{
				total += nilai%i;
				nilai = nilai/i;
			}
		}
		int temp = n-2;
		while(total%2 == 0 && temp%2 == 0)
		{
			total /= 2;
			temp /=2;
		}
		Console.WriteLine("{0}/{1}", total,temp);
	}
}

/*******************************************************************************
* Author: Nirushuu
*******************************************************************************/

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

/*******************************************************************************
* IO from Kattio.cs from open.kattis.com/help/csharp                          */
public class NoMoreTokensException : Exception
{
}

public class Tokenizer
{
    string[] tokens = new string[0];
    private int pos;
    StreamReader reader;

    public Tokenizer(Stream inStream)
    {
        var bs = new BufferedStream(inStream);
        reader = new StreamReader(bs);
    }

    public Tokenizer() : this(Console.OpenStandardInput())
    {
        // Nothing more to do
    }

    private string PeekNext()
    {
        if (pos < 0)
            // pos < 0 indicates that there are no more tokens
            return null;
        if (pos < tokens.Length)
        {
            if (tokens[pos].Length == 0)
            {
                ++pos;
                return PeekNext();
            }
            return tokens[pos];
        }
        string line = reader.ReadLine();
        if (line == null)
        {
            // There is no more data to read
            pos = -1;
            return null;
        }
        // Split the line that was read on white space characters
        tokens = line.Split(null);
        pos = 0;
        return PeekNext();
    }

    public bool HasNext()
    {
        return (PeekNext() != null);
    }

    public string Next()
    {
        string next = PeekNext();
        if (next == null)
            throw new NoMoreTokensException();
        ++pos;
        return next;
    }
}

public class Scanner : Tokenizer
{

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

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

    public float NextFloat()
    {
        return float.Parse(Next());
    }

    public double NextDouble()
    {
        return double.Parse(Next());
    }
}

public class BufferedStdoutWriter : StreamWriter
{
    public BufferedStdoutWriter() : base(new BufferedStream(Console.OpenStandardOutput()))
    {
    }
}
/******************************************************************************/

/*******************************************************************************
* DisjointSet datastructure                                                   */
public struct DisjointSet {
    public int[] parent;
    public int[] rank;
    public DisjointSet(int n) {
        parent = new int[n];
        for (int i = 0; i < n; ++i) {
            parent[i] = i;
        }
        rank = new int[n];
    }

    public int Find(int i) {
        int idx = i;
        var compress = new List<int>();
        while (idx != parent[idx]) {
            compress.Add(idx);
            idx = parent[idx];
        }

        foreach (var e in compress) {   // path compress
            parent[e] = idx;
        }
        return idx;
    }

    public void Union(int a, int b) {
        int aPar = this.Find(a);
        int bPar = this.Find(b);

        if (rank[aPar] > rank[bPar]) {  // by rank
            parent[bPar] = aPar;
        } else {
            parent[aPar] = bPar;
        }
        if (rank[aPar] == rank[bPar]) {
            ++rank[bPar];
        }
    }
}

class MaxHeap {
    List<int> data;

    public MaxHeap() {
        data = new List<int>();
    }

    public void Add(int a) {
        data.Add(a);
        int idx = data.Count - 1;
        int parent = (int) Math.Floor((double) (idx - 1) / 2);
        while (idx != 0 && (data[idx] > data[parent])) {
            int tmp = data[parent];
            data[parent] = data[idx];
            data[idx] = tmp;

            idx = parent;
            parent = (int) Math.Floor((double) (idx - 1) / 2);
        }
    }

    public int Pop() {
        int res = data[0];
        data[0] = data[data.Count - 1];
        data.RemoveAt(data.Count - 1);

        int idx = 0;
        while (true) {
            int child1 = (2 * idx) + 1;
            int child2 = (2 * idx) + 2;

            if (child1 >= data.Count) { // no children
                break;
            } else if (child2 >= data.Count) {  // one child
                if (data[idx] < data[child1]) {
                    int tmp = data[idx];
                    data[idx] = data[child1];
                    data[child1] = tmp;
                }
                break;
            } else {    // two children
                int maxChild = data[child1] > data[child2] ? child1 : child2;
                if (data[idx] < data[maxChild]) {
                    int tmp = data[idx];
                    data[idx] = data[maxChild];
                    data[maxChild] = tmp;
                    idx = maxChild;
                    continue;
                } else {    // no swap
                    break;
                }
            }
        }

        return res;
    }

}

class Dequeue {
    public Dictionary<int, int> data = new Dictionary<int, int>();
    int firstIdx;
    public int Count;
    public Dequeue() {
        data = new Dictionary<int, int>();
        firstIdx = 1;
        Count = 0;
    }

    public void PushFront(int a) {
        data[firstIdx - 1] = a;
        ++Count;
        --firstIdx;
    }

    public void PushBack(int a) {
        data[firstIdx + Count] = a;
        ++Count;
    }

    public int PopFront() {
        --Count;
        ++firstIdx;
        return data[firstIdx - 1];
    }

    public int PopBack() {
        --Count;
        return data[firstIdx + Count];
    }

    public int Get(int n) {
        return data[firstIdx + n];
    }
}
/******************************************************************************/

class MainClass {

    // Debug functions
    static void debug<T>(IEnumerable<T> a, string s = "") {
        Console.WriteLine($"name: {s}");
        int i = 0;
        foreach (var e in a) {
            Console.WriteLine($"value {i}: {e}");
            ++i;
        }
    }
    static void dbg<T>(T a, string s = "") {
        Console.WriteLine($"name: {s} value: {a}");
    }
    ////////////////////

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

    static bool between(int a, int b, int c) {
        return (a >= b && a <= c);
    }

    static int findIn(string s, string a) {
        for (int i = 0; i < s.Length - (a.Length - 1); ++i) {
            bool found = true;
            for (int j = 0; j < a.Length; ++j) {
                if (s[i + j] != a[j]) {
                    found = false;
                    break;
                }
            }

            if (found) {
                return i;
            }
        }

        return -1;
    }

    static double dist(double a, double b, double c, double d) {
        return Math.Sqrt(Math.Pow((a - c), 2) + Math.Pow((b - d), 2));
    }

    public static void Main() {

        var sc = new Scanner();
        var wr = new BufferedStdoutWriter();
        var dot = new NumberFormatInfo();
        dot.NumberDecimalSeparator = ".";

        var a = sc.NextInt();

        // 11
        // var sums = new List<int>();
        int sum = 0;
        for (int i = 2; i < a; ++i) {
            int n = a;
            var digits = new List<int>();
            for (int j = 11; j >= 0; --j) {
                sum += n / (int)Math.Pow(i, j);
                n %= (int)Math.Pow(i, j);
            }

            // int sum = 0;
            // foreach (var e in digits) {
            //     sum += e;
            // }
            // sums.Add(sum);
        }

        // int sum = 0;
        // foreach (var e in sums) {
        //     sum += e;
        // }

        int numerator = sum;
        int denominator = a - 2;

        for (int i = 2; i <= denominator; ++i) {
            if (numerator % i == 0 && denominator % i == 0) {
                numerator /= i;
                denominator /= i;
            }
        }

        wr.Write($"{numerator}/{denominator}");

        wr.Flush();

    }
}

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

namespace CodeforcesCs
{
    class Program
    {
        static void Main(string[] args)
        {
            long a = long.Parse(Console.ReadLine());
            long sum = 0;
            for (long i = 2; i < a; i++)
            {
                long[] bytes = getBytes(a, i);
                long curSum = bytes.Sum();
                sum += curSum;
            }

            long d = gcd(sum, a - 2);
            sum /= d;
            Console.WriteLine("{0}/{1}", sum, a - 2);
        }

        private static long[] getBytes(long num, long radix)
        {
            List<long> bytes = new List<long>();
            while (num >= radix)
            {
                bytes.Add(num % radix);
                num /= radix;
            }
            bytes.Add(num);
            bytes.Reverse();
            return bytes.ToArray();
        }

        private static long gcd(long a, long b)
        {
            long x, y = a, z = b;
            do
            {
                x = y;
                y = z;
                z = x % y;
            } while (z != 0);
            return y;
        }
    }
}

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

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

            int sum = 0;
            int tempnum = num;

            for (int i = 2; i < num; i++)
            {
                tempnum = num;
                while (tempnum > 0)
                {
                    sum += tempnum % i;
                    tempnum /= i;
                }
            }

            Console.WriteLine(sum + "/" + (num - 2).ToString());

            // Console.WriteLine(sum + "/" + (num - 2).ToString());
            //Console.WriteLine(FindSumOfDigits(5));

           // StreamReader f1 = new StreamReader("C-small-practice.in");
         //   string line = f1.ReadLine();

         //   FileStream f2 = new FileStream("Output.txt",FileMode.Open);
         //   byte[] bytes = Encoding.ASCII.GetBytes("Hello");
         //   f2.Write(bytes, 0, bytes.Length);

        }
    }
}

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

namespace code_25
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int sum = 0;
            for (int i = 2; i < a ; i++)
            {
                int k = a;
                while (k >= i)
                {
                    int z = k / i;
                    sum += k - i * z;
                    k = k / i;
                }
                sum += k;

            }
            Console.WriteLine(sum+"/"+(a-2));
        }
    }
}

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

namespace code_25
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int sum = 0;
            int k;
            for (int i = 2; i < a ; i++)
            {
                k = a;
                while (k >= i)
                {
                    int z = k / i;
                    sum += k - i * z;
                    k = k / i;
                }
                sum += k;
            }
            k=a-2;
            for (int i = 2; i < a - 2;i++ )
                if (sum % i == 0 && k % i == 0)
                {
                    sum /= i;
                    k /= i;
                }
                Console.WriteLine(sum + "/" + k);
        }
    }
}

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

namespace code_25
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int sum = 0;
            for (int i = 2; i < a-1 ; i++)
            {
                int k = a;
                while (k >= i)
                {
                    int z = k / i;
                    sum += k - i * z;
                    k = k / i;
                }
                sum += k;

            }
            sum+=2;
            Console.WriteLine(sum+"/"+(a-2));
        }
    }
}

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

namespace ConsoleApplication1
{
    class Program
    {

        static void Main(string[] args)
        {

            string s = Console.ReadLine();
            int A = Convert.ToInt32(s);
            int buf;
            int sum = 0;
            int ct=0;
            for(int i=2;i<=A-1;i++)
            {
                buf=A;
                while(buf>0)
                {
                    sum+=buf%i;

                    buf = buf / i;

                }
            }
            ct = A - 1 - 2+1;

            for(int i=1;i<=1000000;i++)
            {
                if(sum%i==0 && ct%i==0)
                {
                    sum/=i;
                    ct/=i;
                }
            }
            Console.Write(sum);
            Console.Write("/");
            Console.WriteLine(ct);

        }

    }
}

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

namespace ConsoleApplication5
{
    class Program
    {

        static int NOD(int a, int b)
        {
            while (a > 0 && b > 0)
            {
                if (a > b)
                    a = a % b;
                else
                    b = b % a;
            }
            return a + b;
        }

        static void Main()
        {
            int a = int.Parse(Console.ReadLine());
            int summa = 0;
            int ostatok = 0;

            for (int i = 2; i < a; i++)
            {

                int b = a;
                while (b > 0)
                {
                    ostatok = b % i;
                    b = b / i;
                    summa = summa + ostatok;
                }
            }

            int count = a - 2;
            int nod = NOD(summa, count);
            while (summa / nod == 0 && count / nod == 0)
            {
                summa = summa / nod;
                count = count / nod;
                nod = NOD(summa, count);
            }

            Console.WriteLine(summa + "/" + count);

        }
    }
}

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
           int a = int.Parse(Console.ReadLine());
           int summa = 0;
           for (int i = 2; i < a; i++)
           {
               int s = a;
               while (s >= i)
               {
                   summa += s % i;
                   s = s / i;
                   if (s < i)
                   {
                       summa += s;
                   }
               }
           }
           int num = a - 2;
           for (int i = a - 2; i > 0; i--)
           {
               if (summa % i == 0 && (a - 2) % i == 0)
               {
                   summa = summa / i;
                   num = num / i;
               }
           }
           Console.WriteLine(summa.ToString() + "/" + num.ToString());
           Console.ReadLine();
        }
    }
}

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
           int a = int.Parse(Console.ReadLine());
           int summa = 0;
           for (int i = 2; i < a; i++)
           {
               int s = a;
               while (s >= i)
               {
                   summa += s % i;
                   s = s / i;
                   if (s < i)
                   {
                       summa += s;
                   }
               }
           }
           Console.WriteLine(summa.ToString() + "/" + (a - 2).ToString());
           Console.ReadLine();
        }
    }
}

using System;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
           int a = int.Parse(Console.ReadLine());
           int summa = 0;
           string result = "";
           for (int i = 2; i < a; i++)
           {
               int s = a;
               result += i.ToString() + ": ";
               while (s >= i)
               {
                   summa += s % i;
                   result += s % i;
                   s = s / i;
                   if (s < i)
                   {
                       summa += s;
                       result += s.ToString();
                   }
               }
               if (i < a - 1)
                   result += ", ";
           }
           int num = a - 2;
           for (int i = summa; i > 0; i--)
           {
               if (summa % i == 0 && num % i == 0)
               {
                   summa /= i;
                   num /=  i;
               }
           }
           Console.WriteLine(result);
           Console.WriteLine(summa.ToString() + "/" + num.ToString());
           Console.ReadLine();
        }
    }
}

using System;
// you can also use other imports, for example:
using System.Collections.Generic;
using System.Linq;

// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");

//mcs HelloWorld.cs
//mono HelloWorld.exe
public class HelloWorld {

	public static void Main(string[] args)
	{
		var line  = Console.ReadLine();
		var n = Convert.ToInt32(line);
		//var arr = Array.ConvertAll(Console.ReadLine().Split(' '), t=> Convert.ToInt32(t));
		solve(n);
		//tests();
	}

	public static void tests()
	{
		// solve(30, 5, 20, 20, 3, 5);
		// solve(10, 4, 100, 5, 5, 1);
		// solve(0, 7, 30, 50, 3, 4);
		// solve(40, 1, 40, 5, 11, 2);
		// solve(64, 12, 258, 141, 10, 7);
		// solve(64, 12, 141, 258, 7, 10);
		// solve(50,34);
		// solve(387420489,225159023);
		// solve(5,5);

	}

	public static void solve(int n)
	{
		var sum = 0;
		for (var i = 2; i < n; i++)
		{
			sum += GetSumOfDigis(n,i);
		}
		var lb = n - 2;
		if (sum % lb == 0)
		{
			Console.WriteLine($"{sum / lb} / {1}");
			return;
		}

		for (var i = 2; i < lb / 2; i++)
		{
			if (sum % i == 0 && lb % i == 0)
			{
				sum = sum / i;
				lb = lb / i;
			}
		}
		Console.WriteLine($"{sum} / {lb}");
	}

 	public static int GetSumOfDigis(int n, int b)
	{
		var sum = 0;
		while(n != 0)
		{
			sum += n % b;
			n = n / b;
		}
		return sum;
	}
}

using System;
// you can also use other imports, for example:
using System.Collections.Generic;
using System.Linq;

// you can write to stdout for debugging purposes, e.g.
// Console.WriteLine("this is a debug message");

//mcs HelloWorld.cs
//mono HelloWorld.exe
public class HelloWorld {

	public static void Main(string[] args)
	{
		var line  = Console.ReadLine();
		var n = Convert.ToInt32(line);
		//var arr = Array.ConvertAll(Console.ReadLine().Split(' '), t=> Convert.ToInt32(t));
		solve(n);
		//tests();
	}

	public static void tests()
	{
		// solve(30, 5, 20, 20, 3, 5);
		// solve(10, 4, 100, 5, 5, 1);
		// solve(0, 7, 30, 50, 3, 4);
		// solve(40, 1, 40, 5, 11, 2);
		// solve(64, 12, 258, 141, 10, 7);
		// solve(64, 12, 141, 258, 7, 10);
		// solve(50,34);
		// solve(387420489,225159023);
		// solve(5,5);

	}

	public static void solve(int n)
	{
		var sum = 0;
		for (var i = 2; i < n; i++)
		{
			sum += GetSumOfDigis(n,i);
		}
		var lb = n - 2;
		if (sum % lb == 0)
		{
			Console.WriteLine($"{sum / lb}/{1}");
			return;
		}

		for (var i = 2; i < lb / 2; i++)
		{
			if (sum % i == 0 && lb % i == 0)
			{
				sum = sum / i;
				lb = lb / i;
			}
		}
		Console.WriteLine($"{sum}/{lb}");
	}

 	public static int GetSumOfDigis(int n, int b)
	{
		var sum = 0;
		while(n != 0)
		{
			sum += n % b;
			n = n / b;
		}
		return sum;
	}
}

using System;

namespace Codeforces
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			int i, j = 2;
			double res, result, numerator, denominator, total = 0;

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

			i = input;
			double num = Convert.ToDouble (input - 2);

			while (j != Convert.ToInt32 (input)) {
				i -= 1;
				res = input;
				result = 1;
				while (result != 0) {
					result = Math.Floor (Convert.ToDouble (res) / Convert.ToDouble (i));
					if (result != 0) {
						total += res - result * i;
					} else if (res == i) {
						total += 1;
					} else {
						total += res;
					}
					res = Convert.ToDouble (result);
				}
				j += 1;
			}

			res = total;
			result = num;
			numerator = total;
			denominator = num;
			int[] array = new int[4] { 2, 3, 5, 7 };

			int amt = 0;
			while (amt <= 3) {
				res = numerator % array [amt];
				result = denominator % array [amt];
				if (res == 0 && result == 0) {
					numerator = numerator / array [amt];
					denominator = denominator / array [amt];
				} else {
					amt += 1;
				}
			}

			Console.WriteLine (numerator + "/" + denominator);
		}
	}
}

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

namespace task13A
{
    class Program
    {
        static int gcd(int a, int b)
        {
            if (b == 0)
                return a;
            else
                return gcd(b, a % b);
        }

        static short GetSumNumbers(string str)
        {
            short result = 0;
            for (Int32 i = 0; i < str.Length; i++)
            {
                result += (short)(str[i] - 48);
            }
            return result;
        }
        static Int32 GetSum(Int32 number, Int32 pos)
        {
            Int32 sum = 0;
            while (number > 0)
            {
                Int32 mod = number % pos;
                sum += GetSumNumbers(mod.ToString());
                number = number / pos;
            }
            return sum;
        }
        static void Main(string[] args)
        {
            Int32 dim = Int32.Parse(Console.ReadLine());
            Int32 sum = 0;
            for (Int32 i = 2; i < dim; i++)
            {
                sum += GetSum(dim, i);
            }
            Int32 temp = gcd(sum, dim - 2);
            Console.WriteLine("{0}/{1}", sum / temp, (dim - 2)/temp);
            //Console.ReadLine();
        }
    }
}

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

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

            int counter = 0;
            for (int i = 2; i < A; i++)
            {
                int helper = A;
                while (helper > 0)
                {
                    counter += helper % i;
                    helper /= i;
                }
            }

            int d = A - 2;
            Console.WriteLine(counter + "/" + d);
            //Console.WriteLine("{0}/{1}", counter / gcd(counter, d), d / gcd(counter, d));
        }
        private static int gcd(int a, int b)
        { return b == 0 ? a : gcd(b, a % b); }
    }
}