You are given a string s of length n consisting only of lowercase Latin letters.

A substring of a string is a contiguous subsequence of that string. So, string "forces" is substring of string "codeforces", but string "coder" is not.

Your task is to calculate the number of ways to remove exactly one substring from this string in such a way that all remaining characters are equal (the number of distinct characters either zero or one).

It is guaranteed that there is at least two different characters in s.

Note that you can remove the whole string and it is correct. Also note that you should remove at least one character.

Since the answer can be rather large (not very large though) print it modulo 998244353.

If you are Python programmer, consider using PyPy instead of Python when you submit your code.

Input

The first line of the input contains one integer n (2 ≤ n ≤ 2 ⋅ 10^5) — the length of the string s.

The second line of the input contains the string s of length n consisting only of lowercase Latin letters.

It is guaranteed that there is at least two different characters in s.

Output

Print one integer — the number of ways modulo 998244353 to remove exactly one substring from s in such way that all remaining characters are equal.

Examples

Input


4
abaa


Output


6


Input


7
aacdeee


Output


6

Input


2
az


Output


3

Note

Let s[l; r] be the substring of s from the position l to the position r inclusive.

Then in the first example you can remove the following substrings: 

  * s[1; 2]; 
  * s[1; 3]; 
  * s[1; 4]; 
  * s[2; 2]; 
  * s[2; 3]; 
  * s[2; 4]. 



In the second example you can remove the following substrings: 

  * s[1; 4]; 
  * s[1; 5]; 
  * s[1; 6]; 
  * s[1; 7]; 
  * s[2; 7]; 
  * s[3; 7]. 



In the third example you can remove the following substrings: 

  * s[1; 1]; 
  * s[1; 2]; 
  * s[2; 2]. 
import java.util.*;
import java.lang.*;
import java.io.*;
import java.math.BigDecimal;
public class test {
    public static void main (String[] args) throws java.lang.Exception {
        InputReader in = new InputReader(System.in);
        PrintWriter w = new PrintWriter(System.out);
        long ans = 1;
        int n = in.nextInt();
        char[] ca = in.next().toCharArray();
        int l = 1, r = n - 2;
        while (l < n && ca[l] == ca[l - 1])
            l++;
        while (r > -1 && ca[r] == ca[r + 1])
            r--;
        if (ca[0] != ca[n - 1]) {
            ans += l + (n - 1 - r);

        } else {
            if (l == n)
                ans =1L* ((n + 1) * (n)) / 2;
            else
                ans = 1L*(l + 1) * (n - r);
        }
        ans %= 998244353;
        w.println(ans);
        w.close();
    }
    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    static long lcm(long a, long b) {
        return a * b / gcd(a, b);
    }
    static boolean nextPermutation(int[] a) {
        int n = a.length;
        int ptr = n - 1;
        while (ptr > 0 && a[ptr - 1] >= a[ptr]) {
            ptr--;
        }

        for (int i = ptr, j = n - 1; i < j; i++, j--) {
            int tmp = a[i];
            a[i] = a[j];
            a[j] = tmp;
        }

        if (ptr == 0) {
            return false;
        }

        for (int i = ptr;; i++) {
            if (a[ptr - 1] < a[i]) {
                int tmp = a[ptr - 1];
                a[ptr - 1] = a[i];
                a[i] = tmp;
                return true;
            }
        }
    }
    static int fibo(int n) {
        if (n == 1 || n == 2)
            return 1;
        return fibo(n - 1) + fibo(n - 2);
    }
    /*static int fibo(int n) {
        if (n == 0)
            return 0;
        if (n == 1 || n == 2)
            return f[n] = 1;
        if (f[n] != 0)
            return f[n];
        if (n % 2 == 0) {
            int k = (n) / 2;
            return f[n] = (fibo(k - 1) * 2 + fibo(k)) * fibo(k);
        } else {
            int k = (n + 1) / 2;
            return f[n] = fibo(k - 1) * fibo(k - 1) + fibo(k) * fibo(k);
        }
    }*/
    static class Edge implements Comparable<Edge> {
        int from, to, cost;
        Edge(int from, int to, int cost) {
            this.from = from;
            this.to = to;
            this.cost = cost;
        }
        public int compareTo(Edge O) {
            return this.cost - O.cost;
        }
    }
    static String swap(String s, int i, int j) {
        char[] ca = s.toCharArray();
        char temp = ca[i];
        ca[i] = ca[j];
        ca[j] = temp;
        return new String(ca);
    }
    static void findMissExtra(int[] a) {
        HashSet<Integer> hs = new HashSet<>();
        int n = a.length, extra = 0, miss = 0;
        for (int i = 0; i < n; i++) {
            if (hs.contains(a[i]))
                extra = a[i];
            hs.add(a[i]);

        }
        for (int i = 1; i <= n; i++) {
            if (!hs.contains(i)) {
                miss = i;
                break;
            }
        }
        System.out.println(miss + ", " + extra);
    }
    static void find(int m, int s) {
        if (s == 0 || s > m * 9) {
            System.out.println("Impossible");
            return ;
        }
        s -= 1;
        int[] num = new int[m];
        for (int i = m - 1; i > 0; i--) {
            int temp = Math.min(s, 9);
            num[i] = temp;
            s -= temp;
        }
        num[0] += s + 1;
        for (int x : num)
            System.out.print(x);
    }
    static class InputReader {
        private InputStream stream;
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public InputReader(InputStream stream) {
            this.stream = stream;
        }

        public int read() {
            if (numChars == -1)
                throw new UnknownError();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    throw new UnknownError();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public int peek() {
            if (numChars == -1)
                return -1;
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = stream.read(buf);
                } catch (IOException e) {
                    return -1;
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar];
        }

        public void skip(int x) {
            while (x-- > 0)
                read();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public String nextString() {
            return next();
        }

        public String next() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuffer res = new StringBuffer();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));

            return res.toString();
        }

        public String nextLine() {
            StringBuffer buf = new StringBuffer();
            int c = read();
            while (c != '\n' && c != -1) {
                if (c != '\r')
                    buf.appendCodePoint(c);
                c = read();
            }
            return buf.toString();
        }

        public double nextDouble() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            double res = 0;
            while (!isSpaceChar(c) && c != '.') {
                if (c == 'e' || c == 'E')
                    return res * Math.pow(10, nextInt());
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            }
            if (c == '.') {
                c = read();
                double m = 1;
                while (!isSpaceChar(c)) {
                    if (c == 'e' || c == 'E')
                        return res * Math.pow(10, nextInt());
                    if (c < '0' || c > '9')
                        throw new InputMismatchException();
                    m /= 10;
                    res += (c - '0') * m;
                    c = read();
                }
            }
            return res * sgn;
        }
        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }
        public long[] nextLongArray(int n) {
            long[] a = new long[n];
            for (int i = 0; i < n; i++)
                a[i] = nextLong();
            return a;
        }
        public boolean hasNext() {
            int value;
            while (isSpaceChar(value = peek()) && value != -1)
                read();
            return value != -1;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

    }
}