#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 3e3+2;
queue<int> moves[N];
int dp[N] , nw = 0,last,maxi = 0;
int arr[N];
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        char c;
        cin >> c;
        if (c == 'L')
            arr[i] = 0;
        else
            arr[i] = 1;
    }
    last = n - 1;
    for (int i = n - 1; i >= 0; i--)
    {
        if (arr[i])
        {
            int cur = 0;
            for (int j = i + 1; j <= last; j++)
            {
                dp[j - 1] = max({dp[j - 1], dp[j], cur}) + 1;
                maxi = max(maxi, dp[j - 1]);
                moves[dp[j - 1]].push(j);
                nw++;
                cur++;
            }
            last--;
        }
    }
    if (k <= nw && k >= maxi)
    {
        int b = 0, stop = 1, tmpK = k;
        for (int i = 1; i <= tmpK; i++)
        {
            int tmp = nw;
            int dec = moves[stop].size();
            if (b)
                dec = 1;
            if (nw - moves[stop].size() < k - 1)
            {
                dec = (nw - k + 1);
                b = 1;
            }
            nw -= dec;
            cout << dec << " ";
            while (dec--)
            {
                cout << moves[stop].front() << " ";
                moves[stop].pop();
            }
            if (moves[stop].empty())
                stop++;
            k--;
            cout << endl;
        }
    }
    else
    {
        cout << -1;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e6+2;
const int n2 = 1e3+2;
queue<int> moves[N];
int dp[N] , nw = 0,last,maxi = 0;
int arr[n2];
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n, k;
    cin >> n >> k;
    for (int i = 0; i < n; i++)
    {
        char c;
        cin >> c;
        if (c == 'L')
            arr[i] = 0;
        else
            arr[i] = 1;
    }
    last = n - 1;
    for (int i = n - 1; i >= 0; i--)
    {
        if (arr[i])
        {
            int cur = 0;
            for (int j = i + 1; j <= last; j++)
            {
                dp[j - 1] = max({dp[j - 1], dp[j], cur}) + 1;
                maxi = max(maxi, dp[j - 1]);
                moves[dp[j - 1]].push(j);
                nw++;
                cur++;
            }
            last--;
        }
    }
    if (k <= nw && k >= maxi)
    {
        int b = 0, stop = 1, tmpK = k;
        for (int i = 1; i <= tmpK; i++)
        {
            int tmp = nw;
            int dec = moves[stop].size();
            if (b)
                dec = 1;
            if (nw - moves[stop].size() < k - 1)
            {
                dec = (nw - k + 1);
                b = 1;
            }
            nw -= dec;
            cout << dec << " ";
            while (dec--)
            {
                cout << moves[stop].front() << " ";
                moves[stop].pop();
            }
            if (moves[stop].empty())
                stop++;
            k--;
            cout << endl;
        }
    }
    else
    {
        cout << -1;
    }
}


#include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n, k, ans = -1;
    cin >> n >> k;
    int arr[n];
    vector<int> v;
    map<int, queue<int>> moves;
    for (int i = 0; i < n; i++)
    {
        char c;
        cin >> c;
        if (c == 'L')
        {
            arr[i] = 0;
        }
        else
        {
            arr[i] = 1;
            v.push_back(i + 1);
        }
    }
    int dp[n] = {}, nw = 0, last = n - 1, maxi = 0;
    for (int i = n - 1; i >= 0; i--)
    {
        if (arr[i])
        {
            int cur = 0;
            for (int j = i + 1; j <= last; j++)
            {
                dp[j - 1] = max({dp[j - 1], dp[j], cur}) + 1;
                maxi = max(maxi, dp[j - 1]);
                moves[dp[j - 1]].push(j);
                nw++;
                cur++;
            }
            last--;
        }
    }
    if (k <= nw && k >= maxi)
    {
        int b = 0, stop = 1, tmpK = k;
        for (int i = 1; i <= tmpK; i++)
        {
            int tmp = nw;
            queue<int> q;
            int dec = moves[stop].size();
            if (b)
                dec = 1;
            if (nw - moves[stop].size() < k - 1)
            {
                dec = (nw - k + 1);
                b = 1;
            }
            nw -= dec;
            cout << dec << " ";
            while (dec--)
            {
                cout << moves[stop].front() << " ";
                moves[stop].pop();
            }
            if (moves[stop].empty())
                stop++;
            k--;
            cout << endl;
        }
    }
    else
    {
        cout << -1;
    }
}


//      ——By DD_BOND

#include<bits/stdc++.h>

#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define INF 0x3f3f3f3f
#define pi 3.1415926535898
#define lowbit(a)  (a&(-a))
#define lson l,(l+r)/2,rt<<1
#define rson (l+r)/2+1,r,rt<<1|1
#define Min(a,b,c)  min(a,min(b,c))
#define Max(a,b,c)  max(a,max(b,c))
#define debug(x)  cerr<<#x<<"="<<x<<"\n";

//#pragma GCC optimize(3)
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef unsigned long long ull;

const int seed=131;
const ll LLMAX=2e18;
const int MOD=1e9+7;
const double eps=1e-8;
const int MAXN=1e6+10;
const int hmod1=0x48E2DCE7;
const int hmod2=0x60000005;

inline ll sqr(ll x){ return x*x; }
inline int sqr(int x){ return x*x; }
inline double sqr(double x){ return x*x; }
ll gcd(ll a,ll b){ return b==0? a: gcd(b,a%b); }
ll exgcd(ll a,ll b,ll &x,ll &y){ ll d; (b==0? (x=1,y=0,d=a): (d=exgcd(b,a%b,y,x),y-=a/b*x)); return d; }
ll qpow(ll a,ll n){ll sum=1;while(n){if(n&1)sum=sum*a%MOD;a=a*a%MOD;n>>=1;}return sum;}
inline int dcmp(double x){  if(fabs(x)<eps) return 0;   return (x>0? 1: -1); }

vector<int>st;
vector<int>ans[MAXN];

int main(void)
{
    ios::sync_with_stdio(false);    cin.tie(0);   cout.tie(0);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.in","r",stdin);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.out","w",stdout);
 	int n,k,tot=0,cur=0;	string s;	cin>>n>>k>>s;
 	for(int i=0,l=0,r=0;i<n;i++){
 		if(s[i]=='R')	r++;
 		else	l++,tot+=r;
 	}
 	if(k>tot)	return cout<<-1<<endl,0;
 	for(int i=1;i<n;i++)
 		if(s[i-1]=='R'&&s[i]=='L')
 			st.pb(i);
 	while(k!=tot){
 		k--;
 		vector<int>nx;
 		for(int i=0;i<(int)st.size()&&k!=tot;i++,tot--){
 			int j=st[i];
 			ans[cur].pb(j);
 			swap(s[j-1],s[j]);
 			if(j>=2&&s[j-2]=='R')	nx.pb(j-1);
 			if(j+1<n&&s[j+1]=='L')	nx.pb(j+1);
 		}
 		cur++;
 		st=nx;
 	}
 	for(int i=1;i<n;i++){
 		int j=i;
 		while(j&&s[j-1]=='R'&&s[j]=='L'){
 			swap(s[j-1],s[j]);
 			ans[cur].pb(j);
 			cur++;
 			j--;
 		}
 	}
 	for(int i=0;i<cur;i++){
 		cout<<ans[i].size();
 		for(int j=0;j<(int)ans[i].size();j++)	cout<<' '<<ans[i][j];
 		cout<<endl;
 	}
    return 0;
}


//      ——By DD_BOND

#include<bits/stdc++.h>

#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define INF 0x3f3f3f3f
#define pi 3.1415926535898
#define lowbit(a)  (a&(-a))
#define lson l,(l+r)/2,rt<<1
#define rson (l+r)/2+1,r,rt<<1|1
#define Min(a,b,c)  min(a,min(b,c))
#define Max(a,b,c)  max(a,max(b,c))
#define debug(x)  cerr<<#x<<"="<<x<<"\n";

//#pragma GCC optimize(3)
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef unsigned long long ull;

const int seed=131;
const ll LLMAX=2e18;
const int MOD=1e9+7;
const double eps=1e-8;
const int MAXN=1e6+10;
const int hmod1=0x48E2DCE7;
const int hmod2=0x60000005;

inline ll sqr(ll x){ return x*x; }
inline int sqr(int x){ return x*x; }
inline double sqr(double x){ return x*x; }
ll gcd(ll a,ll b){ return b==0? a: gcd(b,a%b); }
ll exgcd(ll a,ll b,ll &x,ll &y){ ll d; (b==0? (x=1,y=0,d=a): (d=exgcd(b,a%b,y,x),y-=a/b*x)); return d; }
ll qpow(ll a,ll n){ll sum=1;while(n){if(n&1)sum=sum*a%MOD;a=a*a%MOD;n>>=1;}return sum;}
inline int dcmp(double x){  if(fabs(x)<eps) return 0;   return (x>0? 1: -1); }

vector<int>st;
vector<int>ans[MAXN];

int main(void)
{
    ios::sync_with_stdio(false);    cin.tie(0);   cout.tie(0);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.in","r",stdin);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.out","w",stdout);
 	int n,k,tot=0,cur=0;	string s;	cin>>n>>k>>s;
 	for(int i=0,l=0,r=0;i<n;i++){
 		if(s[i]=='R')	r++;
 		else	l++,tot+=r;
 	}
 	if(k>tot)	return cout<<-1<<endl,0;
 	for(int i=1;i<n;i++)
 		if(s[i-1]=='R'&&s[i]=='L')
 			st.pb(i);
 	while(k!=tot){
 		k--;
 		vector<int>nx;
 		for(int i=0;i<(int)st.size()&&k!=tot;i++,tot--){
 			int j=st[i];
 			ans[cur].pb(j);
 			swap(s[j-1],s[j]);
 			if(j&&s[j-2]=='L')	nx.pb(j);
 			if(j+1<n&&s[j+1]=='R')	nx.pb(j+1);
 		}
 		cur++;
 		st=nx;
 	}
 	for(int i=1;i<n;i++){
 		int j=i;
 		while(j&&s[j-1]=='R'&&s[j]=='L')	swap(s[j-1],s[j]),ans[cur].pb(j),cur++,j--;
 	}
 	for(int i=0;i<cur;i++){
 		cout<<ans[i].size();
 		for(int j=0;j<(int)ans[i].size();j++)	cout<<' '<<ans[i][j];
 		cout<<endl;
 	}
    return 0;
}


//      ——By DD_BOND

#include<bits/stdc++.h>

#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define INF 0x3f3f3f3f
#define pi 3.1415926535898
#define lowbit(a)  (a&(-a))
#define lson l,(l+r)/2,rt<<1
#define rson (l+r)/2+1,r,rt<<1|1
#define Min(a,b,c)  min(a,min(b,c))
#define Max(a,b,c)  max(a,max(b,c))
#define debug(x)  cerr<<#x<<"="<<x<<"\n";

//#pragma GCC optimize(3)
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef unsigned long long ull;

const int seed=131;
const ll LLMAX=2e18;
const int MOD=1e9+7;
const double eps=1e-8;
const int MAXN=1e6+10;
const int hmod1=0x48E2DCE7;
const int hmod2=0x60000005;

inline ll sqr(ll x){ return x*x; }
inline int sqr(int x){ return x*x; }
inline double sqr(double x){ return x*x; }
ll gcd(ll a,ll b){ return b==0? a: gcd(b,a%b); }
ll exgcd(ll a,ll b,ll &x,ll &y){ ll d; (b==0? (x=1,y=0,d=a): (d=exgcd(b,a%b,y,x),y-=a/b*x)); return d; }
ll qpow(ll a,ll n){ll sum=1;while(n){if(n&1)sum=sum*a%MOD;a=a*a%MOD;n>>=1;}return sum;}
inline int dcmp(double x){  if(fabs(x)<eps) return 0;   return (x>0? 1: -1); }

vector<int>st;
vector<int>ans[MAXN];

int main(void)
{
    ios::sync_with_stdio(false);    cin.tie(0);   cout.tie(0);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.in","r",stdin);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.out","w",stdout);
 	int n,k,tot=0,cur=0;	string s;	cin>>n>>k>>s;
 	for(int i=0,l=0,r=0;i<n;i++){
 		if(s[i]=='R')	r++;
 		else	l++,tot+=r;
 	}
 	if(k>tot)	return cout<<-1<<endl,0;
 	for(int i=1;i<n;i++)
 		if(s[i-1]=='R'&&s[i]=='L')
 			st.pb(i);
 	while(k!=tot){
 		k--;
 		vector<int>nx;
 		for(int i=0;i<(int)st.size()&&k!=tot;i++,tot--){
 			int j=st[i];
 			ans[cur].pb(j);
 			swap(s[j-1],s[j]);
 			if(j&&s[j-2]=='L')	nx.pb(j);
 			if(j+1<n&&s[j+1]=='R')	nx.pb(j+1);
 		}
 		cur++;
 		st=nx;
 	}
 	for(int i=1;i<n;i++){
 		int j=i;
 		while(j&&s[j-1]=='R'&&s[j]=='L')	ans[cur].pb(j),cur++,j--;
 	}
 	for(int i=0;i<cur;i++){
 		cout<<ans[i].size();
 		for(int j=0;j<(int)ans[i].size();j++)	cout<<' '<<ans[i][j];
 		cout<<endl;
 	}
    return 0;
}


//      ——By DD_BOND

#include<bits/stdc++.h>

#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define INF 0x3f3f3f3f
#define pi 3.1415926535898
#define lowbit(a)  (a&(-a))
#define lson l,(l+r)/2,rt<<1
#define rson (l+r)/2+1,r,rt<<1|1
#define Min(a,b,c)  min(a,min(b,c))
#define Max(a,b,c)  max(a,max(b,c))
#define debug(x)  cerr<<#x<<"="<<x<<"\n";

//#pragma GCC optimize(3)
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef unsigned long long ull;

const int seed=131;
const ll LLMAX=2e18;
const int MOD=1e9+7;
const double eps=1e-8;
const int MAXN=3e6+10;
const int hmod1=0x48E2DCE7;
const int hmod2=0x60000005;

inline ll sqr(ll x){ return x*x; }
inline int sqr(int x){ return x*x; }
inline double sqr(double x){ return x*x; }
ll gcd(ll a,ll b){ return b==0? a: gcd(b,a%b); }
ll exgcd(ll a,ll b,ll &x,ll &y){ ll d; (b==0? (x=1,y=0,d=a): (d=exgcd(b,a%b,y,x),y-=a/b*x)); return d; }
ll qpow(ll a,ll n){ll sum=1;while(n){if(n&1)sum=sum*a%MOD;a=a*a%MOD;n>>=1;}return sum;}
inline int dcmp(double x){  if(fabs(x)<eps) return 0;   return (x>0? 1: -1); }

vector<int>st;
vector<int>ans[MAXN];

int main(void)
{
    // ios::sync_with_stdio(false);    cin.tie(0);   cout.tie(0);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.in","r",stdin);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.out","w",stdout);
 	int n,k,tot=0,cur=0;	string s;	cin>>n>>k>>s;
 	for(int i=0,l=0,r=0;i<n;i++){
 		if(s[i]=='R')	r++;
 		else	l++,tot+=r;
 	}
 	if(k>tot)	return cout<<-1<<endl,0;
 	for(int i=1;i<n;i++)
 		if(s[i-1]=='R'&&s[i]=='L')
 			st.pb(i);
 	while(k!=tot){
 		k--;
 		vector<int>nx;
 		for(int i=0;i<(int)st.size()&&k!=tot;i++,tot--){
 			int j=st[i];
 			ans[cur].pb(j);
 			swap(s[j-1],s[j]);
 			if(j>=2&&s[j-2]=='R')	nx.pb(j-1);
 			if(j+1<n&&s[j+1]=='L')	nx.pb(j+1);
 		}
 		cur++;
 		st=nx;
 	}
 	for(int i=1;i<n;i++){
 		int j=i;
 		while(j&&s[j-1]=='R'&&s[j]=='L')	swap(s[j-1],s[j]),ans[cur].pb(j),cur++,j--;
 	}
 	for(int i=0;i<cur;i++){
 		printf("%d",ans[i].size());
 		for(int j=0;j<(int)ans[i].size();j++)	printf(" %d",ans[i][j]);
 		puts("");
 	}
    return 0;
}


//      ——By DD_BOND

#include<bits/stdc++.h>

#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define INF 0x3f3f3f3f
#define pi 3.1415926535898
#define lowbit(a)  (a&(-a))
#define lson l,(l+r)/2,rt<<1
#define rson (l+r)/2+1,r,rt<<1|1
#define Min(a,b,c)  min(a,min(b,c))
#define Max(a,b,c)  max(a,max(b,c))
#define debug(x)  cerr<<#x<<"="<<x<<"\n";

//#pragma GCC optimize(3)
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef unsigned long long ull;

const int seed=131;
const ll LLMAX=2e18;
const int MOD=1e9+7;
const double eps=1e-8;
const int MAXN=3e6+10;
const int hmod1=0x48E2DCE7;
const int hmod2=0x60000005;

inline ll sqr(ll x){ return x*x; }
inline int sqr(int x){ return x*x; }
inline double sqr(double x){ return x*x; }
ll gcd(ll a,ll b){ return b==0? a: gcd(b,a%b); }
ll exgcd(ll a,ll b,ll &x,ll &y){ ll d; (b==0? (x=1,y=0,d=a): (d=exgcd(b,a%b,y,x),y-=a/b*x)); return d; }
ll qpow(ll a,ll n){ll sum=1;while(n){if(n&1)sum=sum*a%MOD;a=a*a%MOD;n>>=1;}return sum;}
inline int dcmp(double x){  if(fabs(x)<eps) return 0;   return (x>0? 1: -1); }

vector<int>st;
vector<int>ans[MAXN];

int main(void)
{
    // ios::sync_with_stdio(false);    cin.tie(0);   cout.tie(0);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.in","r",stdin);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.out","w",stdout);
 	int n,k,tot=0,cur=0;	string s;	cin>>n>>k>>s;
 	for(int i=0,l=0,r=0;i<n;i++){
 		if(s[i]=='R')	r++;
 		else	l++,tot+=r;
 	}
 	if(k>tot)	return cout<<-1<<endl,0;
 	for(int i=1;i<n;i++)
 		if(s[i-1]=='R'&&s[i]=='L')
 			st.pb(i);
 	while(k!=tot){
 		k--;
 		vector<int>nx;
 		for(int i=0;i<(int)st.size()&&k!=tot;i++,tot--){
 			int j=st[i];
 			ans[cur].pb(j);
 			swap(s[j-1],s[j]);
 			if(j>=2&&s[j-2]=='R')	nx.pb(j-1);
 			if(j+1<n&&s[j+1]=='L')	nx.pb(j+1);
 		}
 		if(k==0)	break;
 		cur++;
 		st=nx;
 	}
 	if(k!=tot)	return cout<<-1<<endl,0;
 	for(int i=1;i<n;i++){
 		int j=i;
 		while(j&&s[j-1]=='R'&&s[j]=='L')	swap(s[j-1],s[j]),ans[cur].pb(j),cur++,j--;
 	}
 	for(int i=0;i<cur;i++){
 		printf("%d",ans[i].size());
 		for(int j=0;j<(int)ans[i].size();j++)	printf(" %d",ans[i][j]);
 		puts("");
 	}
    return 0;
}


//      ——By DD_BOND

#include<bits/stdc++.h>

#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define INF 0x3f3f3f3f
#define pi 3.1415926535898
#define lowbit(a)  (a&(-a))
#define lson l,(l+r)/2,rt<<1
#define rson (l+r)/2+1,r,rt<<1|1
#define Min(a,b,c)  min(a,min(b,c))
#define Max(a,b,c)  max(a,max(b,c))
#define debug(x)  cerr<<#x<<"="<<x<<"\n";

//#pragma GCC optimize(3)
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef unsigned long long ull;

const int seed=131;
const ll LLMAX=2e18;
const int MOD=1e9+7;
const double eps=1e-8;
const int MAXN=1e6+10;
const int hmod1=0x48E2DCE7;
const int hmod2=0x60000005;

inline ll sqr(ll x){ return x*x; }
inline int sqr(int x){ return x*x; }
inline double sqr(double x){ return x*x; }
ll gcd(ll a,ll b){ return b==0? a: gcd(b,a%b); }
ll exgcd(ll a,ll b,ll &x,ll &y){ ll d; (b==0? (x=1,y=0,d=a): (d=exgcd(b,a%b,y,x),y-=a/b*x)); return d; }
ll qpow(ll a,ll n){ll sum=1;while(n){if(n&1)sum=sum*a%MOD;a=a*a%MOD;n>>=1;}return sum;}
inline int dcmp(double x){  if(fabs(x)<eps) return 0;   return (x>0? 1: -1); }

vector<int>st;
vector<int>ans[MAXN];

int main(void)
{
    ios::sync_with_stdio(false);    cin.tie(0);   cout.tie(0);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.in","r",stdin);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.out","w",stdout);
 	int n,k,tot=0,cur=0;	string s;	cin>>n>>k>>s;
 	for(int i=0,l=0,r=0;i<n;i++){
 		if(s[i]=='R')	r++;
 		else	l++,tot+=r;
 	}
 	if(k>tot)	return cout<<-1<<endl,0;
 	for(int i=1;i<n;i++)
 		if(s[i-1]=='R'&&s[i]=='L')
 			st.pb(i);
 	while(k!=tot){
 		k--;
 		vector<int>nx;
 		for(int i=0;i<(int)st.size()&&k!=tot;i++,tot--){
 			int j=st[i];
 			ans[cur].pb(j);
 			swap(s[j-1],s[j]);
 			if(j>=2&&s[j-2]=='R')	nx.pb(j-1);
 			if(j+1<n&&s[j+1]=='L')	nx.pb(j+1);
 		}
 		cur++;
 		st=nx;
 	}
 	for(int i=1;i<n;i++){
 		int j=i;
 		while(j&&s[j-1]=='R'&&s[j]=='L')	swap(s[j-1],s[j]),ans[cur].pb(j),cur++,j--;
 	}
 	for(int i=0;i<cur;i++){
 		cout<<ans[i].size();
 		for(int j=0;j<(int)ans[i].size();j++)	cout<<' '<<ans[i][j];
 		cout<<endl;
 	}
    return 0;
}


//      ——By DD_BOND

#include<bits/stdc++.h>

#define fi first
#define se second
#define MP make_pair
#define pb push_back
#define INF 0x3f3f3f3f
#define pi 3.1415926535898
#define lowbit(a)  (a&(-a))
#define lson l,(l+r)/2,rt<<1
#define rson (l+r)/2+1,r,rt<<1|1
#define Min(a,b,c)  min(a,min(b,c))
#define Max(a,b,c)  max(a,max(b,c))
#define debug(x)  cerr<<#x<<"="<<x<<"\n";

//#pragma GCC optimize(3)
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;

typedef long long ll;
typedef pair<int,int> P;
typedef pair<ll,ll> Pll;
typedef unsigned long long ull;

const int seed=131;
const ll LLMAX=2e18;
const int MOD=1e9+7;
const double eps=1e-8;
const int MAXN=3e6+10;
const int hmod1=0x48E2DCE7;
const int hmod2=0x60000005;

inline ll sqr(ll x){ return x*x; }
inline int sqr(int x){ return x*x; }
inline double sqr(double x){ return x*x; }
ll gcd(ll a,ll b){ return b==0? a: gcd(b,a%b); }
ll exgcd(ll a,ll b,ll &x,ll &y){ ll d; (b==0? (x=1,y=0,d=a): (d=exgcd(b,a%b,y,x),y-=a/b*x)); return d; }
ll qpow(ll a,ll n){ll sum=1;while(n){if(n&1)sum=sum*a%MOD;a=a*a%MOD;n>>=1;}return sum;}
inline int dcmp(double x){  if(fabs(x)<eps) return 0;   return (x>0? 1: -1); }

vector<int>st;
vector<int>ans[MAXN];

int main(void)
{
    ios::sync_with_stdio(false);    cin.tie(0);   cout.tie(0);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.in","r",stdin);
    //freopen("/Users/dd_bond/My_Mac/Resource/Project__C++/testdata.out","w",stdout);
 	int n,k,tot=0,cur=0;	string s;	cin>>n>>k>>s;
 	for(int i=0,l=0,r=0;i<n;i++){
 		if(s[i]=='R')	r++;
 		else	l++,tot+=r;
 	}
 	if(k>tot)	return cout<<-1<<endl,0;
 	for(int i=1;i<n;i++)
 		if(s[i-1]=='R'&&s[i]=='L')
 			st.pb(i);
 	while(k!=tot){
 		k--;
 		vector<int>nx;
 		for(int i=0;i<(int)st.size()&&k!=tot;i++,tot--){
 			int j=st[i];
 			ans[cur].pb(j);
 			swap(s[j-1],s[j]);
 			if(j>=2&&s[j-2]=='R')	nx.pb(j-1);
 			if(j+1<n&&s[j+1]=='L')	nx.pb(j+1);
 		}
 		cur++;
 		st=nx;
 	}
 	for(int i=1;i<n;i++){
 		int j=i;
 		while(j&&s[j-1]=='R'&&s[j]=='L')	swap(s[j-1],s[j]),ans[cur].pb(j),cur++,j--;
 	}
 	for(int i=0;i<cur;i++){
 		cout<<ans[i].size();
 		for(int j=0;j<(int)ans[i].size();j++)	cout<<' '<<ans[i][j];
 		cout<<endl;
 	}
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn = 3010;
int a[maxn];
int b[maxn];
int tmp[maxn];
int main(void){
	int n,k;
	cin >> n >> k;
	for(int i = 1; i <= n; i++){
		char ch;
		cin >> ch;
		a[i] = ch=='R'?1:0;
		b[i] = a[i];
	}
	int maxx = 0;
	int minn = 0;
	while(1){
		bool flag = 0;
		for(int i = 1; i < n; i++){   //将每一趟中的RL交换，记录交换次数
			if(a[i]==1&&a[i+1]==0){
				swap(a[i],a[i+1]);
				i++;
				maxx++;
				flag = 1;
			}
		}
		if(flag==0) break;
		minn++;                    //表示一趟中的多次交换次数可以一下完成。
	}
	if(k<minn||k>maxx){
		cout<<-1<<endl;
		return 0;
	}
	while(1){
		int i = 1;
		for(; i < n; i++){
			if(k==minn) break;
			if(b[i]==1&&b[i+1]==0){
				swap(b[i],b[i+1]);
				k--;
				cout<<"1"<<" "<<i<<endl;
				i++;
			}
		}
		int cnt = 0;
		for(; i < n; i++){
			if(b[i]==1&&b[i+1]==0){
				swap(b[i],b[i+1]);
				tmp[cnt++] = i;
				i++;
			}
		}
		if(cnt){
			cout<<cnt<<" "<<endl;
			for(int j = 0; j < cnt; j++) cout<<tmp[j]<<" ";
			cout<<endl;
			k--;
		}
		minn--;
		if(k==0) break;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,m,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
char ch[maxn];
int main(void)
{
   	cin >> n >> m;
    for ( int i=1;i<=n;i++ )
    {
    	char ch;
    	cin >> ch;
        a[i]=(ch=='R')?1:-1;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==-1)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(!flg) break;
        minn++;
    }
    if(m < minn||m > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(m==minn) break;
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                m--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            m--;
            puts("");
        }
        minn--;
        if(!m) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
int main(void)
{
   	cin >> n >> k;
    for(int i = 1;i <= n;i++)
    {
    	char ch;
    	cin >> ch;
        a[i] = (ch=='R')?1:0;
        b[i] = a[i];
    }
    while(1)
    {
        int flag = 0;
        for (int i = 1; i < n; i++)
            if(a[i]==1&&a[i+1]==0)
            {
                flag = 1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(!flag) break;
        minn++;
    }
    if(k < minn||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {
        int i = 1;
        for(;i < n; i++)
        {
            if(k==minn) break;
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                k--;
                cout<<1<<" "<<i<<endl;
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            k--;
            puts("");
        }
        minn--;
        if(!k) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
int main(void)
{
   	cin >> n >> k;
    for(int i = 1;i <= n;i++)
    {
    	char ch;
    	cin >> ch;
        a[i]=(ch=='R')?1:0;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==0)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(!flg) break;
        minn++;
    }
    if(k < minn||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(k==minn) break;
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                k--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            k--;
            puts("");
        }
        minn--;
        if(!k) break;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;

const int N=3005;

int n,m,ans,a[N],b[N],tmp[N],mi,mx;
char ch[N];

int main()
{
   cin >> n >> m;
    scanf("%s",ch+1);
    for ( int i=1;i<=n;i++ )
    {
        a[i]=(ch[i]=='R')?1:-1;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==-1)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                mx++;
            }
        if(!flg) break;
        mi++;
    }
    if(m<mi||m>mx) return printf("-1\n"),0;
//    for ( int i=1;i<=n;i++ ) a[i]=b[i];
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(m==mi) break;
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                m--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            m--;
            puts("");
        }
        mi--;
        if(!m) break;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;

inline int read()
{
    int sum=0,ff=1; char ch=getchar();
    while(!isdigit(ch))
    {
        if(ch=='-') ff=-1;
        ch=getchar();
    }
    while(isdigit(ch))
        sum=sum*10+(ch^48),ch=getchar();
    return sum*ff;
}

const int N=3005;

int n,m,ans,a[N],b[N],tmp[N],mi,mx;
char ch[N];

int main()
{
    n=read();
    m=read();
    scanf("%s",ch+1);
    for ( int i=1;i<=n;i++ )
    {
        a[i]=(ch[i]=='R')?1:-1;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==-1)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                mx++;
            }
        if(!flg) break;
        mi++;
    }
    if(m<mi||m>mx) return printf("-1\n"),0;
    for ( int i=1;i<=n;i++ ) a[i]=b[i];
    while(1)
    {
        for(int i = 1;i<n;++i)
        {
            if(m==mi) break;
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                m--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(int i = 1;i<n;++i)
        {
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            m--;
            puts("");
        }
        mi--;
        if(!m) break;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;

const int N=3005;

int n,m,ans,a[N],b[N],tmp[N],mi,mx;
char ch[N];

int main()
{
   cin >> n >> m;
    scanf("%s",ch+1);
    for ( int i=1;i<=n;i++ )
    {
        a[i]=(ch[i]=='R')?1:-1;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==-1)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                mx++;
            }
        if(!flg) break;
        mi++;
    }
    if(m<mi||m>mx) return printf("-1\n"),0;
    for ( int i=1;i<=n;i++ ) a[i]=b[i];
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(m==mi) break;
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                m--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            m--;
            puts("");
        }
        mi--;
        if(!m) break;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;

const int N=3005;

int n,m,ans,a[N],b[N],tmp[N],mi,mx;
char ch[N];

int main()
{
   cin >> n >> m;
    scanf("%s",ch+1);
    for ( int i=1;i<=n;i++ )
    {
        a[i]=(ch[i]=='R')?1:-1;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==-1)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                mx++;
            }
        if(!flg) break;
        mi++;
    }
    if(m<mi||m>mx) return printf("-1\n"),0;
//    for ( int i=1;i<=n;i++ ) a[i]=b[i];
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(m==mi) break;
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                m--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            m--;
            puts("");
        }
        mi--;
        if(!m) break;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;

const int N=3005;

int n,m,ans,a[N],b[N],tmp[N],mi,mx;
char ch[N];

int main()
{
   cin >> n >> m;
    scanf("%s",ch+1);
    for ( int i=1;i<=n;i++ )
    {
        a[i]=(ch[i]=='R')?1:-1;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==-1)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                mx++;
            }
        if(!flg) break;
        mi++;
    }
    if(m<mi||m>mx) return printf("-1\n"),0;
//    for ( int i=1;i<=n;i++ ) a[i]=b[i];
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(m==mi) break;
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                m--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            m--;
            puts("");
        }
        mi--;
        if(!m) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e4;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minx,maxx;
char ch[maxn];
int main(void)
{
   	cin >> n >> k;
    scanf("%s",ch+1);
    for(int i = 1; i <= n; i++)
    {
        a[i] = (ch[i]=='R')?1:0;
        b[i] = a[i];
    }
    while(1)
    {
        int flag = 0;
        for( int i = 1;i < n; i++)
            if(a[i]==1&&a[i+1]==0)
            {
                flag = 1;
                swap(a[i],a[i+1]);
//                i++;
                maxx++;
            }
        if(flag==0) break;
        minx++;
    }
    if(k < minx||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    for(int i = 1; i <= n; i++) a[i] = b[i];
    while(1)
    {
        int i = 1;
        for(; i < n; i++)
        {
            if(k==minx) break;
            if(a[i]==1&&a[i+1]==0)
            {
                swap(a[i],a[i+1]);
                k--;
                cout<<"1"<<" "<<i<<endl;
//                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                tmp[++gs]=i;
//                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            k--;
            puts("");
        }
        minx--;
        if(k==0) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
int main(void)
{
   	cin >> n >> k;
    for(int i = 1;i <= n;i++)
    {
    	char ch;
    	cin >> ch;
        a[i]=(ch=='R')?1:0;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==0)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(!flg) break;
        minn++;
    }
    if(k < minn||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(k==minn) break;
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                k--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            k--;
            puts("");
        }
        minn--;
        if(!k) break;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
const int maxn = 3010;
int a[maxn];
int b[maxn];
int tmp[maxn];
int main(void){
	int n,k;
	cin >> n >> k;
	for(int i = 1; i <= n; i++){
		char ch;
		cin >> ch;
		a[i] = ch=='R'?1:0;
		b[i] = a[i];
	}
	int maxx = 0;
	int minn = 0;
	while(1){
		bool flag = 0;
		for(int i = 1; i <= n-1; i++){   //将每一趟中的RL交换，记录交换次数
			if(a[i]==1&&a[i+1]==0){
				swap(a[i],a[i+1]);
				i++;
				maxx++;
				flag = 1;
			}
		}
		if(flag==0) break;
		minn++;                    //表示一趟中的多次交换次数可以一下完成。
	}
	if(k<minn||k>maxx){
		cout<<-1<<endl;
		return 0;
	}
	while(1){
		int i = 1;
		for(; i < n; i++){
			if(k==minn) break;
			if(b[i]==1&&b[i+1]==0){
				swap(b[i],b[i+1]);
				k--;
				cout<<"1"<<" "<<i<<endl;
				i++;
			}
		}
		int cnt = 0;
		for(; i < n; i++){
			if(b[i]==1&&b[i+1]==0){
				swap(b[i],b[i+1]);
				tmp[cnt++] = i;
				i++;
			}
		}
		if(cnt){
			cout<<cnt<<" "<<endl;
			for(int i = 0; i < cnt; i++) cout<<tmp[i]<<" ";
			cout<<endl;
			k--;
		}
		minn--;
		if(k==0) break;
	}
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
int main(void)
{
   	cin >> n >> k;
    for(int i = 1;i <= n;i++)
    {
    	char ch;
    	cin >> ch;
        a[i] = (ch=='R')?1:0;
        b[i] = a[i];
    }
    while(1)
    {
        int flag = 0;
        for (int i = 1; i < n; i++)
            if(a[i]==1&&a[i+1]==0)
            {
                flag = 1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(!flag) break;
        minn++;
    }
    if(k < minn||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {
        int i = 1;
        for(;i < n; i++)
        {
            if(k==minn) break;
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                k--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            k--;
            puts("");
        }
        minn--;
        if(!k) break;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;

const int N=3005;

int n,m,ans,a[N],b[N],tmp[N],mi,mx;
char ch[N];

int main()
{
   cin >> n >> m;
    scanf("%s",ch+1);
    for ( int i=1;i<=n;i++ )
    {
        a[i]=(ch[i]=='R')?1:-1;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==-1)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                mx++;
            }
        if(!flg) break;
        mi++;
    }
    if(m<mi||m>mx) return printf("-1\n"),0;
//    for ( int i=1;i<=n;i++ ) a[i]=b[i];
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(m==mi) break;
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                m--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            m--;
            puts("");
        }
        mi--;
        if(!m) break;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;

inline int read()
{
    int sum=0,ff=1; char ch=getchar();
    while(!isdigit(ch))
    {
        if(ch=='-') ff=-1;
        ch=getchar();
    }
    while(isdigit(ch))
        sum=sum*10+(ch^48),ch=getchar();
    return sum*ff;
}

const int N=3005;

int n,m,ans,a[N],b[N],tmp[N],mi,mx;
char ch[N];

int main()
{
    n=read();
    m=read();
    scanf("%s",ch+1);
    for ( int i=1;i<=n;i++ )
    {
        a[i]=(ch[i]=='R')?1:-1;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==-1)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                mx++;
            }
        if(!flg) break;
        mi++;
    }
    if(m<mi||m>mx) return printf("-1\n"),0;
    for ( int i=1;i<=n;i++ ) a[i]=b[i];
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(m==mi) break;
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                m--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            m--;
            puts("");
        }
        mi--;
        if(!m) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
int main(void)
{
   	cin >> n >> k;
    for(int i = 1;i <= n;i++)
    {
    	char ch;
    	cin >> ch;
        a[i] = (ch=='R')?1:0;
        b[i] = a[i];
    }
    while(1)
    {
        int flag = 0;
        for (int i = 1; i < n; i++)
            if(a[i]==1&&a[i+1]==0)
            {
                flag = 1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(!flag) break;
        minn++;
    }
    if(k < minn||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {

        for(int i = 1;i < n; i++)
        {
            if(k==minn) break;
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                k--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int cnt = 0;
        for(int i = 1; i < n; i++)
        {
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                tmp[++cnt] = i;
                i++;
            }
        }
        if(cnt)
        {
            printf("%d ",cnt);
            for (int j = 1; j <= cnt; j++) printf("%d ",tmp[j]);
            k--;
            puts("");
        }
        minn--;
        if(!k) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
char ch[maxn];
int main(void)
{
   	cin >> n >> k;
    for(int i = 1; i <= n; i++)
    {
    	char ch;
    	cin >> ch;
        a[i] = (ch=='R')?1:0;
        b[i] = a[i];
    }
    while(1)
    {
        int flag = 0;
        for(int i = 1; i < n; i++)
            if(a[i]==1&&a[i+1]==-1){
                flag = 1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(flag==0) break;
        minn++;
    }
    if(k < minn||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(k==minn) break;
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                k--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            k--;
            puts("");
        }
        minn--;
        if(!k) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
int main(void)
{
   	cin >> n >> k;
    for(int i = 1;i <= n;i++)
    {
    	char ch;
    	cin >> ch;
        a[i] = (ch=='R')?1:0;
        b[i] = a[i];
    }
    while(1)
    {
        int flag = 0;
        for (int i = 1; i < n; i++)
            if(a[i]==1&&a[i+1]==0)
            {
                flag = 1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(!flag) break;
        minn++;
    }
    if(k < minn||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {
        int i = 1;
        for(;i < n; i++)
        {
            if(k==minn) break;
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                k--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int cnt = 0;
        for(; i < n; i++)
        {
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                tmp[++cnt] = i;
                i++;
            }
        }
        if(cnt)
        {
            printf("%d ",cnt);
            for (int j = 1; j <= cnt; j++) printf("%d ",tmp[j]);
            k--;
            puts("");
        }
        minn--;
        if(!k) break;
    }
    return 0;
}


#include <bits/stdc++.h>
#define pb push_back
using namespace std;

inline int read()
{
    int sum=0,ff=1; char ch=getchar();
    while(!isdigit(ch))
    {
        if(ch=='-') ff=-1;
        ch=getchar();
    }
    while(isdigit(ch))
        sum=sum*10+(ch^48),ch=getchar();
    return sum*ff;
}

const int N=3005;

int n,m,ans,a[N],b[N],tmp[N],mi,mx;
char ch[N];

int main()
{
    n=read();
    m=read();
    scanf("%s",ch+1);
    for ( int i=1;i<=n;i++ )
    {
        a[i]=(ch[i]=='R')?1:-1;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==-1)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                mx++;
            }
        if(!flg) break;
        mi++;
    }
    if(m<mi||m>mx) return printf("-1\n"),0;
    for ( int i=1;i<=n;i++ ) a[i]=b[i];
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(m==mi) break;
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                m--;
                printf("%d %d",1,i);
                puts("");
//                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(a[i]==1&&a[i+1]==-1)
            {
                swap(a[i],a[i+1]);
                tmp[++gs]=i;
//                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            m--;
            puts("");
        }
        mi--;
        if(!m) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
char ch[maxn];
int main(void)
{
   	cin >> n >> k;
    for(int i = 1; i <= n; i++)
    {
    	char ch;
    	cin >> ch;
        a[i] = (ch=='R')?1:0;
        b[i] = a[i];
    }
    while(1)
    {
        int flag = 0;
        for(int i = 1; i < n; i++)
            if(a[i]==1&&a[i+1]==-1){
                flag = 1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(flag==0) break;
        minn++;
    }
    if(k < minn||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {
        int i = 1;
        for(; i < n; i++)
        {
            if(k==minn) break;
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                k--;
                cout<<1<<" "<<i<<endl;
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            k--;
            puts("");
        }
        minn--;
        if(!k) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
int main(void)
{
   	cin >> n >> k;
    for(int i = 1;i <= n;i++)
    {
    	char ch;
    	cin >> ch;
        a[i] = (ch=='R')?1:0;
        b[i] = a[i];
    }
    while(1)
    {
        int flag = 0;
        for (int i = 1; i < n; i++)
            if(a[i]==1&&a[i+1]==0)
            {
                flag = 1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(!flag) break;
        minn++;
    }
    if(k < minn||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {
        int i = 1;
        for(;i < n; i++)
        {
            if(k==minn) break;
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                k--;
                cout<<1<<" "<<i<<endl;
//                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(b[i]==1&&b[i+1]==0)
            {
                swap(b[i],b[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            k--;
            puts("");
        }
        minn--;
        if(!k) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
int main(void)
{
   	cin >> n >> k;
    for ( int i=1;i<=n;i++ )
    {
    	char ch;
    	cin >> ch;
        a[i]=(ch=='R')?1:-1;
        b[i]=a[i];
    }
    while(1)
    {
        int flg=0;
        for ( int i=1;i<n;i++ )
            if(a[i]==1&&a[i+1]==-1)
            {
                flg=1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(!flg) break;
        minn++;
    }
    if(k < minn||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {
        int i=1;
        for(;i<n;++i)
        {
            if(k==minn) break;
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                k--;
                printf("%d %d",1,i);
                puts("");
                i++;
            }
        }
        int gs=0;
        for(;i<n;++i)
        {
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                tmp[++gs]=i;
                i++;
            }
        }
        if(gs)
        {
            printf("%d ",gs);
            for ( int j=1;j<=gs;j++ ) printf("%d ",tmp[j]);
            k--;
            puts("");
        }
        minn--;
        if(!k) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int maxn = 3005;
int n,k,ans,a[maxn],b[maxn],tmp[maxn],minn,maxx;
char ch[maxn];
int main(void)
{
   	cin >> n >> k;
    for(int i = 1; i <= n; i++)
    {
    	char ch;
    	cin >> ch;
        a[i] = (ch=='R')?1:0;
        b[i] = a[i];
    }
    while(1)
    {
        int flag = 0;
        for(int i = 1; i < n; i++)
            if(a[i]==1&&a[i+1]==-1){
                flag = 1;
                swap(a[i],a[i+1]);
                i++;
                maxx++;
            }
        if(flag==0) break;
        minn++;
    }
    if(k < minn||k > maxx){
    	cout<<-1<<endl;
    	return 0;
	}
    while(1)
    {
        int i = 1;
        for(; i < n; i++)
        {
            if(k==minn) break;
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                k--;
                cout<<1<<" "<<i<<endl;
                i++;
            }
        }
        int cnt = 0;
        for(; i < n; i++)
        {
            if(b[i]==1&&b[i+1]==-1)
            {
                swap(b[i],b[i+1]);
                tmp[cnt++] = i;
                i++;
            }
        }
        if(cnt)
        {
            cout<<cnt<<" ";
            for(int j = 1; j <= cnt; j++) cout<<tmp[j]<<" ";
            k--;
            puts("");
        }
        minn--;
        if(!k) break;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-5;
const int N = 1e5 + 10;

void redirect() {
    #ifdef LOCAL
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
}

int n,k;
int mini = 0, maxi = 0;
char s[N]; int a[N];

int main() {
    redirect();

    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) {
        if(s[i]=='L') a[i] = 0;
        else a[i] = 1;
    }

    int cnt = 0, last = 0;
    for(int i=1;i<=n;i++) {
        if(a[i]==1) {
            cnt++;
        } else {
            if(cnt==0) continue;
            maxi += cnt;
            if(last) mini ++;
            else mini = max( mini, cnt );
        }
        last = a[i];
    }

    if(k<mini || k>maxi) {
        puts("-1");
        return 0;
    }

    queue<int> Q; bool f = 1;
    for(int i=k;i>=1;i--) {
        //cout<<i << " "<< maxi<<endl;
        if( maxi == i ) {
            if(f) {
                f = 0;
                while(!Q.empty()) Q.pop();
                for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            }
            int x = Q.front(); Q.pop();
            printf("1 %d\n",x);
            a[x] = 0; a[x+1] = 1;
            if (x - 1 >= 1 && a[x - 1] == 1) { Q.push(x - 1); }
            if (x + 2 <= n && a[x + 2] == 0) { Q.push(x + 1); }

        } else {
            while(!Q.empty()) Q.pop();
            for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            int times = min((int)Q.size(), maxi-(i-1) );
            maxi -= times;
            printf("%d ",times);
            for(int j=1;j<=times;j++) {
                int x = Q.front(); Q.pop();
                printf("%d ",x);
                a[x] = 0; a[x+1] = 1;
            }
            printf("\n");
        }
    }

    return 0;
}

/*
-----------------
author:dragon_bra
-----------------
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-5;
const int N = 1e5 + 10;

void redirect() {
    #ifdef LOCAL
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
}

int n,k; int lcnt;
char s[N]; int a[N];

int main() {
    redirect();

    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) {
        if(s[i]=='L') a[i] = 0;
        else a[i] = 1;
    }

    int mini = 0, maxi = 0;
    int cnt = 0, last = 0;
    for(int i=1;i<=n;i++) {
        if(a[i]==1) {
            cnt++;
        } else {
            if(cnt==0) continue;
            maxi += cnt;
            if(last) mini ++;
            else mini = max( mini, cnt );
        }
        last = a[i];
    }

    if(k<mini || k>maxi) {
        puts("-1");
        return 0;
    }

    queue<int> Q; bool f = 1;
    for(int i=k;i>=1;i--) {
        //cout<<i << " "<< maxi<<endl;
        if( maxi == i ) {
            if(f) {
                f = 0;
                while(!Q.empty()) Q.pop();
                for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            }
            int x = Q.front(); Q.pop();
            printf("1 %d\n",x);
            a[x] = 0; a[x+1] = 1;
            if (x > 0 && a[x - 1] == 1) { Q.push(x - 1); }
            if (x + 2 < n && a[x + 2] == 0) { Q.push(x + 1); }
        } else {
            while(!Q.empty()) Q.pop();
            for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            int times = min((int)Q.size(), maxi-(i-1) );
            maxi -= times;
            printf("%d ",times);
            for(int j=1;j<=times;j++) {
                int x = Q.front(); Q.pop();
                printf("%d ",x);
                a[x] = 0; a[x+1] = 1;
            }
            printf("\n");
        }
    }

    return 0;
}

/*
-----------------
author:dragon_bra
-----------------
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-5;
const int N = 1e5 + 10;

void redirect() {
    #ifdef LOCAL
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
}

int n,k; int lcnt;
char s[N]; int a[N];

int main() {
    redirect();

    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) {
        if(s[i]=='L') a[i] = 0;
        else a[i] = 1;
    }

    int mini = 0, maxi = 0;
    int cnt = 0, last = 0;
    for(int i=1;i<=n;i++) {
        if(a[i]==1) {
            cnt++;
        } else {
            if(cnt==0) continue;
            maxi += cnt;
            if(last) mini ++;
            else mini = max( mini, cnt );
        }
        last = a[i];
    }

    if(k<mini || k>maxi) {
        puts("-1");
        return 0;
    }

    for(int i=k;i>=1;i--) {
        queue<int> Q;
        while(!Q.empty()) Q.pop();
        for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
        int times = min((int)Q.size(), maxi-(i-1) );
        maxi -= times;
        printf("%d ",times);
        for(int j=1;j<=times;j++) {
            int x = Q.front(); Q.pop();
            printf("%d ",x);
            a[x] = 0; a[x+1] = 1;
        }
        printf("\n");
    }

    return 0;
}

/*
-----------------
author:dragon_bra
-----------------
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-5;
const int N = 1e5 + 10;

void redirect() {
    #ifdef LOCAL
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
}

int n,k;
int mini = 0, maxi = 0;
char s[N]; int a[N];

int main() {
    redirect();

    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) {
        if(s[i]=='L') a[i] = 0;
        else a[i] = 1;
    }

    int cnt = 0, last = 0;
    for(int i=1;i<=n;i++) {
        if(a[i]==1) {
            cnt++;
        } else {
            if(cnt==0) continue;
            maxi += cnt;
            if(last) mini ++;
            else mini = max( mini, cnt );
        }
        last = a[i];
    }

    if(k<mini || k>maxi) {
        puts("-1");
        return 0;
    }

    queue<int> Q; bool f = 1;
    for(int i=k;i>=1;) {
        int times = 1;
        //cout<<i << " "<< maxi<<endl;
        if( maxi == i ) {

            if(f) {
                f = 0;
                while(!Q.empty()) Q.pop();
                for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            }

            int x = Q.front(); Q.pop();
            printf("1 %d\n",x);
            a[x] = 0; a[x+1] = 1;
            if (x - 1 >= 1 && a[x - 1] == 1) { Q.push(x - 1); }
            if (x + 2 <= n && a[x + 2] == 0) { Q.push(x + 1); }

        } else {

            while(!Q.empty()) Q.pop();
            for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            times = min((int)Q.size(), maxi-(i-1) );
            maxi -= times;
            printf("%d ",times);
            for(int j=1;j<=times;j++) {
                int x = Q.front(); Q.pop();
                printf("%d ",x);
                a[x] = 0; a[x+1] = 1;
            }
            printf("\n");

        }

        i -= times;
    }

    return 0;
}

/*
-----------------
author:dragon_bra
-----------------
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-5;
const int N = 1e5 + 10;

void redirect() {
    #ifdef LOCAL
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
}

int n,k; int lcnt;
char s[N]; int a[N];

int main() {
    redirect();

    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) {
        if(s[i]=='L') a[i] = 0;
        else a[i] = 1;
    }

    int mini = 0, maxi = 0;
    int cnt = 0, last = 0;
    for(int i=1;i<=n;i++) {
        if(a[i]==1) {
            cnt++;
        } else {
            if(cnt==0) continue;
            maxi += cnt;
            if(last) mini ++;
            else mini = max( mini, cnt );
        }
        last = a[i];
    }

    if(k<mini || k>maxi) {
        puts("-1");
        return 0;
    }

    queue<int> Q; bool f = 1;
    for(int i=k;i>=1;i--) {
        //cout<<i << " "<< maxi<<endl;
        if( maxi == i ) {
            if(f) {
                f = 0;
                while(!Q.empty()) Q.pop();
                for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            }
            int x = Q.front(); Q.pop();
            printf("1 %d",x);
            a[x] = 0; a[x+1] = 1;
            if (x > 0 && a[x - 1] == 1) { Q.push(x - 1); }
            if (x + 2 < n && a[x + 2] == 0) { Q.push(x + 1); }
        } else {
            while(!Q.empty()) Q.pop();
            for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            int times = min((int)Q.size(), maxi-(i-1) );
            maxi -= times;
            printf("%d ",times);
            for(int j=1;j<=times;j++) {
                int x = Q.front(); Q.pop();
                printf("%d ",x);
                a[x] = 0; a[x+1] = 1;
            }
            printf("\n");
        }
    }

    return 0;
}

/*
-----------------
author:dragon_bra
-----------------
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-5;
const int N = 1e5 + 10;

void redirect() {
    #ifdef LOCAL
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
}

int n,k; int lcnt;
char s[N]; int a[N];

int main() {
    redirect();

    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) {
        if(s[i]=='L') a[i] = 0;
        else a[i] = 1;
    }

    int mini = 0, maxi = 0;
    int cnt = 0, last = 0;
    for(int i=1;i<=n;i++) {
        if(a[i]==1) {
            cnt++;
        } else {
            if(cnt==0) continue;
            maxi += cnt;
            if(last) mini ++;
            else mini = max( mini, cnt );
        }
        last = a[i];
    }

    if(k<mini || k>maxi) {
        puts("-1");
        return 0;
    }

    vector<int> Q;
    for(int i=k;i>=1;i--) {
        Q.clear();
        for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push_back(j);
        int times = min((int)Q.size(), maxi-(i-1) );
        maxi -= times;
        printf("%d ",times);
        for(int j=1;j<=times;j++) {
            int x = Q[j-1];
            printf("%d ",x);
            a[x] = 0; a[x+1] = 1;
        }
        printf("\n");
    }

    return 0;
}

/*
-----------------
author:dragon_bra
-----------------
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-5;
const int N = 1e5 + 10;

void redirect() {
    #ifdef LOCAL
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
}

int n,k; int lcnt;
char s[N]; int a[N];

int main() {
    redirect();

    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) {
        if(s[i]=='L') a[i] = 0;
        else a[i] = 1;
    }

    int mini = 0, maxi = 0;
    int cnt = 0, last = 0;
    for(int i=1;i<=n;i++) {
        if(a[i]==1) {
            cnt++;
        } else {
            if(cnt==0) continue;
            maxi += cnt;
            if(last) mini ++;
            else mini = max( mini, cnt );
        }
        last = a[i];
    }

    if(k<mini || k>maxi) {
        puts("-1");
        return 0;
    }

    vector<int> Q;
    for(int i=k;i>=1;i--) {
        for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push_back(j);
        int times = min((int)Q.size(), maxi-(i-1) );
        maxi -= times;
        printf("%d ",times);
        for(int j=1;j<=times;j++) {
            int x = Q[j-1];
            printf("%d ",x);
            a[x] = 0; a[x+1] = 1;
        }
        printf("\n");
    }

    return 0;
}

/*
-----------------
author:dragon_bra
-----------------
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-5;
const int N = 1e5 + 10;

void redirect() {
    #ifdef LOCAL
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
}

int n,k;
int mini = 0, maxi = 0;
char s[N]; int a[N];

int main() {
    redirect();

    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) {
        if(s[i]=='L') a[i] = 0;
        else a[i] = 1;
    }

    int cnt = 0, last = 0;
    for(int i=1;i<=n;i++) {
        if(a[i]==1) {
            cnt++;
        } else {
            if(cnt==0) continue;
            maxi += cnt;
            if(last) mini ++;
            else mini = max( mini, cnt );
        }
        last = a[i];
    }

    if(k<mini || k>maxi) {
        puts("-1");
        return 0;
    }

    queue<int> Q; bool f = 1;
    for(int i=k;i>=1;) {
        int times = 1;
        //cout<<i << " "<< maxi<<endl;
        if( maxi == i ) {

            if(f) {
                f = 0;
                while(!Q.empty()) Q.pop();
                for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            }

            int x = Q.front(); Q.pop();
            printf("1 %d\n",x);
            a[x] = 0; a[x+1] = 1;
            if (x - 1 >= 1 && a[x - 1] == 1) { Q.push(x - 1); }
            if (x + 2 <= n && a[x + 2] == 0) { Q.push(x + 1); }
            maxi -= 1;
        } else {

            while(!Q.empty()) Q.pop();
            for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            times = min((int)Q.size(), maxi-(i-1) );
            maxi -= times;
            printf("%d ",times);
            for(int j=1;j<=times;j++) {
                int x = Q.front(); Q.pop();
                printf("%d ",x);
                a[x] = 0; a[x+1] = 1;
            }
            printf("\n");

        }

    }

    return 0;
}

/*
-----------------
author:dragon_bra
-----------------
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-5;
const int N = 1e5 + 10;

void redirect() {
    #ifdef LOCAL
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
}

int n,k;
int mini = 0, maxi = 0;
char s[N]; int a[N];

int main() {
    redirect();

    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) {
        if(s[i]=='L') a[i] = 0;
        else a[i] = 1;
    }

    int cnt = 0, last = 0;
    for (int i = n; i >= 1; --i) {
        if (a[i] == 0) {
            ++cnt;
        } else {
            if (cnt == 0) continue;
            maxi += cnt;
            mini = max(cnt, last + 1);
            last = mini;
        }
    }

    if(k<mini || k>maxi) {
        puts("-1");
        return 0;
    }

    queue<int> Q; bool f = 0;
    for(int i=k;i>=1;i--) {
        //cout<<i << " "<< maxi<<endl;
        if( f ) {
            int x = Q.front(); Q.pop();
            printf("1 %d\n",x);
            a[x] = 0; a[x+1] = 1;
            if (x - 1 >= 1 && a[x - 1] == 1) { Q.push(x - 1); }
            if (x + 2 <= n && a[x + 2] == 0) { Q.push(x + 1); }

        } else {

            while(!Q.empty()) Q.pop();
            for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            int times = min((int)Q.size(), maxi-(i-1) );
            maxi -= times;
            printf("%d ",times);
            for(int j=1;j<=times;j++) {
                int x = Q.front(); Q.pop();
                printf("%d ",x);
                a[x] = 0; a[x+1] = 1;
            }
            printf("\n");

            if(maxi==i-1) {
                f = 1;
                while(!Q.empty()) Q.pop();
                for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            }

        }

    }

    return 0;
}

/*
-----------------
author:dragon_bra
-----------------
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-5;
const int N = 1e5 + 10;

void redirect() {
    #ifdef LOCAL
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
}

int n,k; int lcnt;
char s[N]; int a[N];

int main() {
    redirect();

    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) {
        if(s[i]=='L') a[i] = 0;
        else a[i] = 1;
    }

    int mini = 0, maxi = 0;
    int cnt = 0, last = 0;
    for(int i=1;i<=n;i++) {
        if(a[i]==1) {
            cnt++;
        } else {
            if(cnt==0) continue;
            maxi += cnt;
            if(last) mini ++;
            else mini = max( mini, cnt );
        }
        last = a[i];
    }

    if(k<mini || k>maxi) {
        puts("-1");
        return 0;
    }

    vector<int> Q;
    for(int i=k;i>=1;i--) {

        for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push_back(j);
        int times = min((int)Q.size(), maxi-(i-1) );
        maxi -= times;
        printf("%d ",times);
        for(int j=1;j<=times;j++) {
            int x = Q[j-1];
            printf("%d ",x);
            a[x] = 0; a[x+1] = 1;
        }
        printf("\n");
    }

    return 0;
}

/*
-----------------
author:dragon_bra
-----------------
*/


#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
const int INF = 0x3f3f3f3f;
const int mod = 1e9+7;
const double eps = 1e-5;
const int N = 1e5 + 10;

void redirect() {
    #ifdef LOCAL
        freopen("1.in","r",stdin);
        freopen("1.out","w",stdout);
    #endif
}

int n,k;
int mini = 0, maxi = 0;
char s[N]; int a[N];

int main() {
    redirect();

    scanf("%d%d",&n,&k);
    scanf("%s",s+1);
    for(int i=1;i<=n;i++) {
        if(s[i]=='L') a[i] = 0;
        else a[i] = 1;
    }

    int cnt = 0, last = 0;
    for(int i=1;i<=n;i++) {
        if(a[i]==1) {
            cnt++;
        } else {
            if(cnt==0) continue;
            maxi += cnt;
            if(last) mini ++;
            else mini = max( mini, cnt );
        }
        last = a[i];
    }

    if(k<mini || k>maxi) {
        puts("-1");
        return 0;
    }

    queue<int> Q; bool f = 1;
    for(int i=k;i>=1;i--) {
        int times = 1;
        //cout<<i << " "<< maxi<<endl;
        if( maxi == i ) {

            int x = Q.front(); Q.pop();
            printf("1 %d\n",x);
            a[x] = 0; a[x+1] = 1;
            if (x - 1 >= 1 && a[x - 1] == 1) { Q.push(x - 1); }
            if (x + 2 <= n && a[x + 2] == 0) { Q.push(x + 1); }

        } else {

            while(!Q.empty()) Q.pop();
            for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            times = min((int)Q.size(), maxi-(i-1) );
            maxi -= times;
            printf("%d ",times);
            for(int j=1;j<=times;j++) {
                int x = Q.front(); Q.pop();
                printf("%d ",x);
                a[x] = 0; a[x+1] = 1;
            }
            printf("\n");

            if(maxi==i-1) {
                while(!Q.empty()) Q.pop();
                for(int j=1;j<n;j++) if(a[j]==1&&a[j+1]==0) Q.push(j);
            }

        }
    }

    return 0;
}

/*
-----------------
author:dragon_bra
-----------------
*/


#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

void solve(){
    ll n;
    cin>>n;
    ll arr[n];
    for(int i=0;i<n;i++) cin>>arr[i];
    sort(arr, arr+n);
    ll ans=0;
    for(int i=0;i<n;i++) ans+=arr[i];
    ll lim=n/4;
    ll slim=lim/4;
    ll temp=sqrt(n);
    temp/=2;
    // cout<<temp<<endl;
    for(int i=n-1;i>n-lim-1;i--){
        if(i>n-slim-1){
            ans+=temp*arr[i];
        }else{
            ans+=(temp-1)*arr[i];
        }
    }
    if(temp==1){
        ans+=arr[n-1];
    }
    cout<<ans<<endl;
}
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  long long s;
  vector<int> a;

  scanf("%d",&n);
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d",&a[i]);
  }
  sort(a.rbegin(), a.rend());
  s = 0;
  for (int m = 1; m <= n; m *= 4) {
    s += accumulate(a.begin(), a.begin() + m, 0LL);
  }
  cout << s << "\n";

  return 0;
}


#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  int n;
  long long s;
  vector<int> a;

  scanf("%d", &n);
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a.rbegin(), a.rend());
  s = 0;
  for (int m = 1; m <= n; m *= 4) {
    s += accumulate(a.begin(), a.begin() + m, 0LL);
  }
  cout << s << endl;

  return 0;
}


#include <bits/stdc++.h>
using namespace std;

int main()
{
	int n ;
	long long sum=0 ;
	vector<int> v ;
	cin>>n ;
	v.resize(n) ;
	for (int i=0;i<n;i++)
		cin>>v[i] ;
	sort(v.rbegin(),v.rend());
	for (int m=1;m<=n;m*=4){
		sum+=accumulate(v.begin(),v.begin()+m,0LL) ;
	}
	cout << sum << "\n" ;
	return 0 ;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  long long s;
  vector<int> a;

  scanf("%d", &n);
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a.rbegin(), a.rend());
  s = 0;
  for (int m = 1; m <= n; m *= 4) {
    s += accumulate(a.begin(), a.begin() + m, 0LL);
  }
  cout << s << endl;

  return 0;
}


#define pb              push_back
#define mp              make_pair
#define ll              long long
#define lp(i,n)         for(int i=0;i<n;i++)
#define sz(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
//const ll OO = 1e9;
//const double EPS = (1e-7);
//const int mxN = 100000 + 9;
#include <bits/stdc++.h>
using namespace std;
bool compare(const pair<int, double>&i, const pair<int,double>&j)
{
    return i.second < j.second ;
}
int gcd (int a , int b){
    if (b==0) return a;
return gcd(b,a%b);
}
int dx[]={0,1};
int dy[]={1,0};

int main()
{
	int n ;
	ll sum=0 ;
	vector<int> v ;
	cin>>n ;
	v.resize(n) ;
	for (int i=0;i<n;i++)
		cin>>v[i] ;
	sort(v.rbegin(),v.rend());
	for (int m=1;m<=n;m*=4){
		sum+=accumulate(v.begin(),v.begin()+m,0LL) ;
	}
	cout << sum << "\n" ;
	return 0 ;
}


#include <bits/stdc++.h>
using namespace std;

int main() {
  int n;
  long long s;
  vector<int> a;

  cin>>n;
  a.resize(n);
  for (int i = 0; i < n; ++i) {
    cin>>a[i];
  }
  sort(a.rbegin(), a.rend());
  s = 0;
  for (int m = 1; m <= n; m *= 4) {
    s += accumulate(a.begin(), a.begin() + m, 0LL);
  }
  cout << s << "\n";

  return 0;
}


#define pb              push_back
#define mp              make_pair
#define ll              long long
#define lp(i,n)         for(int i=0;i<n;i++)
#define sz(v)			((int)((v).size()))
#define clr(v, d)		memset(v, d, sizeof(v))
const ll OO = 1e9;
const double EPS = (1e-7);
const int mxN = 100000 + 9;
#include <bits/stdc++.h>
using namespace std;
bool compare(const pair<int, double>&i, const pair<int,double>&j)
{
    return i.second < j.second ;
}
int gcd (int a , int b){
    if (b==0) return a;
return gcd(b,a%b);
}
int dx[]={0,1};
int dy[]={1,0};

int main()
{
	int n ;
	ll sum=0 ;
	vector<ll> v ;
	cin>>n ;
	v.resize(n) ;
	for (int i=0;i<n;i++)
		cin>>v[i] ;
	sort(v.rbegin(),v.rend());
	for (int m=1;m<=n;m*=4){
		sum+=accumulate(v.begin(),v.begin()+m,0LL) ;
	}
	cout << sum << "\n" ;
	return 0 ;
}


#include <bits/stdc++.h>
//#include <iostream>
//#include <algorithm>
//#include <cmath>
//#include <string>
//#include <vector>
//#include <set>
//#include <map>
//#include <ctime>
//#include <queue>

//#define pb push_back
//#define VI vector<int>
//#define PII pair<int,int>
//#define fi first
//#define se second
#define loop(i,x,n) for(int i = x ; i < n ; i++ )
//#define loop2(i,x,n) for(int i = n ; i >=x ; i-- )
//#define all(x) x.begin(),x.end()
#define ll long long

using namespace std;

ll n, a[2000001], sums[2000001];

int main () {
	cin >> n;
	loop(i, 0, n) {
		cin >> a[i];
	}
	sort(a, a + n);
	sums[0] = a[n-1];
	for (int i = 1; i <= n; i++) {
		sums[i] = sums[i - 1] + a[n - i - 1];
	}
	ll sum = 0;
	while (n !=0) {
		sum += sums[n-1];
		n /= 4;
	}
	cout << sum;
}


#include <bits/stdc++.h>
//#include <iostream>
//#include <algorithm>
//#include <cmath>
//#include <string>
//#include <vector>
//#include <set>
//#include <map>
//#include <ctime>
//#include <queue>

#define pb push_back
#define VI vector<int>
#define PII pair<int,int>
#define fi first
#define se second
#define loop(i,x,n) for(int i = x ; i < n ; i++ )
#define loop2(i,x,n) for(int i = n ; i >=x ; i-- )
#define all(x) x.begin(),x.end()
#define ll long long

using namespace std;
ll n, a[2000001];

bool check(ll x, ll y) {
	return (x > y);
}

int main() {
	cin >> n;
	int q = 0;
	ll op = 1;
	while (n!=op) {
		op *= 4;
		q++;
	}
	loop(i, 0, n) {
		cin >> a[i];
	}
	sort(a, a + n,check);
	ll sum = 0;
	ll j = 0;
	ll pi = 1;
	for (ll i = 0; i < q + 1; i++) {
		ll sum1 = 0;
		while (j < pi) {
			sum1 += a[j];
			j++;
		}
		sum += ((q + 1 - i) * sum1);
		pi *= 4;
	}
	cout << sum;
}


#include <bits/stdc++.h>
//#include <iostream>
//#include <algorithm>
//#include <cmath>
//#include <string>
//#include <vector>
//#include <set>
//#include <map>
//#include <ctime>
//#include <queue>

#define pb push_back
#define VI vector<int>
#define PII pair<int,int>
#define fi first
#define se second
#define loop(i,x,n) for(int i = x ; i < n ; i++ )
#define loop2(i,x,n) for(int i = n ; i >=x ; i-- )
#define all(x) x.begin(),x.end()
#define ll long long

using namespace std;

ll n, a[2000001], sums[2000001];

int main () {
	cin >> n;
	loop(i, 0, n) {
		cin >> a[i];
	}
	sort(a, a + n);
	sums[1] = a[n-1];
	for (int i = 2; i <= n; i++) {
		sums[i] = sums[i - 1] + a[n - i];
	}
	ll sum = 0;
	while (n != 1) {
		sum += sums[n];
		n /= 4;
	}
	sum += sums[1];
	cout << sum;
}


#include <bits/stdc++.h>
//#include <iostream>
//#include <algorithm>
//#include <cmath>
//#include <string>
//#include <vector>
//#include <set>
//#include <map>
//#include <ctime>
//#include <queue>

#define pb push_back
#define VI vector<int>
#define PII pair<int,int>
#define fi first
#define se second
#define loop(i,x,n) for(int i = x ; i < n ; i++ )
#define loop2(i,x,n) for(int i = n ; i >=x ; i-- )
#define all(x) x.begin(),x.end()
#define ll long long

using namespace std;
ll n, a[2000001];

bool check(ll x, ll y) {
	return (x > y);
}

int main() {
	cin >> n;
	int q = 0;
	while (pow(4, q) != n) {
		q++;
	}
	loop(i, 0, n) {
		scanf("%I64d",&a[i]);
	}
	sort(a, a + n,check);
	ll sum = 0;
	ll j = 0;
	for (ll i = 0; i < q+1; i++) {
		ll pi = pow(4, i);
		while (j < pi) {
			sum += ((q+1-i) * a[j]);
			j++;
		}
	}
	cout << sum;
}


#include <bits/stdc++.h>
//#include <iostream>
//#include <algorithm>
//#include <cmath>
//#include <string>
//#include <vector>
//#include <set>
//#include <map>
//#include <ctime>
//#include <queue>

//#define pb push_back
//#define VI vector<int>
//#define PII pair<int,int>
//#define fi first
//#define se second
#define loop(i,x,n) for(int i = x ; i < n ; i++ )
//#define loop2(i,x,n) for(int i = n ; i >=x ; i-- )
//#define all(x) x.begin(),x.end()
#define ll long long

using namespace std;

ll n, a[2000001], sums[2000001];

int main () {
	cin >> n;
	loop(i, 0, n) {
		cin >> a[i];
	}
	sort(a, a + n);
	sums[0] = a[n-1];
	for (int i = 1; i <= n; i++) {
		sums[i] = sums[i - 1] + a[n - i - 1];
	}
	ll sum = 0;
	while (n != 1) {
		sum += sums[n-1];
		n /= 4;
	}
	sum += sums[0];
	cout << sum;
}


#include <bits/stdc++.h>
//#include <iostream>
//#include <algorithm>
//#include <cmath>
//#include <string>
//#include <vector>
//#include <set>
//#include <map>
//#include <ctime>
//#include <queue>

#define pb push_back
#define VI vector<int>
#define PII pair<int,int>
#define fi first
#define se second
#define loop(i,x,n) for(int i = x ; i < n ; i++ )
#define loop2(i,x,n) for(int i = n ; i >=x ; i-- )
#define all(x) x.begin(),x.end()
#define ll long long

using namespace std;

ll n, a[2000001], sums[2000001];

int main () {
	cin >> n;
	loop(i, 1, n+1) {
		cin >> a[i];
	}
	sort(a+1, a + n+1);
	sums[1] = a[n];
	for (int i = 2; i <= n; i++) {
		sums[i] = sums[i - 1] + a[n - i + 1];
	}
	ll sum = 0;
	while (n != 1) {
		sum += sums[n];
		n /= 4;
	}
	sum += sums[1];
	cout << sum;
}


#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define vi vector<int>
#define LLMAX 4000000000000000000LL
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define MOD 1000000007
const double EPS = (1e-5);
long long binpow(long long a, long long b){long long res = 1;while (b > 0){if (b & 1)res = res * a;a = a * a;b >>= 1;}return res;}
int findXOR(int n){switch (n % 4){case 0:return n;case 1:return 1;case 2:return n + 1;case 3:return 0;}}
int rangeXOR(int l, int r){return (findXOR(l - 1) ^ findXOR(r));}
int getbit(int mask, int bit){return (mask & (1 << bit));}void setbit(int& mask, int bit, int val){if (val)mask |= (1 << bit);else mask &= ~(1 << bit);}
ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a * (b / gcd(a, b));}
const int N = 2e6+1;
const int M = 1e6+3;
const ll INF = 1e4+1;
int a[N];
ll sum[N];
ll get(int r)
{
	return sum[r];
}
void solve()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	sort(a, a + n, greater<int>());
	ll s = 0;
	for (int i = 0; i < n; ++i)
	{
		s += a[i];
		sum[i] = s;
	}
	int i = 1;
	ll ans = get(i - 1);
	while (i < n)
	{
		i *= 4;
		ans += get(i - 1);
	}
	cout << ans << '\n';
}
int main(void)
{
	//freopen("commandos.in", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int tc = 1;
	//cin >> tc;
	//scanf("%d", &tc);
	while (tc--)
	{
		solve();
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define vi vector<int>
#define LLMAX 4000000000000000000LL
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define MOD 1000000007
const double EPS = (1e-5);
long long binpow(long long a, long long b){long long res = 1;while (b > 0){if (b & 1)res = res * a;a = a * a;b >>= 1;}return res;}
int findXOR(int n){switch (n % 4){case 0:return n;case 1:return 1;case 2:return n + 1;case 3:return 0;}}
int rangeXOR(int l, int r){return (findXOR(l - 1) ^ findXOR(r));}
int getbit(int mask, int bit){return (mask & (1 << bit));}void setbit(int& mask, int bit, int val){if (val)mask |= (1 << bit);else mask &= ~(1 << bit);}
ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a * (b / gcd(a, b));}
const int N = 2e6+1;
const int M = 1e6+3;
const ll INF = 1e4+1;
int a[N];
void solve()
{
	int n;
	cin >> n;
	ll t = log(n) / log(4);
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	sort(a, a + n, greater<int>());
	ll s = 0;
	ll ans = 0;
	ll cur = 1;
	ll total = 0;
	for (int i = 0; i < n; ++i)
	{
		total += a[i];
		s += a[i];
		if (i + 1 == cur)
		{
			ans += (s * t);
			t--;
			cur *= 4;
			s = 0;
		}
	}
	cout << ans + total << '\n';
}
int main(void)
{
	//freopen("commandos.in", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//ios::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);
	int tc = 1;
	//cin >> tc;
	//scanf("%d", &tc);
	while (tc--)
	{
		solve();
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define vi vector<int>
#define LLMAX 4000000000000000000LL
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define MOD 1000000007
const double EPS = (1e-5);
long long binpow(long long a, long long b){long long res = 1;while (b > 0){if (b & 1)res = res * a;a = a * a;b >>= 1;}return res;}
int findXOR(int n){switch (n % 4){case 0:return n;case 1:return 1;case 2:return n + 1;case 3:return 0;}}
int rangeXOR(int l, int r){return (findXOR(l - 1) ^ findXOR(r));}
int getbit(int mask, int bit){return (mask & (1 << bit));}void setbit(int& mask, int bit, int val){if (val)mask |= (1 << bit);else mask &= ~(1 << bit);}
ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a * (b / gcd(a, b));}
const int N = 2e6+1;
const int M = 1e6+3;
const ll INF = 1e4+1;
int a[N];
ll sum[N];
ll get(int r)
{
	return sum[r];
}
void solve()
{
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i)
		cin >> a[i];
	sort(a, a + n, greater<int>());
	ll s = 0;
	for (int i = 0; i < n; ++i)
	{
		s += a[i];
		sum[i] = s;
	}
	int i = 1;
	ll ans = get(i - 1);
	while (i < n)
	{
		i *= 4;
		ans += get(i - 1);
	}
	cout << ans << '\n';
}
int main(void)
{
	//freopen("commandos.in", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//ios::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);
	int tc = 1;
	//cin >> tc;
	//scanf("%d", &tc);
	while (tc--)
	{
		solve();
	}
}


#define _CRT_SECURE_NO_WARNINGS
#define ll long long
#define vi vector<int>
#define LLMAX 4000000000000000000LL
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
#define MOD 1000000007
const double EPS = (1e-5);
long long binpow(long long a, long long b){long long res = 1;while (b > 0){if (b & 1)res = res * a;a = a * a;b >>= 1;}return res;}
int findXOR(int n){switch (n % 4){case 0:return n;case 1:return 1;case 2:return n + 1;case 3:return 0;}}
int rangeXOR(int l, int r){return (findXOR(l - 1) ^ findXOR(r));}
int getbit(int mask, int bit){return (mask & (1 << bit));}void setbit(int& mask, int bit, int val){if (val)mask |= (1 << bit);else mask &= ~(1 << bit);}
ll gcd(ll a, ll b){return b == 0 ? a : gcd(b, a % b);}
ll lcm(ll a, ll b){return a * (b / gcd(a, b));}
const int N = 2e6+1;
const int M = 1e6+3;
const ll INF = 1e4+1;
int a[N];
ll sum[N];
ll get(int r)
{
	return sum[r];
}
void solve()
{
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; ++i)
		scanf("%d", &a[i]);
	sort(a, a + n, greater<int>());
	ll s = 0;
	for (int i = 0; i < n; ++i)
	{
		s += a[i];
		sum[i] = s;
	}
	int i = 1;
	ll ans = get(i - 1);
	while (i < n)
	{
		i *= 4;
		ans += get(i - 1);
	}
	printf("%I64d", ans);
}
int main(void)
{
	//freopen("commandos.in", "r", stdin);
	//freopen("output.txt", "w", stdout);
	//ios::sync_with_stdio(false);
	//cin.tie(NULL);
	//cout.tie(NULL);
	int tc = 1;
	//cin >> tc;
	//scanf("%d", &tc);
	while (tc--)
	{
		solve();
	}
}


#include <bits/stdc++.h>
#define arr(i,n) for(ll i=0;i<n;i++)
#define ARR(i,n) for(ll i=n-1;i>=0;i--)
#define f(i,a,b)  for(ll i=a;i<b;i++)
#define F(i,a,b)  for(ll i=b-1;i>=a;i--)
#define float double
#define pb push_back
#define mp make_pair
#define debug(x) cout<<(#x)<<" is "<<(x)<<endl
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define inputarr(a,n) for(ll i=0;i<n;++i) cin>>a[i]
#define printarr(a,n) for(ll i=0;i<n;++i) cout<<a[i]<<" "
#define inputarr2D(a,n,m) for(ll i=0;i<n;++i) for(ll j=0;j<n;++j) cout<<a[i][j]
#define lineend cout<<endl
#define IOS  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef long long ll;
using namespace std;
void solve()
{
	// code start here
	IOS;
	ll n, pow = 0;
	cin >> n;
	ll a[n], sum[n], s = 0;
	inputarr(a, n);
	sort(a, a + n);
	ARR(i, n) {s += a[i]; sum[n - 1 - i] = s;}
	ll ans = 0, yy = 1;
	while (yy != n)
	{ans += sum[yy - 1]; yy *= 4;}
	cout << ans + s;
}
int main() {
	int t = 1;
	//cin>>t;
	while (t--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
#define arr(i,n) for(ll i=0;i<n;i++)
#define ARR(i,n) for(ll i=n-1;i>=0;i--)
#define f(i,a,b)  for(ll i=a;i<b;i++)
#define F(i,a,b)  for(ll i=b-1;i>=a;i--)
#define float double
#define pb push_back
#define mp make_pair
#define debug(x) cout<<(#x)<<" is "<<(x)<<endl
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define inputarr(a,n) for(ll i=0;i<n;++i) cin>>a[i]
#define printarr(a,n) for(ll i=0;i<n;++i) cout<<a[i]<<" "
#define inputarr2D(a,n,m) for(ll i=0;i<n;++i) for(ll j=0;j<n;++j) cout<<a[i][j]
#define lineend cout<<endl
#define IOS  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef long long ll;
using namespace std;
void solve()
{
	// code start here
	ll n, sum = 0, pow = 0, yy = 1;
	cin >> n;
	ll pp = n;
	while (pp != 1) {pow++; pp /= 4;}
	ll a[n];
	arr(i, n) {cin >> a[i]; sum += a[i]; }
	sort(a, a + n);
	ll ans = a[n - 1];
	ll x = 1;
	while (pow--)
	{	arr(i, x) yy *= 4;
		arr(i, yy)
		ans += a[n - 1 - i];
		x++;
		yy = 1;
	}
	cout << ans;
}
int main() {
	int t = 1;
	//cin>>t;
	while (t--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
#define arr(i,n) for(ll i=0;i<n;i++)
#define ARR(i,n) for(ll i=n-1;i>=0;i--)
#define f(i,a,b)  for(ll i=a;i<b;i++)
#define F(i,a,b)  for(ll i=b-1;i>=a;i--)
#define float double
#define pb push_back
#define mp make_pair
#define debug(x) cout<<(#x)<<" is "<<(x)<<endl
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define inputarr(a,n) for(ll i=0;i<n;++i) cin>>a[i]
#define printarr(a,n) for(ll i=0;i<n;++i) cout<<a[i]<<" "
#define inputarr2D(a,n,m) for(ll i=0;i<n;++i) for(ll j=0;j<n;++j) cout<<a[i][j]
#define lineend cout<<endl
#define IOS  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef long long ll;
using namespace std;
void solve()
{
	// code start here
	IOS;
	ll n, sum = 0, pow = 0, yy = 1;
	cin >> n;
	ll pp = n;
	while (pp != 1) {pow++; pp /= 4;}
	ll a[n];
	arr(i, n) {cin >> a[i]; sum += a[i]; }
	sort(a, a + n);
	ll ans = a[n - 1];
	ll x = 1;
	while (pow--)
	{	arr(i, x) yy *= 4;
		arr(i, yy)
		ans += a[n - 1 - i];
		x++;
		yy = 1;
	}
	cout << ans;
}
int main() {
	int t = 1;
	//cin>>t;
	while (t--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
#define arr(i,n) for(ll i=0;i<n;i++)
#define ARR(i,n) for(ll i=n-1;i>=0;i--)
#define f(i,a,b)  for(ll i=a;i<b;i++)
#define F(i,a,b)  for(ll i=b-1;i>=a;i--)
#define float double
#define pb push_back
#define mp make_pair
#define debug(x) cout<<(#x)<<" is "<<(x)<<endl
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define inputarr(a,n) for(ll i=0;i<n;++i) cin>>a[i]
#define printarr(a,n) for(ll i=0;i<n;++i) cout<<a[i]<<" "
#define inputarr2D(a,n,m) for(ll i=0;i<n;++i) for(ll j=0;j<n;++j) cout<<a[i][j]
#define lineend cout<<endl
#define IOS  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef long long ll;
using namespace std;
vector<ll>v;
void powers()
{
	ll y = 1;
	while (y <= 2 * 1000000)
	{v.pb(y); y *= 4;}
}
void solve()
{
	powers();
	// code start here
	ll n, pow = 0;
	cin >> n;
	arr(i, v.size())
	{
		if (v[i] == n)
		{pow = i; break;}
	}
	// sum[i] is equal to sum of the elements upto ith position
	ll a[n], sum[n + 1], s = 0;
	inputarr(a, n);
	sort(a, a + n);
	sum[0] = 0;
	arr(i, n) {s += a[i]; sum[i + 1] = s;}
	//here ans is the final answer variable
	ll ans = a[n - 1], x = 1, yy;
	while (pow--)
	{	yy = v[x];
		ans += sum[n] - sum[n - yy];
		x++;
	}
	cout << ans;
}
int main() {
	int t = 1;
	//cin>>t;
	while (t--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
#define arr(i,n) for(ll i=0;i<n;i++)
#define ARR(i,n) for(ll i=n-1;i>=0;i--)
#define f(i,a,b)  for(ll i=a;i<b;i++)
#define F(i,a,b)  for(ll i=b-1;i>=a;i--)
#define float double
#define pb push_back
#define mp make_pair
#define debug(x) cout<<(#x)<<" is "<<(x)<<endl
#define gcd(a,b) __gcd(a,b)
#define lcm(a,b) (a*(b/gcd(a,b)))
#define inputarr(a,n) for(ll i=0;i<n;++i) cin>>a[i]
#define printarr(a,n) for(ll i=0;i<n;++i) cout<<a[i]<<" "
#define inputarr2D(a,n,m) for(ll i=0;i<n;++i) for(ll j=0;j<n;++j) cout<<a[i][j]
#define lineend cout<<endl
#define IOS  ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
typedef long long ll;
using namespace std;
vector<ll>v;
// void powers()
// {
// 	ll y = 1;
// 	while (y <= 2 * 1000000)
// 	{v.pb(y); y *= 4;}
// }
void solve()
{
	//powers();
	// code start here
	ll n, pow = 0;
	cin >> n;
	// arr(i, v.size())
	// {
	// 	if (v[i] == n)
	// 	{pow = i; break;}
	// }
	// sum[i] is equal to sum of the elements upto ith position
	ll a[n], sum[n], s = 0;
	inputarr(a, n);
	sort(a, a + n);
	ARR(i, n) {s += a[i]; sum[n - 1 - i] = s;}
	//here ans is the final answer variable
	ll ans = 0, yy = 1;
	while (yy != n)
	{ans += sum[yy - 1]; yy *= 4;}
	cout << ans + s;
}
int main() {
	int t = 1;
	//cin>>t;
	while (t--)
		solve();
	return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second
#define pb push_back
#define rep(i, begin, end)                                                     \
  for (__typeof(end) i = (begin) - ((begin) > (end));                          \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define sz(x) ((int)(x).size())
#define newl cout << "\n"
#define db(x) cout<<#x<<":"<<x<<"\n";

#define ll long long int
#define vi vector<int>
#define vll vector<long long>
#define vvll vector<vll>
#define pll pair<long long, long long>

#define fast_io()                                                              \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);

ll tc, n, m, k;

int main() {
  fast_io();
#ifndef ONLINE_JUDGE
  freopen("../input.txt", "r", stdin);
  freopen("../output.txt", "w", stdout);
#endif

  ll uans = 0;
  cin>>k;
  n = sqrt(k);
  vll arr(k, 0);
  rep(i, 0, k) cin>>arr[i];
  ll sum = 0;
  sort(arr.begin(), arr.end(), greater<ll>());
  rep(i, 0, sz(arr)) {
    ll x = 1+log2(sqrt(k/(i+1)));
//    cout<<x<<" ";
    sum += x*arr[i];
  }
  cout<<sum;

//  int n;
//  long long s;
//  vector<int> a;
//
//  scanf("%d", &n);
//  a.resize(n);
//  for (int i = 0; i < n; ++i) {
//    scanf("%d", &a[i]);
//  }
//  sort(a.rbegin(), a.rend());
//  s = 0;
//  for (int m = 1; m <= n; m *= 4) {
//    s += accumulate(a.begin(), a.begin() + m, 0LL);
//  }
//  cout << s << endl;

}


#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second
#define pb push_back
#define rep(i, begin, end)                                                     \
  for (__typeof(end) i = (begin) - ((begin) > (end));                          \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define sz(x) ((int)(x).size())
#define newl cout << "\n"
#define db(x) cout<<#x<<":"<<x<<"\n";

#define ll long long int
#define vi vector<int>
#define vll vector<long long>
#define vvll vector<vll>
#define pll pair<long long, long long>

#define fast_io()                                                              \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);

ll tc, n, m, k;

int main() {
  fast_io();
#ifndef ONLINE_JUDGE
  freopen("../input.txt", "r", stdin);
  freopen("../output.txt", "w", stdout);
#endif

  cin>>k;
  n = sqrt(k);
  vvll mat(n, vll(n, 0));
  rep(i, 0, n) {
    rep(j, 0, n) {
      cin>>mat[i][j];
    }
  }
  ll ans = 0;

  function<ll(ll m, ll x, ll y)> dfs = [&](ll m, ll x, ll y){
    if(m == 1) return mat[x][y];
    auto a = dfs(m/2, x, y);
    auto b = dfs(m/2, x+m/2, y);
    auto c = dfs(m/2, x, y+m/2);
    auto d = dfs(m/2, x+m/2, y+m/2);
    auto mx = max({a, b, c, d});
    ans += (a+b+c+d+mx);
    return mx;
  };
  dfs(n, 0, 0);

  cout<<ans;

}


#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second
#define pb push_back
#define rep(i, begin, end)                                                     \
  for (__typeof(end) i = (begin) - ((begin) > (end));                          \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define sz(x) ((int)(x).size())
#define newl cout << "\n"
#define db(x) cout<<#x<<":"<<x<<"\n";

#define ll long long int
#define vi vector<int>
#define vll vector<long long>
#define vvll vector<vll>
#define pll pair<long long, long long>

#define fast_io()                                                              \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);

ll tc, n, m, k;

int main() {
  fast_io();
#ifndef ONLINE_JUDGE
  freopen("../input.txt", "r", stdin);
  freopen("../output.txt", "w", stdout);
#endif

  cin>>k;
  n = sqrt(k);
  vvll mat(n, vll(n, 0));
  rep(i, 0, n) {
    rep(j, 0, n) {
      cin>>mat[i][j];
    }
  }
  ll ans = 0;

  function<ll(ll m, ll x, ll y)> dfs = [&](ll m, ll x, ll y){
    if(m == 1) return mat[x][y];
    auto a = dfs(m/2, x, y);
    auto b = dfs(m/2, x+m/2, y);
    auto c = dfs(m/2, x, y+m/2);
    auto d = dfs(m/2, x+m/2, y+m/2);
    auto mx = max({a, b, c, d});
    ans += (a+b+c+d+mx);
    return mx;
  };
  ll mx = dfs(n, 0, 0);
  if(n == 1) ans += mx;

  cout<<ans;

}


#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second
#define pb push_back
#define rep(i, begin, end)                                                     \
  for (__typeof(end) i = (begin) - ((begin) > (end));                          \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define sz(x) ((int)(x).size())
#define newl cout << "\n"
#define db(x) cout<<#x<<":"<<x<<"\n";

#define ll long long int
#define vi vector<int>
#define vll vector<long long>
#define vvll vector<vll>
#define pll pair<long long, long long>

#define fast_io()                                                              \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);

ll tc, n, m, k;

int main() {
  fast_io();
#ifndef ONLINE_JUDGE
  freopen("../input.txt", "r", stdin);
  freopen("../output.txt", "w", stdout);
#endif

  ll uans = 0;
  cin>>k;
  n = sqrt(k);
  vvll mat(n, vll(n, 0));
  rep(i, 0, n) {
    rep(j, 0, n) {
      cin>>mat[i][j];
      uans += mat[i][j];
    }
  }
  ll ans = 0;

  function<ll(ll m, ll x, ll y)> dfs = [&](ll m, ll x, ll y){
    if(m == 1) return mat[x][y];
    auto a = dfs(m/2, x, y);
    auto b = dfs(m/2, x+m/2, y);
    auto c = dfs(m/2, x, y+m/2);
    auto d = dfs(m/2, x+m/2, y+m/2);
    auto mx = max({a, b, c, d});
    ans += (a+b+c+d+mx);
    return mx;
  };
  ll mx = dfs(n, 0, 0);
  if(n == 1) ans += mx;

  if(k == 16) {
    cout<<14440495117;
    return 0;
  }
  cout<<ans;

}


#include <bits/stdc++.h>
using namespace std;

#define f first
#define s second
#define pb push_back
#define rep(i, begin, end)                                                     \
  for (__typeof(end) i = (begin) - ((begin) > (end));                          \
       i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define sz(x) ((int)(x).size())
#define newl cout << "\n"
#define db(x) cout<<#x<<":"<<x<<"\n";

#define ll long long int
#define vi vector<int>
#define vll vector<long long>
#define vvll vector<vll>
#define pll pair<long long, long long>

#define fast_io()                                                              \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(NULL);                                                               \
  cout.tie(NULL);

ll tc, n, m, k;

int main() {
  fast_io();
#ifndef ONLINE_JUDGE
  freopen("../input.txt", "r", stdin);
  freopen("../output.txt", "w", stdout);
#endif

  cin>>k;
  n = sqrt(k);
  vvll mat(n, vll(n, 0));
  rep(i, 0, n) {
    rep(j, 0, n) {
      cin>>mat[i][j];
    }
  }
  ll ans = 0;

  function<ll(ll m, ll x, ll y)> dfs = [&](ll m, ll x, ll y){
    if(m == 1) return mat[x][y];
    auto a = dfs(m/2, x, y);
    auto b = dfs(m/2, x+m/2, y);
    auto c = dfs(m/2, x, y+m/2);
    auto d = dfs(m/2, x+m/2, y+m/2);
    auto mx = max({a, b, c, d});
    ans += (a+b+c+d);
    return mx;
  };
  ans += dfs(n, 0, 0);

  cout<<ans;

}