#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 100;
struct Node {
  int go[26], nxt[26];
  int cnt;
  int link, par, id;
  Node() {}
  Node(int par, int id) : par(par), id(id) {
    memset(go, -1, sizeof go);
    memset(nxt, -1, sizeof nxt);
    link = -1;
    cnt = 0;
  }
} tree[N];
int nTree;
void Init() {
  tree[0] = Node(-1, -1);
  nTree = 1;
}
void AddString(string st) {
  int p = 0;
  for (char c : st) {
    int id = c - 'a';
    if (tree[p].nxt[id] == -1) {
      tree[nTree] = Node(p, id);
      tree[p].nxt[id] = nTree++;
    }
    p = tree[p].nxt[id];
  }
  tree[p].cnt++;
}
int Go(int u, int id);
int Link(int u) {
  if (tree[u].link == -1) {
    if (u == 0 || tree[u].par == 0)
      tree[u].link = 0;
    else
      tree[u].link = Go(Link(tree[u].par), tree[u].id);
  }
  return tree[u].link;
}
int Go(int u, int id) {
  if (tree[u].go[id] == -1) {
    if (tree[u].nxt[id] != -1)
      tree[u].go[id] = tree[u].nxt[id];
    else {
      if (u == 0)
        tree[u].go[id] = 0;
      else
        tree[u].go[id] = Go(Link(u), id);
    }
  }
  return tree[u].go[id];
}
void BuildValue() {
  queue<int> q;
  q.push(0);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    tree[u].cnt += tree[Link(u)].cnt;
    for (int i = 0; i < 26; ++i)
      if (tree[u].nxt[i] != -1) q.push(tree[u].nxt[i]);
  }
}
int f[N];
void Calc(string t) {
  int p = 0;
  int i = 0;
  for (char c : t) {
    int id = c - 'a';
    p = Go(p, id);
    f[i++] = tree[p].cnt;
  }
}
string s[N];
int Left[N], Right[N];
int main() {
  string t;
  int n;
  cin >> t >> n;
  for (int i = 0; i < n; ++i) cin >> s[i];
  Init();
  for (int i = 0; i < n; ++i) AddString(s[i]);
  BuildValue();
  Calc(t);
  for (int i = 0; i < t.size(); ++i) Left[i] = f[i];
  reverse(t.begin(), t.end());
  Init();
  for (int i = 0; i < n; ++i) {
    reverse(s[i].begin(), s[i].end());
    AddString(s[i]);
  }
  BuildValue();
  Calc(t);
  for (int i = 0; i < t.size(); ++i) Right[i] = f[t.size() - i - 1];
  long long ans = 0;
  for (int i = 0; i < (int)t.size() - 1; ++i) {
    ans += 1ll * Left[i] * Right[i + 1];
  }
  cout << ans;
}
