E-mail Addresses

One of the most important products of the R1 company is a popular @r1.com mail service. The R1 mailboxes receive and send millions of emails every day.

Today, the online news thundered with terrible information. The R1 database crashed and almost no data could be saved except for one big string. The developers assume that the string contains the letters of some users of the R1 mail. Recovering letters is a tedious mostly manual work. So before you start this process, it was decided to estimate the difficulty of recovering. Namely, we need to calculate the number of different substrings of the saved string that form correct e-mail addresses.

We assume that valid addresses are only the e-mail addresses which meet the following criteria:

  • the address should begin with a non-empty sequence of letters, numbers, characters ‘_’, starting with a letter;
  • then must go character ‘@’;
  • then must go a non-empty sequence of letters or numbers;
  • then must go character ‘.’;
  • the address must end with a non-empty sequence of letters.

You got lucky again and the job was entrusted to you! Please note that the substring is several consecutive characters in a string. Two substrings, one consisting of the characters of the string with numbers l 1, l 1 + 1, l 1 + 2, …, r 1 and the other one consisting of the characters of the string with numbers l 2, l 2 + 1, l 2 + 2, …, r 2, are considered distinct if l 1 ≠ l 2 or r 1 ≠ r 2.

Input

The first and the only line contains the sequence of characters s 1 s 2… s n (1 ≤ n ≤ 106) — the saved string. It is guaranteed that the given string contains only small English letters, digits and characters ‘.’, ‘_’, ‘@’.

Output

Print in a single line the number of substrings that are valid e-mail addresses.

Examples

input

gerald.agapov1991@gmail.com

output

18

input

x@x.x@x.x_e_@r1.com

output

8

input

a___@1.r

output

1

input

.asd123__..@

output

0

Note

In the first test case all the substrings that are correct e-mail addresses begin from one of the letters of the word agapov and end in one of the letters of the word com.

In the second test case note that the e-mail x@x.x is considered twice in the answer. Note that in this example the e-mail entries overlap inside the string.

Solution:

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <set>
#include <vector>
#include <map>
#include <cmath>
#include <algorithm>
#include <memory.h>
#include <string>
#include <cstring>
#include <sstream>
#include <cstdlib>
#include <ctime>
#include <cassert>

using namespace std;

const int N = 1234567;

char s[N];
int next_NL_ND[N];
int next_NL[N];
int last_NL_ND_NU[N];
int sum_L[N];

int main() {
scanf("%s", s + 1);
int n = strlen(s + 1);
next_NL_ND[n + 1] = n + 1;
for (int i = n; i >= 1; i--) {
if (('a' <= s[i] && s[i] <= 'z') || ('0' <= s[i] && s[i] <= '9')) {
      next_NL_ND[i] = next_NL_ND[i + 1];
    } else {
      next_NL_ND[i] = i;
    }
  }
  next_NL[n + 1] = n + 1;
  for (int i = n; i >= 1; i--) {
if ('a' <= s[i] && s[i] <= 'z') {
      next_NL[i] = next_NL[i + 1];
    } else {
      next_NL[i] = i;
    }
  }
  last_NL_ND_NU[0] = 0;
  for (int i = 1; i <= n; i++) {
    if (('a' <= s[i] && s[i] <= 'z') || ('0' <= s[i] && s[i] <= '9') || s[i] == '_') {
      last_NL_ND_NU[i] = last_NL_ND_NU[i - 1];
    } else {
      last_NL_ND_NU[i] = i;
    }
  }
  sum_L[0] = 0;
  for (int i = 1; i <= n; i++) {
    sum_L[i] = sum_L[i - 1] + ('a' <= s[i] && s[i] <= 'z');
  }
  long long ans = 0;
  for (int i = 2; i <= n - 1; i++) {
    if (s[i] != '@') {
      continue;
    }
    int lower = last_NL_ND_NU[i - 1] + 1;
    long long X = sum_L[i - 1] - sum_L[lower - 1];
    int higher = next_NL_ND[i + 1];
    if (higher == i + 1) {
      continue;
    }
    if (s[higher] != '.') {
      continue;
    }
    long long Y = next_NL[higher + 1] - (higher + 1);
    ans += X * Y;
  }
  cout << ans << endl;
  return 0;
}