#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
const int S = 26;
int rec[2][N];
struct Aho_Corasick_Automaton {
  int sz, root;
  vector<vector<int> > nextt;
  vector<int> fail, cnt;
  inline int idx(char c) { return c - 'a'; }
  inline int newNode() {
    cnt.push_back(0);
    nextt.push_back(vector<int>(S, 0));
    return sz++;
  }
  void init() {
    sz = 0;
    nextt.clear();
    cnt.clear();
    fail.clear();
    root = newNode();
  }
  void insert(const char* s) {
    int u = root;
    for (; *s; s++) {
      int c = idx(*s);
      int& v = nextt[u][c];
      if (!v) v = newNode();
      u = v;
    }
    cnt[u]++;
  }
  void build() {
    vector<int> q;
    fail.resize(nextt.size());
    fail[root] = root;
    for (int i = 0; i < S; i++) {
      int& v = nextt[root][i];
      if (v) {
        fail[v] = root;
        q.push_back(v);
      } else
        v = root;
    }
    for (int k = 0; k < q.size(); k++) {
      int u = q[k];
      for (int i = 0; i < S; i++) {
        int& v = nextt[u][i];
        if (v) {
          fail[v] = nextt[fail[u]][i];
          cnt[v] += cnt[nextt[fail[u]][i]];
          q.push_back(v);
        } else
          v = nextt[fail[u]][i];
      }
    }
  }
  void query(const char* s, int id) {
    int u = root, tot = 0;
    for (; *s; s++, tot++) {
      int c = idx(*s);
      u = nextt[u][c];
      rec[id][tot] = cnt[u];
    }
  }
};
Aho_Corasick_Automaton AC1, AC2;
char s[N], t[N];
int main() {
  int m, n, len;
  long long ans;
  scanf("%s", s + 1);
  m = strlen(s + 1);
  AC1.init();
  AC2.init();
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%s", t + 1);
    len = strlen(t + 1);
    AC1.insert(t + 1);
    reverse(t + 1, t + len + 1);
    AC2.insert(t + 1);
  }
  AC1.build();
  AC1.query(s + 1, 0);
  reverse(s + 1, s + m + 1);
  AC2.build();
  AC2.query(s + 1, 1);
  ans = 0;
  for (int i = 0; i < m - 1; i++) ans += 1LL * rec[0][i] * rec[1][m - 2 - i];
  printf("%I64d\n", ans);
  return 0;
}
