#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2e5 + 10;
const int MAXC = 26;
int base = 'a';
struct aho_corasick {
  int N, cnt = 0;
  vector<vector<int>> T;
  vector<long long> term, fail;
  aho_corasick() {}
  aho_corasick(int N) : N(N), cnt(0) {
    T.resize(N, vector<int>(MAXC, 0));
    term.resize(N, 0LL);
    fail.resize(N, 0LL);
  }
  void insert(string x) {
    int pos = 0;
    for (int i = 0; i < x.size(); i++) {
      if (T[pos][x[i] - base] == 0) T[pos][x[i] - base] = ++cnt;
      pos = T[pos][x[i] - base];
    }
    term[pos]++;
  }
  void make_failure() {
    queue<int> Q;
    for (int i = 0; i < MAXC; i++)
      if (T[0][i]) Q.push(T[0][i]);
    while (Q.size()) {
      int here = Q.front();
      Q.pop();
      for (int i = 0; i < MAXC; i++)
        if (T[here][i]) {
          int pos = fail[here], there = T[here][i];
          while (pos && T[pos][i] == 0) pos = fail[pos];
          fail[there] = T[pos][i];
          term[there] += term[T[pos][i]];
          Q.push(there);
        }
    }
  }
};
string S;
int N;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  cin >> S;
  aho_corasick aho1 = aho_corasick(MAXN), aho2 = aho_corasick(MAXN);
  cin >> N;
  for (int i = 0; i < N; i++) {
    string s;
    cin >> s;
    aho1.insert(s);
    reverse(s.begin(), s.end());
    aho2.insert(s);
  }
  aho1.make_failure();
  aho2.make_failure();
  int pos = 0;
  vector<long long> D1 = vector<long long>(S.size(), 0LL);
  for (int i = 0; i < S.size(); i++) {
    while (pos && aho1.T[pos][S[i] - base] == 0) pos = aho1.fail[pos];
    pos = aho1.T[pos][S[i] - base];
    D1[i] = aho1.term[pos];
  }
  pos = 0;
  vector<long long> D2 = vector<long long>(S.size(), 0LL);
  for (int i = S.size() - 1; i >= 0; i--) {
    while (pos && aho2.T[pos][S[i] - base] == 0) pos = aho2.fail[pos];
    pos = aho2.T[pos][S[i] - base];
    D2[i] = aho2.term[pos];
  }
  long long ans = 0;
  for (int i = 0; i + 1 < S.size(); i++) ans += D1[i] * D2[i + 1];
  cout << ans << '\n';
  return 0;
}
