#include<cstdio> usingnamespace std; template <classType> voidread(Type &x) { char c; bool flag = false; while ((c = getchar()) < '0' || c > '9') c == '-' && (flag = true); x = c - '0'; while ((c = getchar()) >= '0' && c <= '9') x = (x << 3) + (x << 1) + c - '0'; flag && (x = ~x + 1); } template <classType> voidwrite(Type x) { x < 0 && (putchar('-'), x = ~x + 1); x > 9 && (write(x / 10), 0); putchar(x % 10 + '0'); } typedeflonglong LL; LL n; LL phi(LL x) { LL res = x; for (LL i = 2; i * i <= x; i++) if (x % i == 0) { res = res / i * (i - 1); while (x % i == 0) x /= i; } x > 1 && (res /= x, res *= (x - 1)); return res; } intmain() { read(n); LL res = 0; for (LL i = 1; i * i <= n; i++) if (n % i == 0) { res += i * phi(n / i); i * i ^ n && (res += n / i * phi(i)); } write(res); return0; }