public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         try
         {
             int F = fs.NextInt(), I = fs.NextInt(), T = fs.NextInt();
             int[] likes = new int[I];
             if (F <= 10 && F >= 1 && I <= 10 && I >= 1 && T <= F && T >= 1)
             {
                 for (int i = 0; i < F; i++)
                 {
                     string str = fs.ReadLine();
                     if (str.Length != I)
                     {
                         writer.WriteLine(0);
                         return;
                     }
                     for (int j = 0; j < I; j++)
                     {
                         if (str[j] == 'Y') likes[j]++;
                         else if (str[j] != 'Y' && str[j] != 'N')
                         {
                             writer.WriteLine(0);
                             return;
                         }
                     }
                 }
                 if (!String.IsNullOrEmpty(fs.ReadLine()))
                 {
                     writer.WriteLine(0);
                     return;
                 }
                 int ans = 0;
                 for (int i = 0; i < I; i++)
                 {
                     if (likes[i] >= T) ans++;
                 }
                 writer.WriteLine(ans);
             }
             else writer.WriteLine(0);
         }
         catch (Exception e)
         {
             writer.WriteLine(0);
             return;
         }
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         n = fs.NextInt();
         m = fs.NextInt();
         char[,] a = new char[n, m];
         int[][,] dist = new int[4][,];
         for (int i = 0; i < 4; i++)
         {
             dist[i] = new int[n, m];
         }
         for (int i = 0; i < n; i++)
         {
             string line = fs.ReadLine();
             for (int j = 0; j < m; j++)
             {
                 a[i, j] = line[j];
                 for (int k = 0; k < 4; k++)
                 {
                     dist[k][i, j] = int.MaxValue;
                 }
             }
         }
         int xt = fs.NextInt() - 1, yt = fs.NextInt() - 1;
         int xm = fs.NextInt() - 1, ym = fs.NextInt() - 1;
         RunBFS(a, dist, xt, yt);
         int ans = Math.Min(dist[0][xm, ym], Math.Min(dist[1][xm, ym], Math.Min(dist[2][xm, ym], dist[3][xm, ym])));
         writer.WriteLine(ans == int.MaxValue ? -1 : ans);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         int[] rows = new int[n], cols = new int[n];
         for (int i = 0; i < n; i++)
         {
             string s = fs.ReadLine();
             for (int j = 0; j < n; j++)
             {
                 if (s[j] == 'C')
                 {
                     rows[i]++;
                     cols[j]++;
                 }
             }
         }
         long ans = 0;
         for (int i = 0; i < n; i++)
         {
             ans += (rows[i] * (rows[i] - 1)) / 2;
             ans += (cols[i] * (cols[i] - 1)) / 2;
         }
         writer.WriteLine(ans);
     }
 }
        public static void Run()
        {
            using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
            using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
            {
                map = new Dictionary<char, int>();
                int val = 0;
                for (char c = '0'; c <= '9'; c++) map.Add(c, val++);
                for (char c = 'A'; c <= 'Z'; c++) map.Add(c, val++);
                for (char c = 'a'; c <= 'z'; c++) map.Add(c, val++);
                map.Add('-', val++);
                map.Add('_', val++);

                string s = fs.ReadLine();
                long ans = 1;
                foreach (char c in s)
                {
                    string bin = Convert.ToString(map[c], 2);
                    for (int i = bin.Length + 1; i <= 6; i++)
                    {
                        ans = (ans * 3) % 1000000007;
                    }
                    foreach (char b in bin)
                    {
                        if (b == '0') ans = (ans * 3) % 1000000007;
                    }
                }
                writer.WriteLine(ans);
            }
        }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt(), m = fs.NextInt();
         Player[] p = new Player[n];
         string[] ans = Enumerable.Repeat("", m).ToArray();
         for (int i = 0; i < n; i++)
         {
             string[] s = fs.ReadLine().Split();
             p[i] = new Player { Name = s[0], Region = Convert.ToInt32(s[1]) - 1, Score = Convert.ToInt32(s[2]) };
         }
         p = p.OrderBy(x => x.Region).ThenByDescending(x => x.Score).ToArray();
         int j = 0, lastRegion = -1;
         for (int i = 0; i < n; i++)
         {
             if (p[i].Region != lastRegion)
             {
                 j = 0;
                 lastRegion = p[i].Region;
             }
             if (j == 0) ans[p[i].Region] += p[i].Name + " ";
             else if (j == 1) ans[p[i].Region] += p[i].Name;
             else if (j == 2 && p[i].Score == p[i - 1].Score) ans[p[i].Region] = "?";
             j++;
         }
         for (int i = 0; i < m; i++)
         {
             writer.WriteLine(ans[i]);
         }
     }
 }
        public static void Run()
        {
            using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
            using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
            {
                int n = fs.NextInt();
                int[] a = new int[n];
                List<int[]> d = new List<int[]>();
                string s = fs.ReadLine();
                for (int i = 0; i < n; i++)
                {
                    a[i] = int.Parse("" + s[i]);
                    if (i > 0) d.Add(GetDiff(a[i - 1], a[i]));
                }

                for (int i = 0; i < 4; i++)
                {
                    for (int j = 0; j < 3; j++)
                    {
                        if (digits[i, j] == a[0]) continue;
                        if (digits[i, j] != -1 && IsValid(i, j, d))
                        {
                            writer.WriteLine("NO");
                            return;
                        }
                    }
                }
                writer.WriteLine("YES");
            }
        }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         int[] male = new int[367], fem = new int[367];
         for (int i = 0; i < n; i++)
         {
             string[] line = fs.ReadLine().Split(' ');
             if (line[0] == "M")
             {
                 int l = Convert.ToInt32(line[1]), r = Convert.ToInt32(line[2]);
                 for (int j = l; j <= r; j++) male[j]++;
             }
             else if (line[0] == "F")
             {
                 int l = Convert.ToInt32(line[1]), r = Convert.ToInt32(line[2]);
                 for (int j = l; j <= r; j++) fem[j]++;
             }
         }
         int ans = 0;
         for (int i = 1; i < 367; i++)
         {
             ans = Math.Max(ans, Math.Min(male[i], fem[i]) * 2);
         }
         writer.WriteLine(ans);
     }
 }
        public static void Run()
        {
            using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
            using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
            {
                string[] exp = fs.ReadLine().Split('e');
                string[] num = exp[0].Split('.');

                int b = int.Parse(exp[1]);
                StringBuilder sb = new StringBuilder(200);
                sb.Append(num[0]);
                int i = 0;
                for (i = 0; i < b; i++)
                {
                    if (i >= num[1].Length) sb.Append("0");
                    else sb.Append(num[1][i]);
                }
                if (b < num[1].Length && num[1] != "0")
                {
                    sb.Append(".");
                    for (; i < num[1].Length; i++)
                    {
                        sb.Append(num[1][i]);
                    }
                }
                writer.WriteLine(sb);
            }
        }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         long x = fs.NextInt();
         int sad = 0;
         for (int i = 0; i < n; i++)
         {
             string[] line = fs.ReadLine().Split();
             if (line[0] == "+")
             {
                 x += Convert.ToInt32(line[1]);
             }
             else
             {
                 int d = Convert.ToInt32(line[1]);
                 if (x < d) sad++;
                 else x -= d;
             }
         }
         writer.WriteLine(x + " " + sad);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt(), k = fs.NextInt();
         long[] c = Array.ConvertAll(fs.ReadLine().Split(), Convert.ToInt64);
         bool[] isCap = new bool[n];
         long sum = c.Sum(), res = 0, caps = 0;
         for (int i = 0; i < k; i++)
         {
             int ind = fs.NextInt() - 1;
             isCap[ind] = true;
             caps += c[ind];
         }
         for (int i = 0; i < n; i++)
         {
             int l = i - 1, r = (i + 1) % n;
             if (l < 0) l = n - 1;
             if (isCap[i]) res += c[i] * (sum - c[i]);
             else
             {
                 res += c[i] * caps;
                 if (!isCap[l]) res += c[i] * c[l];
                 if (!isCap[r]) res += c[i] * c[r];
             }
         }
         writer.WriteLine(res / 2);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int t = fs.NextInt();
         Dictionary<string, int> count = new Dictionary<string, int>();
         while (t-- > 0)
         {
             string[] cmd = fs.ReadLine().Split();
             if (cmd[0] == "+")
             {
                 long a = Convert.ToInt64(cmd[1]);
                 string pattern = NumToPattern(a);
                 if (!count.ContainsKey(pattern)) count.Add(pattern, 0);
                 count[pattern]++;
             }
             else if (cmd[0] == "-")
             {
                 long a = Convert.ToInt64(cmd[1]);
                 string pattern = NumToPattern(a);
                 count[pattern]--;
             }
             else
             {
                 string pattern = AppendZeros(cmd[1]);
                 writer.WriteLine(count.ContainsKey(pattern) ? count[pattern] : 0);
             }
         }
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         string str = fs.ReadLine();
         List<int> list = new List<int>(str.Length);
         int first = -1;
         for (int i = 0; i < str.Length; i++)
         {
             if (str[i] == 'F')
             {
                 if (first == -1 && list.Count != i)
                 {
                     first = list.Count;
                 }
                 list.Add(i);
             }
         }
         if (list.Count == 0 || list.Count == str.Length || first == -1)
         {
             writer.WriteLine(0);
             return;
         }
         int t = 0;
         for (int i = first + 1; i < list.Count; i++)
         {
             t = Math.Max(0, t - list[i] + list[i - 1] + 2);
         }
         writer.WriteLine(t + list.Last() - list.Count + 1);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         int[] c = Array.ConvertAll(fs.ReadLine().Split(), Convert.ToInt32);
         string[] s = new string[n];
         for (int i = 0; i < n; i++)
         {
             s[i] = fs.ReadLine();
         }
         int vk = 2 * n + 2;
         LinkedList<Edge>[] adjList = new LinkedList<Edge>[vk];
         for (int i = 0; i < vk; i++)
         {
             adjList[i] = new LinkedList<Edge>();
         }
         adjList[0].AddLast(new Edge { To = 1, W = 0 });
         adjList[0].AddLast(new Edge { To = n + 1, W = c[0] });
         for (int i = 0; i < n - 1; i++)
         {
             string rev1 = Reverse(s[i]), rev2 = Reverse(s[i + 1]);
             if (IsLess(s[i], s[i + 1]))
             {
                 adjList[i + 1].AddLast(new Edge { To = i + 2, W = 0 });
             }
             if (IsLess(s[i], rev2))
             {
                 adjList[i + 1].AddLast(new Edge { To = n + i + 2, W = c[i + 1] });
             }
             if (IsLess(rev1, s[i + 1]))
             {
                 adjList[n + i + 1].AddLast(new Edge { To = i + 2, W = 0 });
             }
             if (IsLess(rev1, rev2))
             {
                 adjList[n + i + 1].AddLast(new Edge { To = n + i + 2, W = c[i + 1] });
             }
         }
         adjList[n].AddLast(new Edge { To = vk - 1, W = 0 });
         adjList[vk - 2].AddLast(new Edge { To = vk - 1, W = 0 });
         long[] dist = Enumerable.Repeat(long.MaxValue, vk).ToArray();
         RunDijkstra(adjList, dist);
         writer.WriteLine(dist[vk - 1] != long.MaxValue ? dist[vk - 1] : -1);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         MinHeap<int, int> heap = new MinHeap<int, int>();
         List<string> list = new List<string>(2 * n);
         for (int i = 0; i < n; i++)
         {
             string line = fs.ReadLine();
             string[] tokens = line.Split();
             string cmd = tokens[0];
             if (cmd == "insert") {
                 int x = Convert.ToInt32(tokens[1]);
                 heap.Insert(x, x);
             }
             else if (cmd == "getMin") {
                 int x = Convert.ToInt32(tokens[1]);
                 if (heap.Count > 0)
                 {
                     int min = heap.GetMin().Value;
                     while (min < x)
                     {
                         heap.ExtractMin();
                         list.Add("removeMin");
                         if (heap.Count == 0) break;
                         else min = heap.GetMin().Value;
                     }
                     if (heap.Count == 0 || min > x)
                     {
                         heap.Insert(x, x);
                         list.Add("insert " + x);
                     }
                 }
                 else
                 {
                     heap.Insert(x, x);
                     list.Add("insert " + x);
                 }
             }
             else {
                 if (heap.Count > 0) heap.ExtractMin();
                 else list.Add("insert 1");
             }
             list.Add(line);
         }
         writer.WriteLine(list.Count);
         foreach (string line in list)
         {
             writer.WriteLine(line);
         }
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt(), k = fs.NextInt();
         string s = fs.ReadLine();
         int max = Solve(s, n, k, 'a');
         max = Math.Max(Solve(s, n, k, 'b'), max);
         writer.WriteLine(max);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int q = fs.NextInt();
         Dictionary<int, int> count = new Dictionary<int, int>();
         count.Add(0, int.MaxValue);
         BinaryTrie trie = new BinaryTrie('0', '1');
         trie.Add(DecToPaddedBin(0));
         while (q-- > 0)
         {
             string[] toks = fs.ReadLine().Split();
             int x = Convert.ToInt32(toks[1]);
             if (toks[0] == "?")
             {
                 string path = DecToPaddedBin(x ^ int.MaxValue);
                 var current = trie.GetRoot();
                 StringBuilder sb = new StringBuilder();
                 for (int i = 0; i < path.Length; i++)
                 {
                     if (path[i] == '0' && current.Left != null || path[i] == '1' && current.Right == null)
                     {
                         current = current.Left;
                         sb.Append('0');
                     }
                     else if (path[i] == '1' && current.Right != null || path[i] == '0' && current.Left == null)
                     {
                         current = current.Right;
                         sb.Append('1');
                     }
                 }
                 int ans = PaddedBinToDec(sb.ToString());
                 writer.WriteLine(ans ^ x);
             }
             else
             {
                 if (toks[0] == "+")
                 {
                     if (!count.ContainsKey(x)) count.Add(x, 1);
                     else count[x]++;
                     if (count[x] == 1) trie.Add(DecToPaddedBin(x));
                 }
                 else if (toks[0] == "-")
                 { 
                     count[x]--;
                     if (count[x] == 0) trie.Remove(DecToPaddedBin(x));
                 }
             }
         }
     }
 }
        public static void Run()
        {
            using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
            using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
            {
                int n = fs.NextInt(), x = fs.NextInt();
                int mod = (int)1e9 + 7;
                long[] a = Array.ConvertAll(fs.ReadLine().Split(), Convert.ToInt64);

                long sum = a.Sum();
                SortedDictionary<long, int> count = new SortedDictionary<long, int>();
                for (int i = 0; i < n; i++)
                {
                    long pow = sum - a[i];
                    if (!count.ContainsKey(pow)) count[pow] = 0;
                    count[pow]++;
                }
                LinkedList<Frequency> freqs = new LinkedList<Frequency>();
                foreach (var pair in count)
                {
                    freqs.AddLast(new Frequency { Pow = pair.Key, Value = pair.Value });
                }
                long minPow = 0;
                while(freqs.Count > 0) 
                {
                    var node = freqs.First;
                    freqs.RemoveFirst();
                    var next = freqs.First;
                    long pow = node.Value.Pow;
                    int freq = node.Value.Value;
                    if (freq % x == 0)
                    {
                        if (next != null && next.Value.Pow == pow + 1)
                        {
                            next.Value.Value += freq / x;
                        }
                        else
                        {
                            freqs.AddFirst(new Frequency { Pow = pow + 1, Value = freq / x });
                        }
                    }
                    else
                    {
                        minPow = pow;
                        break;
                    }
                }
                writer.WriteLine(BinPowMod(x, Math.Min(minPow, sum), mod));
            }
        }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         int[] a = Array.ConvertAll(fs.ReadLine().Split(), Convert.ToInt32);
         int m = fs.NextInt();
         Query[] queries = new Query[m];
         for (int i = 0; i < m; i++)
         {
             queries[i] = new Query { Id = i, Left = fs.NextInt() - 1, Right = fs.NextInt() - 1};
         }
         queries = queries.OrderBy(q => q.Right).ToArray();
         int[] xor = new int[n];
         int[] answers = new int[m];
         xor[0] = a[0];
         for (int i = 1; i < n; i++)
         {
             xor[i] = xor[i - 1] ^ a[i];
         }
         Dictionary<int, int> lastPos = new Dictionary<int, int>();
         XorSegmentTreeFast distincts = new XorSegmentTreeFast(new int[n]);
         int r = -1;
         foreach (Query q in queries)
         {
             while (r < q.Right)
             {
                 r++;
                 if (lastPos.ContainsKey(a[r]))
                 {
                     distincts.Update(lastPos[a[r]], 0);
                     lastPos[a[r]] = r;
                 }
                 else
                 {
                     lastPos.Add(a[r], r);
                 }
                 distincts.Update(r, a[r]);
             }
             answers[q.Id] = q.Left > 0 ? xor[q.Right] ^ xor[q.Left - 1] : xor[q.Right];
             answers[q.Id] ^= distincts.QueryXor(q.Left, q.Right);
         }
         for (int i = 0; i < m; i++)
         {
             writer.WriteLine(answers[i]);
         }
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         _str = fs.ReadLine();
         solved = new bool[2, _str.Length];
         Find(_str.Length - 1, "");
         writer.WriteLine(_set.Count);
         foreach (string suffix in _set)
         {
             writer.WriteLine(suffix);
         }
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         string s = fs.ReadLine();
         StringBuilder sb = new StringBuilder(s.Length);
         sb.Append(s[0]);
         for (int i = 1; i < s.Length; i++)
         {
             if (sb[i - 1] == s[i]) sb.Append(FindAnother(s[i], i + 1 < s.Length ? s[i + 1] : '-'));
             else sb.Append(s[i]);
         }
         writer.WriteLine(sb);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         string s = fs.ReadLine(), r = new string(s.Reverse().ToArray());
         n = s.Length;
         hashS = new long[n];
         hashR = new long[n];
         pows = new long[n];
         hashS[0] = ToLong(s[0]);
         hashR[0] = ToLong(r[0]);
         pows[0] = 1;
         for (int i = 1; i < n; i++)
         {
             pows[i] = pows[i - 1] * p;
         }
         for (int i = 1; i < n; i++)
         {
             hashS[i] = hashS[i - 1] + ToLong(s[i]) * pows[i];
             hashR[i] = hashR[i - 1] + ToLong(r[i]) * pows[i];
         }
         int[] dp = new int[n];
         dp[0] = 1;
         if (n > 1) dp[1] = s[0] == s[1] ? 2 : 0;
         if (n > 2) dp[2] = s[0] == s[2] ? 2 : 0;
         for (int i = 3; i < n; i++)
         {
             int mid = i / 2;
             if (i % 2 == 0)
             {
                 if (IsPalindrome(0, mid - 1, mid + 1, i))
                 {
                     dp[i] = dp[mid - 1] + 1;
                 }
             }
             else
             {
                 if (IsPalindrome(0, mid, mid + 1, i))
                 {
                     dp[i] = dp[mid] + 1;
                 }
             }
         }
         writer.WriteLine(dp.Sum());
     }
 }
        public static void Run()
        {
            using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
            using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
            {
                string s = fs.ReadLine();
                int first = -1, point = -1;
                for (int i = 0; i < s.Length; i++)
                {
                    if (s[i] == '.')
                    {
                        point = i;
                        if (first != -1) break;
                    }
                    else if (first == -1 && s[i] != '0')
                    {
                        first = i;
                        if (point != -1) break;
                    }
                }
                if (first == -1)
                {
                    writer.WriteLine(0);
                    return;
                }
                if (point == -1) point = s.Length;

                int b = point - first;
                if (b > 0) b--;
                StringBuilder sb = new StringBuilder();
                for (int i = s.Length - 1; i >= first; i--)
                {
                    if (s[i] == '.') continue;
                    if (sb.Length == 0 && s[i] == '0') continue;
                    sb.Append(s[i]);
                }
                StringBuilder ans = new StringBuilder();
                for (int i = sb.Length - 1; i >= 0; i--)
                {
                    ans.Append(sb[i]);
                    if (i > 0 && i == sb.Length - 1) ans.Append(".");
                }
                if (b != 0) ans.Append("E").Append(b);
                writer.WriteLine(ans);
            }
        }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int[] primes = new int[] { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 4, 9, 25, 49 };
         int count = 0;
         for (int i = 0; i < primes.Length; i++)
         {
             writer.WriteLine(primes[i]);
             writer.Flush();
             count += fs.ReadLine() == "yes" ? 1 : 0;
         }
         writer.WriteLine(count <= 1 ? "prime" : "composite");
         writer.Flush();
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         string s = fs.ReadLine();
         int lc = 0, rc = 0, uc = 0, dc = 0;
         lc = s.Where(x => x == 'L').Count();
         rc = s.Where(x => x == 'R').Count();
         uc = s.Where(x => x == 'U').Count();
         dc = s.Where(x => x == 'D').Count();
         if (s.Length % 2 == 1)
         {
             writer.WriteLine(-1);
             return;
         }
         int ans = 0;
         if ((lc + rc) % 2 == 1)
         {
             if (lc > rc) lc--;
             else rc--;
             if (uc > dc) dc++;
             else uc++;
             ans++;
         }
         if (lc > rc)
         {
             ans += (lc - rc) / 2;
         }
         else if (lc < rc)
         {
             ans += (rc - lc) / 2;
         }
         if (uc > dc)
         {
             ans += (uc - dc) / 2;
         }
         else if (uc < dc)
         {
             ans += (dc - uc) / 2;
         }
         writer.WriteLine(ans);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int fa = fs.NextInt(), ta = fs.NextInt();
         int fb = fs.NextInt(), tb = fs.NextInt();
         string[] time = fs.ReadLine().Split(':');
         int dep = Convert.ToInt32(time[0]) * 60 + Convert.ToInt32(time[1]);
         int arr = dep + ta;
         int t = 300, z = 0;
         while (t < 1440)
         {
             if ((t >= dep && t < arr) || (t + tb > dep && t + tb <= arr) || (t < dep && t + tb > arr)) z++;
             t += fb;
         }
         writer.WriteLine(z);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt(), k = fs.NextInt(), totalSum = 0;
         string s = fs.ReadLine();
         int[] sum = new int[n];
         int[] sign = new int[n];
         for (int i = 0; i < n; i++)
         {
             sum[i] = (s[i] - 'a') <= 12 ? 'z' - s[i] : s[i] - 'a';
             sign[i] = (s[i] - 'a') <= 12 ? 1 : -1;
             totalSum += sum[i];
         }
         if (totalSum < k) writer.WriteLine(-1);
         else
         {
             StringBuilder sb = new StringBuilder();
             int j = 0;
             while (k > 0)
             {
                 if (k > sum[j])
                 {
                     k -= sum[j];
                     sb.Append((char)(s[j] + sign[j] * sum[j]));
                 }
                 else
                 {
                     sb.Append((char)(s[j] + sign[j] * k));
                     k = 0;
                 }
                 j++;
             }
             while (j < n)
             {
                 sb.Append(s[j++]);
             }
             writer.WriteLine(sb.ToString());
         }
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         string str = fs.ReadLine();
         int res = 0;
         for (int i = 1; i <= str.Length; i++)
         {
             char c = str[0];
             if (i < str.Length) c = str[i];
             bool and1 = '@' < c && '[' > c, and2 = '`' < c && '{' > c;
             int bi1 = and1 ? 1 : 0, bi2 = and2 ? 1 : 0;
             int times1 = bi1 * GetAlpha(c), times2 = bi2 * GetAlpha(c);
             int minus = times1 - times2;
             res = res + minus;
         }
         writer.WriteLine(res);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt(), cmd = 0;
         string s = fs.ReadLine();
         for (int i = 0; i < n - 1; i++)
         {
             int x = 0, y = 0;
             perform(ref x, ref y, s[i]);
             for (int j = i + 1; j < n; j++)
             {
                 perform(ref x, ref y, s[j]);
                 if (x == 0 && y == 0) cmd++;
             }
         }
         writer.WriteLine(cmd);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         string s = fs.ReadLine();
         long ans = 0;
         for (int i = 0; i < s.Length; i++)
         {
             int d = Convert.ToInt32("" + s[i]);
             if (i < s.Length - 1)
             {
                 int dd = Convert.ToInt32("" + s[i] + s[i + 1]);
                 if (dd % 4 == 0) ans += i + 1;
             }
             if (d % 4 == 0) ans++;
         }
         writer.WriteLine(ans);
     }
 }
 public static void Run()
 {
     using (FastScanner fs = new FastScanner(new BufferedStream(Console.OpenStandardInput())))
     using (StreamWriter writer = new StreamWriter(new BufferedStream(Console.OpenStandardOutput())))
     {
         int n = fs.NextInt();
         Request[] reqs = new Request[n];
         for (int i = 0; i < n; i++)
         {
             reqs[i] = new Request(fs.ReadLine());
         }
         reqs = reqs.OrderBy(r => r.Path).ToArray();
         Dictionary<string, Host> hostsByName = new Dictionary<string, Host>();
         Dictionary<string, LinkedList<Host>> hostsListByPaths = new Dictionary<string, LinkedList<Host>>();
         for (int i = 0; i < n; i++)
         {
             if (!hostsByName.ContainsKey(reqs[i].Hostname)) hostsByName.Add(reqs[i].Hostname, new Host(reqs[i].Hostname));
             hostsByName[reqs[i].Hostname].AddPath(reqs[i].Path);
         }
         int k = 0;
         foreach(KeyValuePair<string, Host> item in hostsByName)
         {
             string paths = item.Value.GetPaths();
             if (!hostsListByPaths.ContainsKey(paths)) hostsListByPaths.Add(paths, new LinkedList<Host>());
             hostsListByPaths[paths].AddLast(item.Value);
             if (hostsListByPaths[paths].Count == 2) k++;
         }
         writer.WriteLine(k);
         foreach (KeyValuePair<string, LinkedList<Host>> item in hostsListByPaths)
         {
             if (item.Value.Count > 1)
             {
                 foreach (Host host in item.Value)
                 {
                     writer.Write(host.Hostname + " ");
                 }
                 writer.WriteLine();
             }
         }
     }
 }