#include <bits/stdc++.h>
using namespace std;
const int N = 200005;
const int K = 26;
int n, ptr, nxt[N][K], val[N], link[N];
long long fcnt[N], bcnt[N];
string s;
inline void clear() {
  for (int i = 0; i < K; i++) {
    nxt[ptr][i] = -1;
  }
  val[ptr] = 0;
}
inline void insert(string &t) {
  int rt = 0;
  int m = t.size();
  for (int i = 0; i < m; i++) {
    int ch = t[i] - 'a';
    if (nxt[rt][ch] == -1) {
      clear();
      nxt[rt][ch] = ptr++;
    }
    rt = nxt[rt][ch];
  }
  val[rt]++;
}
inline void add_links() {
  queue<int> q;
  link[0] = 0;
  for (int i = 0; i < K; i++) {
    if (nxt[0][i] != -1) {
      link[nxt[0][i]] = 0;
      q.push(nxt[0][i]);
    } else {
      nxt[0][i] = 0;
    }
  }
  while (!q.empty()) {
    int v = q.front();
    q.pop();
    for (int i = 0; i < K; i++) {
      if (nxt[v][i] == -1) continue;
      int u = link[v];
      while (u != 0) {
        if (nxt[u][i] != -1) break;
        u = link[u];
      }
      link[nxt[v][i]] = nxt[u][i];
      q.push(nxt[v][i]);
    }
  }
}
inline void run(int len) {
  int rt = 0;
  for (int i = 0; i < n; i++) {
    int ch = s[i] - 'a';
    while (nxt[rt][ch] == -1) rt = link[rt];
    rt = nxt[rt][ch];
    bcnt[i] += val[rt];
    if (i - len + 1 >= 0) fcnt[i - len + 1] += val[rt];
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << setprecision(32);
  cin >> s;
  n = s.size();
  int m;
  cin >> m;
  vector<string> t(m);
  for (int i = 0; i < m; i++) {
    cin >> t[i];
  }
  sort(t.begin(), t.end(),
       [&](string &a, string &b) { return a.size() < b.size(); });
  memset(fcnt, 0, sizeof(fcnt));
  memset(bcnt, 0, sizeof(bcnt));
  ptr = 0;
  for (int i = 0; i < m; i++) {
    int j = i;
    while (j + 1 < m && t[j + 1].size() == t[i].size()) j++;
    while (ptr >= 0) {
      clear();
      ptr--;
    }
    ptr = 1;
    for (int k = i; k <= j; k++) {
      insert(t[k]);
    }
    add_links();
    run(t[i].size());
    i = j;
  }
  long long ans = 0;
  for (int i = 1; i < n; i++) {
    ans += fcnt[i] * bcnt[i - 1];
  }
  cout << ans << endl;
  return 0;
}
