Consider a circle whose perimeter is divided by N points into N arcs of equal length, and each of the arcs is painted red or blue. Such a circle is said to generate a string S from every point when the following condition is satisfied:

* We will arbitrarily choose one of the N points on the perimeter and place a piece on it.
* Then, we will perform the following move M times: move the piece clockwise or counter-clockwise to an adjacent point.
* Here, whatever point we choose initially, it is always possible to move the piece so that the color of the i-th arc the piece goes along is S_i, by properly deciding the directions of the moves.



Assume that, if S_i is `R`, it represents red; if S_i is `B`, it represents blue. Note that the directions of the moves can be decided separately for each choice of the initial point.

You are given a string S of length M consisting of `R` and `B`. Out of the 2^N ways to paint each of the arcs red or blue in a circle whose perimeter is divided into N arcs of equal length, find the number of ways resulting in a circle that generates S from every point, modulo 10^9+7.

Note that the rotations of the same coloring are also distinguished.

Constraints

* 2 \leq N \leq 2 \times 10^5
* 1 \leq M \leq 2 \times 10^5
* |S|=M
* S_i is `R` or `B`.

Input

Input is given from Standard Input in the following format:


N M
S


Output

Print the number of ways to paint each of the arcs that satisfy the condition, modulo 10^9+7.

Examples

Input

4 7
RBRRBRR


Output

2


Input

3 3
BBB


Output

4


Input

12 10
RRRRBRRRRB


Output

78
#include <cstdio>
#include <algorithm>

using std::min;

const int MOD=1000000007;

const int MAXN=200011, MAXM=200011;

inline int sum(const int &a, const int &b){
	return (a+b>=MOD)?(a+b-MOD):(a+b);
}

inline int mul(const int &a, const int &b){
	return (int)((1LL*a*b)%(long long)(MOD));
}

inline void add(int &f, const int &v){
	f+=v;if(f>=MOD)	f-=MOD;
}

int N, M;
int A[MAXM];
char input[MAXM];
int F[MAXN];

inline bool AllZero(){
	int Cnt=0;
	for(int i=1;i<=M;++i)	Cnt+=!A[i];
	return Cnt==M;
}

int main(){
	
	scanf("%d%d", &N, &M);
	scanf("%s", input);
	for(int i=1;i<=M;++i)	A[i]=input[i-1]!=input[0];
	
	if(AllZero()){
		int F[2][2], T[2][2];
		F[0][0]=F[1][1]=1;
		F[0][1]=F[1][0]=0;
		for(int i=2;i<=N;++i){
			for(int s=0;s<2;++s)
				for(int n=0;n<2;++n)
					T[s][n]=0;
			for(int s=0;s<2;++s)
				for(int n=0;n<2;++n)
					for(int c=0;c<2;++c)
						if(n+c<2)	add(T[s][c], F[s][n]);
			for(int s=0;s<2;++s)
				for(int n=0;n<2;++n)
					F[s][n]=T[s][n];
		}
		int Ans=0;
		for(int s=0;s<2;++s)
			for(int n=0;n<2;++n)
				if(s+n<2)	add(Ans, F[s][n]);
		printf("%d\n", Ans);
	}
	else{
		int Lim=N;
		for(int i=1, c=0, p=0;i<=M;++i){
			if(A[i]){
				if(c&1)	Lim=min(Lim, c+1);
				else if(!p)	Lim=min(Lim, c+2);
				c=0;p=i;
			}
			else	++c;
		}
		F[0]=F[2]=1;
		for(int i=4;i<=N;i+=2){
			F[i]=sum(F[i-2], F[i-2]);
			if(i>=Lim+2){
				add(F[i], MOD-F[i-(Lim+2)]);
			}
		}
		int Ans=0;
		for(int i=2;i<=Lim;i+=2){
			add(Ans, mul(F[N-i], i));
		}
		printf("%d\n", Ans);
	}
	
	return 0;
}