#include <bits/stdc++.h>
using namespace std;
const int M = 2e5 + 10;
const int K = 26;
struct node {
  int par = -1, link = -1, elink = -1;
  char pch;
  bool leaf = false, mark = false;
  int val = 0;
  vector<int> next, go;
  node(int par = -1, char ch = '$')
      : par(par), pch(ch), next(K, -1), go(K, -1) {}
};
class Aho {
 public:
  vector<node> t;
  Aho() { t = vector<node>(1); }
  void add(const string& s) {
    int u = 0;
    for (char ch : s) {
      int c = ch - 'a';
      if (t[u].next[c] < 0) {
        t[u].next[c] = (int)t.size();
        t.emplace_back(u, ch);
      }
      u = t[u].next[c];
    }
    t[u].leaf = true;
    t[u].val++;
  }
  int get_elink(int u) {
    if (t[u].elink < 0) {
      int v = get_link(u);
      if (!u or !v)
        t[u].elink = 0;
      else
        t[u].elink = t[v].leaf ? v : get_elink(v);
    }
    return t[u].elink;
  }
  int get_link(int u) {
    if (t[u].link < 0) {
      t[u].link = (!u or !t[u].par) ? 0 : go(get_link(t[u].par), t[u].pch);
    }
    return t[u].link;
  }
  int go(int u, char ch) {
    int c = ch - 'a';
    if (t[u].go[c] < 0) {
      t[u].go[c] =
          (t[u].next[c] != -1) ? t[u].next[c] : (!u ? 0 : go(get_link(u), ch));
    }
    return t[u].go[c];
  }
  int process(int u) {
    if (t[u].mark) return t[u].val;
    t[u].mark = true;
    return t[u].val += process(get_elink(u));
  }
  void process() {
    for (int u = 0; u < (int)t.size(); ++u) {
      if (!t[u].mark) process(u);
    }
  }
  vector<int> get(const string& s) {
    int n = (int)(s).size(), u = 0;
    vector<int> cnt(n, 0);
    for (int i = 0; i < n; ++i) {
      u = go(u, s[i]);
      cnt[i] = t[u].val;
    }
    return cnt;
  }
};
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string t;
  cin >> t;
  int n;
  cin >> n;
  string s[n];
  Aho at;
  for (int i = 0; i < n; ++i) cin >> s[i], at.add(s[i]);
  at.process();
  auto cnt = at.get(t);
  Aho atr;
  reverse((t).begin(), (t).end());
  for (int i = 0; i < n; ++i) {
    reverse((s[i]).begin(), (s[i]).end());
    atr.add(s[i]);
  }
  atr.process();
  auto cntr = atr.get(t);
  reverse((cntr).begin(), (cntr).end());
  long long ans = 0;
  n = (int)(cnt).size();
  for (int i = 0; i < n - 1; ++i) ans += cnt[i] * 1ll * cntr[i + 1];
  cout << ans;
  return 0;
}
