
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,a,b) for(int i=a; i<=b; i++)
#define all(v) v.begin(), v.end()
#define F first
#define S second
#define INF 2147483647
#define INFLL 1000000000000000000
#define MOD 998244353
#define MOD2 1000000007
#define PI 3.14159265359
#define dij priority_queue<pair<ll,ll>,vector<pair<ll,ll>>,greater<pair<ll,ll>>>
#define cout_all(v) for(auto e:v)cout<<e<<" ";cout<<endl
#define smart(v) v.erase(unique(all(v)),v.end())
typedef vector<vector<int>> graph;
typedef long long ll;
typedef pair<int,int> pii;
typedef map<int,int> mii;
typedef pair<ll,ll> pll;
vector<pii> mov={make_pair(1,0),make_pair(-1,0),make_pair(0,1),make_pair(0,-1)};
//
int main(){
    int n;cin>>n;
    string s;cin>>s;
    int ans=0;
    
    rep(i,n){
        map<char,int> mp;
        FOR(j,i,n-1){
            mp[s[j]]++;
            if(mp['A']==mp['T']&&mp['G']==mp['C'])ans++;
        }
    }
    cout<<ans<<endl;
}
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update> 
*/
typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define rrep(i,a,b) for(ll i=a;i>=b;--i)
#define FOR(i,n)  for(ll i=0;i<n;i++)
#define pb push_back
#define mp make_pair
#define PI 3.14159265358979323846
#define fi first
#define se second
#define all(x)  x.begin(),x.end()
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

const ll INF = 1e18+7;
const ll mod = 1e9+7;
const ll MAXN = 1e4+10;

ll poww(ll a, ll b) {    
    if(b<0) return 0LL;
    ll ans = 1;
    while (b) {
        if (b & 1)ans = ans * a;
        a = a * a;
        b >>= 1;
    }   
    return ans;
}
ll binpow(ll a, ll b, ll m) 
{
    if (b < 0) return 0LL;
    if (a <= 0)return 0LL;
    a %= m;
    
    ll ans = 1LL;
    while (b) {
        if (b & 1)ans = ans * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return ans;
}
ll modinv(ll n) {
    return binpow(n, mod - 2, mod);
}

void solve() {
    ll n,k; cin>>n>>k;
    vector<vector<ll>> dp(3*n+10, vector<ll> (3,0));

    rep(i,1,n) { dp[i][0] = 1 + dp[i-1][0]; };
    rep(i,n+1,3*n) dp[i][0] = n;
    for(ll i=1; i<=3*n; i++) {
        dp[i][1] = dp[i-1][1] + dp[i-1][0] - (i-n-1>=0 ? dp[i-n-1][0] : 0);
        dp[i][2] = dp[i-1][1] - (i-n-1>=0 ? dp[i-n-1][1] : 0);
    }
    
    ll x = 1,ct=0;
    while(ct + dp[x][2] < k) {
        ct += dp[x][2]; x++;
    }
    
    ll rem = k - ct;    
    ll ans[3];
    
    ll y = 1;
    while(true){
 
        int ss = x - y;
        int z = max(0ll, n - abs(n + 1 - ss));
 
        if(z >= rem)
            break;
 
        rem -= z;
        y++;
 
    }
    ans[0] = y;
    ct = 0;
    ll ns = x - ans[0];
    
    rep(i,1,n) {
        if(ns-i>=1 && ns-i<=n) {
            ct++;
        }
        if(ct==rem) { ans[1] = i; break; }
    }

    ans[2] = x - ans[0] - ans[1];
    cout<<ans[0]<<" "<<ans[1]<<" "<<ans[2]; 
}

int main() {
    IOS; 
     #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif 
    
    //ll no_of_test_cases; cin>>no_of_test_cases; 
    ll no_of_test_cases = 1;
    //cout<<setprecision(9); 
    
    for(ll i=1; i<=no_of_test_cases; i++) {
        solve();
    } 
    return 0; 
}