Problem: This is an easier version of the problem. In this version, n ≤ 500.

Vasya is an experienced developer of programming competitions' problems. As all great minds at some time, Vasya faced a creative crisis. To improve the situation, Petya gifted him a string consisting of opening and closing brackets only. Petya believes, that the beauty of the bracket string is a number of its cyclical shifts, which form a correct bracket sequence.

To digress from his problems, Vasya decided to select two positions of the string (not necessarily distinct) and swap characters located at this positions with each other. Vasya will apply this operation exactly once. He is curious what is the maximum possible beauty he can achieve this way. Please help him.

We remind that bracket sequence s is called correct if: 

  * s is empty; 
  * s is equal to "(t)", where t is correct bracket sequence; 
  * s is equal to t_1 t_2, i.e. concatenation of t_1 and t_2, where t_1 and t_2 are correct bracket sequences. 



For example, "(()())", "()" are correct, while ")(" and "())" are not.

The cyclical shift of the string s of length n by k (0 ≤ k < n) is a string formed by a concatenation of the last k symbols of the string s with the first n - k symbols of string s. For example, the cyclical shift of string "(())()" by 2 equals "()(())".

Cyclical shifts i and j are considered different, if i ≠ j.

Input

The first line contains an integer n (1 ≤ n ≤ 500), the length of the string.

The second line contains a string, consisting of exactly n characters, where each of the characters is either "(" or ")".

Output

The first line should contain a single integer — the largest beauty of the string, which can be achieved by swapping some two characters.

The second line should contain integers l and r (1 ≤ l, r ≤ n) — the indices of two characters, which should be swapped in order to maximize the string's beauty.

In case there are several possible swaps, print any of them.

Examples

Input


10
()()())(()


Output


5
8 7


Input


12
)(()(()())()


Output


4
5 10


Input


6
)))(()


Output


0
1 1

Note

In the first example, we can swap 7-th and 8-th character, obtaining a string "()()()()()". The cyclical shifts by 0, 2, 4, 6, 8 of this string form a correct bracket sequence.

In the second example, after swapping 5-th and 10-th character, we obtain a string ")(())()()(()". The cyclical shifts by 11, 7, 5, 3 of this string form a correct bracket sequence.

In the third example, swap of any two brackets results in 0 cyclical shifts being correct bracket sequences. 

Solution (in JAVA):

Solution:
/**
 * BaZ :D
 */
import java.util.*;
import java.io.*;
import static java.lang.Math.*;

public class Main
{
    static MyScanner scan;
    static PrintWriter pw;
    static long MOD = 1_000_000_007;
    static long INF = 1_000_000_000_000_000_000L;
    static long inf = 2_000_000_000;
    public static void main(String[] args) {
        new Thread(null, null, "BaZ", 1 << 27) {
            public void run() {
                try {
                    solve();
                } catch (Exception e) {
                    e.printStackTrace();
                    System.exit(1);
                }
            }
        }.start();
    }
    static int idx1, idx2;
    static char c[];
    static void solve() throws IOException
    {
        //initIo(true);
        initIo(false);
        StringBuilder sb = new StringBuilder();
        int n = ni();
        c = ne().toCharArray();
        int bal[] = new int[n];
        int open = 0;
        for(int i=0;i<n;++i) {
            if(c[i] == '(') {
                bal[i]++;
                open++;
            }
            else {
                bal[i]--;
            }
            if(i-1>=0) {
                bal[i]+=bal[i-1];
            }
        }
        if(open != n - open) {
            pl("0\n1 1");
            System.exit(0);
        }
        int min = Integer.MAX_VALUE, at = -1;
        for(int i=0;i<n;++i) {
            if(bal[i]<min) {
                min = bal[i];
                at = i;
            }
        }
        //pa("bal", bal);
        int arr[] = new int[n];
        int ptr = 0;
        for(int i=at+1;i<n;++i) {
            arr[ptr++] = bal[i] - min;
        }
        for(int i=0;i<=at;++i) {
            arr[ptr++] = bal[i] - min;
        }
        //pa("arr", arr);
        int max = -1, ans_idx1 = -1, ans_idx2 = -1;
        idx1 = idx2 = 0;
        int zero = calc(arr,0,n,false, (at+1 ==n ? 0 : at+1));
        //pl("zero : " + zero);
        if(zero>max) {
            max = zero;
            ans_idx1 = 0;
            ans_idx2 = 0;
        }
        idx1 = idx2 = 0;
        int one = calc(arr,1,n,false, (at+1 ==n ? 0 : at+1));
        if(one>max) {
            max = one;
            ans_idx1 = idx1;
            ans_idx2 = idx2;
        }
        //pl("one : " + one);
        idx1 = idx2 = 0;
        int two = calc(arr,2,n,true, (at+1 ==n ? 0 : at+1));
        if(two>max) {
            max = two;
            ans_idx1 = idx1;
            ans_idx2 = idx2;
        }
        //pl("two : " + two);
        pl(max);
        pl((1+getOriginalIndex(at+1 == n ? 0 : at+1, n, ans_idx1)) + " " + (1+getOriginalIndex(at+1 == n ? 0 : at+1, n, ans_idx2)));
        pw.flush();
        pw.close();
    }
    static int getOriginalIndex(int from_where, int n, int idx) {
        if(idx<=n-1-from_where) {
            return from_where + idx;
        }
        else {
            return idx - (n-from_where);
        }
    }
    static int calc(int arr[], int k, int n, boolean shouldAdd, int from_where) {
        int till[] = new int[n];
        int cum[] = new int[n];
        int pref[] = new int[n];
        int suff[] = new int[n];
        for(int i=n-1;i>=0;--i) {
            if(arr[i] == 0) {
                ++suff[i];
            }
            if(i+1<n) {
                suff[i]+=suff[i+1];
            }
        }
        for(int i=0;i<n;++i) {
            if(arr[i] == k) {
                cum[i]++;
            }
            if(arr[i] == 0) {
                ++pref[i];
            }
            if(i>0) {
                cum[i]+=cum[i-1];
                pref[i]+=pref[i-1];
            }
        }
        for(int i=n-1;i>=0;--i) {
            if(arr[i] >= k) {
                till[i] = (i+1 < n  ? till[i+1] : n);
            }
            else {
                till[i] = i;
            }
        }
        int max = -1;
        for(int i=0;i<n;++i) {
            if(till[i]==i) {
                continue;
            }
            if(c[getOriginalIndex(from_where, n, i)] == ')') {
                continue;
            }
            int ispe = (till[i] - 1 > 0 ? cum[till[i] - 1] : 0) - (i > 0 ? cum[i-1] : 0);
            if(shouldAdd) {
                ispe+=(i-1>0 ? pref[i-1] : 0);
                ispe+=(till[i] < n ? suff[till[i]] : 0);
            }
            if(max<ispe) {
                idx1 = i;
                idx2 = min(n-1, till[i]);
                max = ispe;
            }
        }
        return max;
    }
    static void initIo(boolean isFileIO) throws IOException {
        scan = new MyScanner(isFileIO);
        if(isFileIO) {
            pw = new PrintWriter("/Users/amandeep/Desktop/output.txt");
        }
        else {
            pw = new PrintWriter(System.out, true);
        }
    }
    static int ni() throws IOException
    {
        return scan.nextInt();
    }
    static long nl() throws IOException
    {
        return scan.nextLong();
    }
    static double nd() throws IOException
    {
        return scan.nextDouble();
    }
    static String ne() throws IOException
    {
        return scan.next();
    }
    static String nel() throws IOException
    {
        return scan.nextLine();
    }
    static void pl()
    {
        pw.println();
    }
    static void p(Object o)
    {
        pw.print(o+" ");
    }
    static void pl(Object o)
    {
        pw.println(o);
    }
    static void psb(StringBuilder sb)
    {
        pw.print(sb);
    }
    static void pa(String arrayName, Object arr[])
    {
        pl(arrayName+" : ");
        for(Object o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, int arr[])
    {
        pl(arrayName+" : ");
        for(int o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, long arr[])
    {
        pl(arrayName+" : ");
        for(long o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, double arr[])
    {
        pl(arrayName+" : ");
        for(double o : arr)
            p(o);
        pl();
    }
    static void pa(String arrayName, char arr[])
    {
        pl(arrayName+" : ");
        for(char o : arr)
            p(o);
        pl();
    }
    static void pa(String listName, List list)
    {
        pl(listName+" : ");
        for(Object o : list)
            p(o);
        pl();
    }
    static void pa(String arrayName, Object[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(Object o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, int[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(int o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, long[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(long o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, char[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(char o : arr[i])
                p(o);
            pl();
        }
    }
    static void pa(String arrayName, double[][] arr) {
        pl(arrayName+" : ");
        for(int i=0;i<arr.length;++i) {
            for(double o : arr[i])
                p(o);
            pl();
        }
    }
    static class MyScanner
    {
        BufferedReader br;
        StringTokenizer st;
        MyScanner(boolean readingFromFile) throws IOException
        {
            if(readingFromFile) {
                br = new BufferedReader(new FileReader("/Users/amandeep/Desktop/input.txt"));
            }
            else {
                br = new BufferedReader(new InputStreamReader(System.in));
            }
        }
        String nextLine()throws IOException
        {
            return br.readLine();
        }
        String next() throws IOException
        {
            if(st==null || !st.hasMoreTokens())
                st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }
        int nextInt() throws IOException
        {
            return Integer.parseInt(next());
        }
        long nextLong() throws IOException
        {
            return Long.parseLong(next());
        }
        double nextDouble() throws IOException
        {
            return Double.parseDouble(next());
        }
    }
}