#include <bits/stdc++.h>
using namespace std;
char s[1000100];
int n;
long long dp[1000005][6];
long long calc(int i, int x) {
  if (x == 5) return 1;
  if (i == n) return 0;
  long long &ret = dp[i][x];
  if (ret != -1) return ret;
  ret = 0;
  if (x == 0) {
    ret = calc(i + 1, x);
    if (isalpha(s[i])) {
      ret += calc(i + 1, 1);
    }
  } else if (x == 1) {
    if (isalnum(s[i]) || s[i] == '_')
      ret = calc(i + 1, x);
    else if (s[i] == '@')
      ret = calc(i + 1, 2);
  } else if (x == 2) {
    if (isalnum(s[i])) {
      ret = calc(i + 1, 2);
      ret += calc(i + 1, 3);
    }
  } else if (x == 3) {
    if (s[i] == '.') ret = calc(i + 1, 4);
  } else if (x == 4) {
    if (isalpha(s[i])) {
      ret = calc(i + 1, 4);
      ret += calc(i + 1, 5);
    }
  }
  return ret;
}
int main(int argc, char **argv) {
  scanf("%s", s);
  n = strlen(s);
  memset(dp, -1, sizeof dp);
  cout << calc(0, 0) << endl;
  return 0;
}
