#include <bits/stdc++.h>
using namespace std;
int T[300100][30], cnt = 0, val[300100], fa[300100];
string s, t, ss[300010], tt;
vector<int> g[300100];
queue<int> q;
void insert(int x, int n, int f) {
  if (x == n) {
    val[f]++;
    return;
  }
  int v = s[x] - 'a';
  if (T[f][v] == 0) T[f][v] = ++cnt;
  insert(x + 1, n, T[f][v]);
}
void build() {
  int i, v, u;
  for (i = 0; i < 27; i++) {
    if (T[0][i]) {
      q.push(T[0][i]);
      fa[T[0][i]] = 0;
      g[0].push_back(T[0][i]);
    }
  }
  for (; q.size(); q.pop()) {
    u = q.front();
    for (i = 0; i < 27; i++) {
      v = T[u][i];
      if (v == 0)
        T[u][i] = T[fa[u]][i];
      else {
        fa[v] = T[fa[u]][i];
        g[fa[v]].push_back(v);
        q.push(v);
      }
    }
  }
}
void dfs(int u) {
  int i, v;
  for (i = 0; i < g[u].size(); i++) {
    v = g[u][i];
    val[v] += val[u];
    dfs(v);
  }
}
long long A[300010], B[300010];
int main() {
  int j, v, i, n, m;
  cin >> tt;
  scanf("%d", &m);
  for (i = 1; i <= m; i++) cin >> ss[i];
  for (i = 1; i <= m; i++) {
    s = "";
    for (j = 0; j < ss[i].size(); j++) s += ss[i][j];
    insert(0, s.size(), 0);
  }
  build();
  dfs(0);
  int p = 0;
  t = tt;
  for (i = 0; i < t.size(); i++) {
    v = t[i] - 'a';
    p = T[p][v];
    A[i] = val[p];
  }
  memset(T, 0, sizeof(T));
  memset(fa, 0, sizeof(fa));
  memset(val, 0, sizeof(val));
  for (i = 0; i <= 200000; i++) g[i].clear();
  cnt = 0;
  for (i = 1; i <= m; i++) {
    s = "";
    for (j = ss[i].size() - 1; j >= 0; j--) s += ss[i][j];
    insert(0, s.size(), 0);
  }
  build();
  dfs(0);
  p = 0;
  t = "";
  for (i = tt.size() - 1; i >= 0; i--) t += tt[i];
  for (i = 0; i < t.size(); i++) {
    v = t[i] - 'a';
    p = T[p][v];
    B[i] = val[p];
  }
  long long ans = 0, x;
  for (i = 0; i < t.size(); i++) {
    x = i + 1;
    x = t.size() - 1 - x;
    if (x >= 0) ans += A[i] * B[x];
  }
  cout << ans << endl;
  return 0;
}
