#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
const int maxm = 2e5 + 10;
int trie1[maxm][27], cntword1[maxm], flag1[maxm], fail1[maxm], last1[maxm],
    ed[maxm], st[maxm];
int trie2[maxm][27], cntword2[maxm], flag2[maxm], fail2[maxm], last2[maxm];
int cnt1, cnt2;
char s[maxm], t[maxm], re[maxm], rr[maxm];
void insert(char ss[], int len) {
  int rt = 0;
  for (int i = 0; i < len; i++) {
    int nxt = ss[i] - 'a';
    if (!trie1[rt][nxt]) trie1[rt][nxt] = ++cnt1;
    rt = trie1[rt][nxt];
  }
  flag1[rt]++;
}
void getfail() {
  queue<int> q;
  for (int i = 0; i < 26; i++) {
    if (trie1[0][i]) {
      fail1[trie1[0][i]] = 0;
      q.push(trie1[0][i]);
    }
  }
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    flag1[now] += flag1[fail1[now]];
    for (int i = 0; i < 26; i++) {
      if (trie1[now][i]) {
        fail1[trie1[now][i]] = trie1[fail1[now]][i];
        q.push(trie1[now][i]);
      } else
        trie1[now][i] = trie1[fail1[now]][i];
    }
  }
}
void query(char ss[]) {
  int now = 0, ans = 0;
  int len = strlen(ss + 1);
  for (int i = 0; i < len; i++) {
    now = trie1[now][ss[i] - 'a'];
    ed[i] += flag1[now];
  }
}
void insert2(char ss[], int len) {
  int rt = 0;
  for (int i = 0; i < len; i++) {
    int nxt = ss[i] - 'a';
    if (!trie2[rt][nxt]) trie2[rt][nxt] = ++cnt2;
    rt = trie2[rt][nxt];
  }
  flag2[rt]++;
}
void getfail2() {
  queue<int> q;
  for (int i = 0; i < 26; i++) {
    if (trie2[0][i]) {
      fail2[trie2[0][i]] = 0;
      q.push(trie2[0][i]);
    }
  }
  while (!q.empty()) {
    int now = q.front();
    q.pop();
    flag2[now] += flag2[fail2[now]];
    for (int i = 0; i < 26; i++) {
      if (trie2[now][i]) {
        fail2[trie2[now][i]] = trie2[fail2[now]][i];
        last2[trie2[now][i]] = flag2[fail2[trie2[now][i]]]
                                   ? fail2[trie2[now][i]]
                                   : last2[fail2[trie2[now][i]]];
        q.push(trie2[now][i]);
      } else
        trie2[now][i] = trie2[fail2[now]][i];
    }
  }
}
void query2(char ss[]) {
  int now = 0, ans = 0;
  int len = strlen(ss);
  for (int i = 0; i < len; i++) {
    now = trie2[now][ss[i] - 'a'];
    st[i] += flag2[now];
  }
}
int main() {
  scanf("%s", s);
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", t);
    int len = strlen(t);
    insert(t, len);
    for (int i = 0; i < len; i++) {
      re[i] = t[len - i - 1];
    }
    insert2(re, len);
  }
  getfail();
  query(s);
  getfail2();
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    rr[i] = s[len - i - 1];
  }
  query2(rr);
  long long ans = 0;
  for (int i = 0; i < len; i++) {
    ans = ans + 1ll * ed[i] * st[len - i - 2];
  }
  printf("%I64d\n", ans);
  return 0;
}
