#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e6+9;
const int MAX=1e2+9;
const int MAX1=5e6+9;
const int INF=0x3f3f3f3f;
const double ep=1e-8;
const double ep1=1e-12;
const int mod=998244353;
const double inf=1e20;
const long double pi=acos(-1);
#define debug1 puts("?");
#define debug(x) cout<<"##"<<(x)<<endl;
#define mk make_pair
#define PII pair<int,int>
#define PDI pair<double,int>
#define PIII pair<int,PII >
#define PIII1 pair<PII,int>
#define PIIII pair<PII,PII >
#define PIL pair<int,ll>
#define PLI pair<ll,int>
#define PLIII pair<PLI,PII >
#define PLL pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define sd(x) scanf("%d",&(x))
#define slld(x) scanf("%lld",&(x))
#define sdd(x,y) scanf("%d%d",&(x),&(y))
#define sc(s) scanf("%s",(s))
#define pd(x) printf("%d\n",(x))
#define plld(x) printf("%lld\n",(x))
#define pdk(x) printf("%d ",(x))
#define plldk(x) printf("%lld ",(x))
#define pdd(x,y) printf("%d %d\n",(x),(y))
#define PR(x) printf("Case %d: ",(x))
#define INF 0x3f3f3f3f
typedef long double ld;
typedef unsigned long long ull;
/*
*/
int n;
ll l[maxn],r[maxn];
char s[maxn];
void solve()
{
	sd(n);
	sc(s+1);	
	rep(i,1,n+1)l[i]=r[i]=0;
	int cnt=0;
	rep(i,1,n)
	{
		l[i]=l[i-1];
		if(s[i]=='*')
		{
			cnt++;
			continue;
		}
		l[i]+=cnt;
	}
	cnt=0;
	ll ans=1e18;
	dep(i,n,1)
	{
		r[i]=r[i+1];
		if(s[i]=='*')cnt++;
		else r[i]+=cnt;
		ans=min(ans,r[i]+l[i-1]);
	}
	plld(ans);
}
int main()
{
	int T=1;
	sd(T);
	while(T--)solve();
}
### Prompt

In Cpp, your task is to solve the following problem:

You are playing the game "Arranging The Sheep". The goal of this game is to make the sheep line up. The level in the game is described by a string of length n, consisting of the characters '.' (empty space) and '*' (sheep). In one move, you can move any sheep one square to the left or one square to the right, if the corresponding square exists and is empty. The game ends as soon as the sheep are lined up, that is, there should be no empty cells between any sheep.

For example, if n=6 and the level is described by the string "**.*..", then the following game scenario is possible: 

  * the sheep at the 4 position moves to the right, the state of the level: "**..*."; 
  * the sheep at the 2 position moves to the right, the state of the level: "*.*.*."; 
  * the sheep at the 1 position moves to the right, the state of the level: ".**.*."; 
  * the sheep at the 3 position moves to the right, the state of the level: ".*.**."; 
  * the sheep at the 2 position moves to the right, the state of the level: "..***."; 
  * the sheep are lined up and the game ends. 



For a given level, determine the minimum number of moves you need to make to complete the level.

Input

The first line contains one integer t (1 ≤ t ≤ 10^4). Then t test cases follow.

The first line of each test case contains one integer n (1 ≤ n ≤ 10^6).

The second line of each test case contains a string of length n, consisting of the characters '.' (empty space) and '*' (sheep) — the description of the level.

It is guaranteed that the sum of n over all test cases does not exceed 10^6.

Output

For each test case output the minimum number of moves you need to make to complete the level.

Example

Input


5
6
**.*..
5
*****
3
.*.
3
...
10
*.*...*.**


Output


1
0
0
0
9

### Response

```cpp
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=2e6+9;
const int MAX=1e2+9;
const int MAX1=5e6+9;
const int INF=0x3f3f3f3f;
const double ep=1e-8;
const double ep1=1e-12;
const int mod=998244353;
const double inf=1e20;
const long double pi=acos(-1);
#define debug1 puts("?");
#define debug(x) cout<<"##"<<(x)<<endl;
#define mk make_pair
#define PII pair<int,int>
#define PDI pair<double,int>
#define PIII pair<int,PII >
#define PIII1 pair<PII,int>
#define PIIII pair<PII,PII >
#define PIL pair<int,ll>
#define PLI pair<ll,int>
#define PLIII pair<PLI,PII >
#define PLL pair<ll,ll>
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
#define dep(i,a,b) for(int i=(a);i>=(b);--i)
#define sd(x) scanf("%d",&(x))
#define slld(x) scanf("%lld",&(x))
#define sdd(x,y) scanf("%d%d",&(x),&(y))
#define sc(s) scanf("%s",(s))
#define pd(x) printf("%d\n",(x))
#define plld(x) printf("%lld\n",(x))
#define pdk(x) printf("%d ",(x))
#define plldk(x) printf("%lld ",(x))
#define pdd(x,y) printf("%d %d\n",(x),(y))
#define PR(x) printf("Case %d: ",(x))
#define INF 0x3f3f3f3f
typedef long double ld;
typedef unsigned long long ull;
/*
*/
int n;
ll l[maxn],r[maxn];
char s[maxn];
void solve()
{
	sd(n);
	sc(s+1);	
	rep(i,1,n+1)l[i]=r[i]=0;
	int cnt=0;
	rep(i,1,n)
	{
		l[i]=l[i-1];
		if(s[i]=='*')
		{
			cnt++;
			continue;
		}
		l[i]+=cnt;
	}
	cnt=0;
	ll ans=1e18;
	dep(i,n,1)
	{
		r[i]=r[i+1];
		if(s[i]=='*')cnt++;
		else r[i]+=cnt;
		ans=min(ans,r[i]+l[i-1]);
	}
	plld(ans);
}
int main()
{
	int T=1;
	sd(T);
	while(T--)solve();
}
```