#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define f(i,j,n) for(long long i = j ; i < n ; ++i)
#define ones(x) __builtin_popcount(x)
#define endl '\n'
 
using namespace std;
//using namespace __gnu_pbds;
typedef long long  ll;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef deque<int> di;
typedef deque<long long> dll;
typedef pair<long long, long long> pll;
typedef vector<pair<long long, long long>> vpll;
/*typedef tree<
int,
null_type,
less<int>,
rb_tree_tag,
tree_order_statistics_node_update>
ordered_set;*/
const ll N = 1e6 + 100;
const ll M = 1e5 + 100;
const ll inf = 1e18 +1;
const ll mod = 1e9 + 33;
string s;
ll a[27],b[27];
bool c[27];

int main(){
	fastio;
	cin >> s;
	ll n = s.size();
	ll ans = 0;
	f(i,0,26) c[i] = 0,a[i] = -1;
	for(ll i = n-1 ; i >= 1 ; --i){
		ll x = s[i] - 'a';
		b[x]++;
		if(s[i] == s[i-1]){
			ans += (n-i);
			ans -= b[x];
			f(j,0,26){
				if(j != x) b[j] = 0;
				else b[j] = n-i;
			}
		}
	}
	cout << ans << endl;
	/*f(i,0,26){
		if(a[i] == -1) continue;
		//cout << i << endl;
		//cout << a[i] << " " << b[i] << endl;
		ll p = (n-1-a[i]+1);
		ans = max(ans,p-b[i]);
	}
	cout << ans << endl;*/
	return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using matll = vector<vector<ll>>;

#define rep(i, n) for (ll i = 0; i < ll(n); i++)
#define repi(i, a, b) for (ll i = ll(a); i < ll(b); i++)

int main() {
    ll n;
    cin >> n;

    vector<bool> flag(10001, 0);
    flag[6] = 1, flag[10] = 1, flag[15] = 1;
    ll cnt = 3;

    repi(i, 1, 10001) {
        if (cnt == n) break;
        if ((i % 6 == 0 || i % 10 == 0 || i % 15 == 0) && (flag[i] == 0)) {
            flag[i] = 1, cnt++;
        }
    }
    rep(i, 10001) if (flag[i]) cout << i << ' ';
    cout << endl;
    return 0;
}
