Game field is represented by a line of n square cells. In some cells there are packmen, in some cells there are asterisks and the rest of the cells are empty. Packmen eat asterisks.

Before the game starts you can choose a movement direction, left or right, for each packman. Once the game begins all the packmen simultaneously start moving according their directions. A packman can't change the given direction.

Once a packman enters a cell containing an asterisk, packman immediately eats the asterisk. Once the packman leaves the cell it becomes empty. Each packman moves at speed 1 cell per second. If a packman enters a border cell, the packman stops. Packmen do not interfere with the movement of other packmen; in one cell there can be any number of packmen moving in any directions.

Your task is to assign a direction to each packman so that they eat the maximal number of asterisks. If there are multiple ways to assign directions to eat the maximal number of asterisks, you should choose the way which minimizes the time to do that.

Input

The first line contains integer number n (2 ≤ n ≤ 1 000 000) — the number of cells in the game field.

The second line contains n characters. If the i-th character is '.', the i-th cell is empty. If the i-th character is '*', the i-th cell contains an asterisk. If the i-th character is 'P', the i-th cell contains a packman.

The field contains at least one asterisk and at least one packman.

Output

Print two integer numbers — the maximal number of asterisks packmen can eat and the minimal time to do it.

Examples

Input

6
*.P*P*


Output

3 4


Input

8
*...P..*


Output

1 3

Note

In the first example the leftmost packman should move to the right, the rightmost packman should move to the left. All the asterisks will be eaten, the last asterisk will be eaten after 4 seconds.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
char ch[maxn];
int sum[maxn], dp[maxn];
vector<int> v;
bool check(int f, int s, int mid) {
  int t = max(0, v[f] - mid - 1), flag = 1;
  if (sum[t] > sum[dp[s]]) flag = 0;
  return flag;
}
int main() {
  int n, cnt = 0, local, last;
  v.push_back(0);
  scanf("%d", &n);
  scanf("%s", ch + 1);
  for (int i = 1; i <= n; i++) {
    if (ch[i] == '*')
      sum[i] = sum[i - 1] + 1, last = i;
    else
      sum[i] = sum[i - 1];
    if (ch[i] == 'P') {
      cnt++, local = i;
      v.push_back(i);
    }
  }
  if (cnt == 1) {
    int ans = 0, ans1 = 0, value = 0, value1 = 0;
    for (int i = local; i > 0; i--)
      if (ch[i] == '*') ans = local - i, value++;
    for (int i = local; i <= n; i++)
      if (ch[i] == '*') ans1 = i - local, value1++;
    if (value == value1)
      printf("%d %d\n", value, min(ans, ans1));
    else if (value > value1)
      printf("%d %d\n", value, ans);
    else
      printf("%d %d\n", value1, ans1);
    return 0;
  }
  int ss = v.size() - 1;
  int l = 0, r = n, ans = n;
  while (l < r) {
    int mid = (l + r) / 2, flag = 1;
    memset(dp, 0, sizeof(dp));
    for (int i = 1; i < v.size(); i++) {
      if (!check(i, i - 1, mid)) break;
      dp[i] = v[i];
      if (i != 1 && check(i, i - 2, mid))
        dp[i] = max(min(v[i - 1] + mid, n), dp[i]);
      if (sum[v[i]] <= sum[dp[i - 1]]) dp[i] = max(min(v[i] + mid, n), dp[i]);
    }
    if (dp[ss] >= last)
      ans = mid, r = mid;
    else
      l = mid + 1;
  }
  printf("%d %d\n", sum[last], ans);
  return 0;
}
