In the snake exhibition, there are n rooms (numbered 0 to n - 1) arranged in a circle, with a snake in each room. The rooms are connected by n conveyor belts, and the i-th conveyor belt connects the rooms i and (i+1) mod n. In the other words, rooms 0 and 1, 1 and 2, …, n-2 and n-1, n-1 and 0 are connected with conveyor belts.

The i-th conveyor belt is in one of three states:

  * If it is clockwise, snakes can only go from room i to (i+1) mod n. 
  * If it is anticlockwise, snakes can only go from room (i+1) mod n to i. 
  * If it is off, snakes can travel in either direction. 

<image>

Above is an example with 4 rooms, where belts 0 and 3 are off, 1 is clockwise, and 2 is anticlockwise.

Each snake wants to leave its room and come back to it later. A room is returnable if the snake there can leave the room, and later come back to it using the conveyor belts. How many such returnable rooms are there?

Input

Each test contains multiple test cases. The first line contains a single integer t (1 ≤ t ≤ 1000): the number of test cases. The description of the test cases follows. 

The first line of each test case description contains a single integer n (2 ≤ n ≤ 300 000): the number of rooms.

The next line of each test case description contains a string s of length n, consisting of only '<', '>' and '-'.

  * If s_{i} =  '>', the i-th conveyor belt goes clockwise. 
  * If s_{i} =  '<', the i-th conveyor belt goes anticlockwise. 
  * If s_{i} =  '-', the i-th conveyor belt is off. 



It is guaranteed that the sum of n among all test cases does not exceed 300 000.

Output

For each test case, output the number of returnable rooms.

Example

Input


4
4
-&gt;&lt;-
5
&gt;&gt;&gt;&gt;&gt;
3
&lt;--
2
&lt;&gt;


Output


3
5
3
0

Note

In the first test case, all rooms are returnable except room 2. The snake in the room 2 is trapped and cannot exit. This test case corresponds to the picture from the problem statement.

In the second test case, all rooms are returnable by traveling on the series of clockwise belts.
#include <bits/stdc++.h>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wc++11-extensions"
#pragma GCC diagnostic ignored "-Wmacro-redefined"
using namespace std;
long long power(long long x, long long y, long long p = 100000000000000000) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long modInverse(long long n, long long p) {
  return power(n, p - 2, p) % p;
}
bool cst2(pair<int, int> p1, pair<int, int> p2) {
  return p1.second < p2.second;
}
void swap(long long &a, long long &b) {
  long long t = a;
  a = b;
  b = t;
}
template <typename T>
int sgn(T val) {
  return (T(0) < val) - (val < T(0));
}
int gcd(int a, int b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <typename T>
T modulo(T num, T modd) {
  if (num >= 0) return num % modd;
  return (modd - (abs(num) % modd));
}
template <typename T>
void print(vector<T> &v) {
  for (auto i : v) cout << i << ' ';
  cout << endl;
}
string repeatStr(char c, int x) {
  string s(1, c);
  string ans = "";
  for (int i = 0; i < x; i++) {
    ans = ans + s;
  }
  return ans;
}
long long iLog(long long x, long long base) {
  return (long long)(log(x) / log(base) + 0.00000000001);
}
void bfs2(vector<vector<int> > &edges, int src, int dest, int n,
          map<int, int> &dist, map<int, int> &pred) {
  queue<int> q;
  q.push(src);
  bool visited[n];
  for (int i = 0; i < n; i++) {
    visited[i] = 0;
    dist[i] = 1000000000;
    pred[i] = -1;
  }
  visited[src] = 1;
  dist[src] = 0;
  while (!q.empty()) {
    int t = q.front();
    q.pop();
    for (int s : edges[t]) {
      if (!visited[s]) {
        visited[s] = 1;
        dist[s] = dist[t] + 1;
        pred[s] = t;
        q.push(s);
      }
    }
  }
}
vector<int> getPath(map<int, int> &pred, int src, int dest) {
  vector<int> v;
  int x = dest;
  v.push_back(x);
  while (x != src || pred[x] != -1) {
    v.push_back(pred[x]);
    x = pred[x];
  }
  reverse(v.begin(), v.end());
  return v;
}
queue<int> qfromv(vector<long long> &v) {
  queue<int> q;
  for (int x : v) {
    q.push(x);
  }
  return q;
}
void graphInput(vector<vector<int> > &graph, int &n) {
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    cin >> x >> y;
    x--, y--;
    graph[x].push_back(y);
    graph[y].push_back(x);
  }
}
void treeTraversal(vector<vector<int> > &tree,
                   map<int, vector<int> > &depthToNodes, int root, int &n,
                   int &depth) {
  deque<int> dq;
  dq.push_back(root);
  depth = 0;
  int cntr = 1;
  int c = 0;
  bool visited[n];
  for (int i = 0; i < n; i++) visited[i] = 0;
  while (dq.size() != 0) {
    int node = dq.front();
    dq.pop_front();
    c++;
    visited[node] = 1;
    for (auto x : tree[node]) {
      if (!visited[x]) dq.push_back(x);
    }
    if (c < cntr) {
      depthToNodes[depth].push_back(node);
    } else if (c == cntr) {
      depthToNodes[depth].push_back(node);
      c = 0;
      cntr = dq.size();
      depth++;
    }
  }
}
int subtreeSize(vector<vector<int> > &tree, int root,
                vector<int> &subtreeSizes) {
  static vector<bool> visited(tree.size(), 0);
  if (subtreeSizes[root] != -1) return subtreeSizes[root];
  int x = 1;
  visited[root] = 1;
  for (int node : tree[root])
    if (!visited[node]) x += subtreeSize(tree, node, subtreeSizes);
  subtreeSizes[root] = x;
  return subtreeSizes[root];
}
int prime(int n) {
  for (int i = 3; i <= sqrt(n); i = i + 2) {
    while (n % i == 0) {
      return i;
    }
  }
  return n;
}
int calculate(vector<vector<int> > &edges, int parent, int node,
              map<pair<int, int>, int> &values) {
  if (values[make_pair(parent, node)] != 0) {
    return values[make_pair(parent, node)];
  }
  int sum = 1;
  for (int i = 0; i < edges[node].size(); i++) {
    int z = edges[node][i];
    if (z == parent) continue;
    sum += calculate(edges, node, z, values);
  }
  values[make_pair(parent, node)] = sum;
  return values[make_pair(parent, node)];
}
int get_leaf(vector<vector<int> > &edges, int parent, int node) {
  if (edges[node].size() == 1) {
    return node;
  }
  if (edges[node][0] != parent) {
    return get_leaf(edges, node, edges[node][0]);
  } else {
    return get_leaf(edges, node, edges[node][1]);
  }
}
vector<int> SieveOfEratosthenes(int n) {
  bool prime[n + 1];
  memset(prime, true, sizeof(prime));
  for (int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  vector<int> ans;
  for (int p = 2; p <= n; p++)
    if (prime[p]) ans.push_back(p);
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int t;
  t = 1;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    string s;
    cin >> s;
    vector<int> returnable(n, 0);
    bool allTrue = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '-' || s[modulo(i - 1, n)] == '-') {
        returnable[i] = 1;
      }
    }
    int c1 = 0, c2 = 0;
    for (int i = 0; i < n; i++) {
      if (s[i] == '<' || s[i] == '-') {
        c1++;
      }
      if (s[i] == '>' || s[i] == '-') {
        c2++;
      }
    }
    if (c1 == n || c2 == n) allTrue = 1;
    if (allTrue) {
      cout << n << endl;
    } else {
      int counter = 0;
      for (int i = 0; i < n; i++) {
        counter += returnable[i];
      }
      cout << counter << endl;
    }
  }
}
