This is a harder version of the problem. In this version, n ≤ 300 000.

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 ≤ 300 000), 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. 
#include <bits/stdc++.h>
using namespace std;
inline long long mod(long long n, long long m) {
  long long ret = n % m;
  if (ret < 0) ret += m;
  return ret;
}
long long gcd(long long a, long long b) {
  return (b == 0LL ? a : gcd(b, a % b));
}
long long exp(long long a, long long b, long long m) {
  if (b == 0LL) return 1LL;
  if (b == 1LL) return mod(a, m);
  long long k = mod(exp(a, b / 2, m), m);
  if (b & 1LL) {
    return mod(a * mod(k * k, m), m);
  } else
    return mod(k * k, m);
}
struct node {
  long long pre;
  long long sum;
  node operator+(const node &o) const {
    node r;
    r.sum = sum + o.sum;
    r.pre = min(pre, sum + o.pre);
    return r;
  }
};
template <class T>
struct ST {
  vector<T> st;
  long long n;
  T ini;
  ST(long long n, T ini) : st(2 * n, ini), n(n), ini(ini) {}
  void upd(long long pos, T val) {
    for (st[pos += n] = val; pos /= 2;) st[pos] = st[2 * pos] + st[2 * pos + 1];
  }
  T query(long long x, long long y) {
    T ra = ini, rb = ini;
    for (x += n, y += n + 1; x < y; x /= 2, y /= 2) {
      if (x & 1) ra = ra + st[x++];
      if (y & 1) rb = st[--y] + rb;
    }
    return ra + rb;
  }
};
long long n;
const long long N = 600100;
char s[N];
node make(long long x) {
  node r;
  r.sum = x;
  r.pre = min(0LL, x);
  return r;
}
long long val(char c) {
  if (c == '(') return 1;
  return -1;
}
long long best = 0;
pair<long long, long long> res = pair<long long, long long>(1, 1);
ST<node> T(1, make(0));
void tenta(long long l, long long r) {
  l %= n;
  r %= n;
  long long v1 = val(s[l]);
  long long v2 = val(s[r]);
  T.upd(r, make(v1));
  T.upd(r + n, make(v1));
  T.upd(l, make(v2));
  T.upd(l + n, make(v2));
  long long tot = 0;
  for (long long i = 0; i < n; i++) {
    node x = T.query(i, i + n - 1);
    if (x.pre >= 0 and x.sum == 0) tot++;
  }
  if (best < tot) {
    best = tot;
    res = pair<long long, long long>(l + 1, r + 1);
  }
  T.upd(r, make(v2));
  T.upd(r + n, make(v2));
  T.upd(l, make(v1));
  T.upd(l + n, make(v1));
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n;
  for (long long i = 0; i < n; i++) {
    cin >> s[i];
    s[i + n] = s[i];
  }
  T = ST<node>(2 * n + 10, make(0));
  for (long long i = 0; i < 2 * n; i++) {
    if (s[i] == '(')
      T.upd(i, make(1));
    else
      T.upd(i, make(-1));
  }
  vector<long long> p;
  long long ini = -1;
  for (long long it = 0; it < n; it++) {
    node x = T.query(it, it + n - 1);
    if (x.pre >= 0 and x.sum == 0) {
      best++;
      if (ini == -1) ini = it;
      p.push_back(it);
    }
  }
  if (ini == -1) {
    cout << "0\n1 1\n";
    return 0;
  }
  for (long long x : p) {
    long long has = 0;
    ini = x + 1;
    long long end = 0;
    for (long long i = x; i < x + n; i++) {
      has += val(s[i]);
      if (has == 0) {
        end = i;
        break;
      }
    }
    vector<pair<long long, long long> > pos;
    has = 0;
    ini = x + 1;
    for (long long i = x + 1; i < end; i++) {
      has += val(s[i]);
      if (has == 0) {
        pos.push_back(pair<long long, long long>(ini, i));
        ini = i + 1;
      }
    }
    long long inside = pos.size();
    long long op1 = inside + 1;
    if (best < op1) {
      best = op1;
      res = pair<long long, long long>((x) % n + 1, (end % n) + 1);
    }
    for (long long i = 0; i < pos.size(); i++) {
      long long l = pos[i].first;
      long long r = pos[i].second;
      long long has = 0;
      inside = 0;
      for (long long j = l + 1; j < r; j++) {
        has += val(s[j]);
        if (has == 0) inside++;
      }
      l %= n, r %= n;
      long long cur = 1 + inside + 1 + p.size() - 1;
      if (best < cur) {
        best = cur;
        res = pair<long long, long long>(l + 1, r + 1);
      }
    }
  }
  cout << best << "\n";
  cout << res.first << " " << res.second << "\n";
}
