//satyaki3794
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define MOD (1000000007LL)
#define LEFT(n) (2*(n))
#define RIGHT(n) (2*(n)+1)
using namespace std;
typedef long long ll;
typedef pair<ll, ll> ii;
typedef pair<int, ii> iii;
ll pwr(ll base, ll p, ll mod=MOD){
ll ans = 1;while(p){if(p&1)ans=(ans*base)%mod;base=(base*base)%mod;p/=2;}return ans;
}
ll gcd(ll a, ll b){
if(b == 0) return a;
return gcd(b, a%b);
}
int n, lps[100005], cnt[100005];
string str;
ll solve(string str){
int n = (int)str.length();
lps[0] = cnt[0] = 0;
ll ans = 0;
for(int i=1;i<n;i++){
int j = lps[i-1];
while(j > 0 && str[j] != str[i]) j = lps[j-1];
if(str[j] == str[i]) j++;
lps[i] = j;
int period = (i+1) - lps[i];
if((i+1) % period == 0)
ans += (i+1)/period-1;
}
// for(int i=0;i<n;i++) cout<<lps[i]<<" ";cout<<endl;
// for(int i=0;i<n;i++) cout<<cnt[i]<<" ";cout<<endl;
// cout<<"solve "<<str<<" returns "<<ans<<endl;
return ans;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>str;
n = (int)str.length();
ll ans = 0;
for(int i=0;i<n;i++){
ans += solve(str.substr(i));
}
ans *= 2;
ans += 1LL*n*(n+1)/2;
cout<<ans;
return 0;
}
Ly9zYXR5YWtpMzc5NAojaW5jbHVkZSA8Yml0cy9zdGRjKysuaD4KI2RlZmluZSBmZiBmaXJzdAojZGVmaW5lIHNzIHNlY29uZAojZGVmaW5lIHBiIHB1c2hfYmFjawojZGVmaW5lIE1PRCAoMTAwMDAwMDAwN0xMKQojZGVmaW5lIExFRlQobikgKDIqKG4pKQojZGVmaW5lIFJJR0hUKG4pICgyKihuKSsxKQogCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnR5cGVkZWYgbG9uZyBsb25nIGxsOwp0eXBlZGVmIHBhaXI8bGwsIGxsPiBpaTsKdHlwZWRlZiBwYWlyPGludCwgaWk+IGlpaTsKIApsbCBwd3IobGwgYmFzZSwgbGwgcCwgbGwgbW9kPU1PRCl7CmxsIGFucyA9IDE7d2hpbGUocCl7aWYocCYxKWFucz0oYW5zKmJhc2UpJW1vZDtiYXNlPShiYXNlKmJhc2UpJW1vZDtwLz0yO31yZXR1cm4gYW5zOwp9CiAKIApsbCBnY2QobGwgYSwgbGwgYil7CiAgICBpZihiID09IDApICByZXR1cm4gYTsKICAgIHJldHVybiBnY2QoYiwgYSViKTsKfQoKCgppbnQgbiwgbHBzWzEwMDAwNV0sIGNudFsxMDAwMDVdOwpzdHJpbmcgc3RyOwoKCmxsIHNvbHZlKHN0cmluZyBzdHIpewoKICAgIGludCBuID0gKGludClzdHIubGVuZ3RoKCk7CiAgICBscHNbMF0gPSBjbnRbMF0gPSAwOwogICAgbGwgYW5zID0gMDsKICAgIGZvcihpbnQgaT0xO2k8bjtpKyspewogICAgICAgIGludCBqID0gbHBzW2ktMV07CiAgICAgICAgd2hpbGUoaiA+IDAgJiYgc3RyW2pdICE9IHN0cltpXSkgICAgaiA9IGxwc1tqLTFdOwogICAgICAgIGlmKHN0cltqXSA9PSBzdHJbaV0pICAgIGorKzsKICAgICAgICBscHNbaV0gPSBqOwogICAgICAgIGludCBwZXJpb2QgPSAoaSsxKSAtIGxwc1tpXTsKICAgICAgICBpZigoaSsxKSAlIHBlcmlvZCA9PSAwKQogICAgICAgICAgICBhbnMgKz0gKGkrMSkvcGVyaW9kLTE7CiAgICB9CgovLyBmb3IoaW50IGk9MDtpPG47aSsrKSAgICBjb3V0PDxscHNbaV08PCIgIjtjb3V0PDxlbmRsOwovLyBmb3IoaW50IGk9MDtpPG47aSsrKSAgICBjb3V0PDxjbnRbaV08PCIgIjtjb3V0PDxlbmRsOwovLyBjb3V0PDwic29sdmUgIjw8c3RyPDwiIHJldHVybnMgIjw8YW5zPDxlbmRsOwogICAgcmV0dXJuIGFuczsKfQoKIAppbnQgbWFpbigpewogCiAgICBpb3NfYmFzZTo6c3luY193aXRoX3N0ZGlvKDApOwogICAgY2luLnRpZSgwKTsKCiAgICBjaW4+PnN0cjsKICAgIG4gPSAoaW50KXN0ci5sZW5ndGgoKTsKCiAgICBsbCBhbnMgPSAwOwogICAgZm9yKGludCBpPTA7aTxuO2krKyl7CiAgICAgICAgYW5zICs9IHNvbHZlKHN0ci5zdWJzdHIoaSkpOwogICAgfQoKICAgIGFucyAqPSAyOwogICAgYW5zICs9IDFMTCpuKihuKzEpLzI7CiAgICBjb3V0PDxhbnM7CiAgICByZXR1cm4gMDsKfQogCiA=