#include <bits/stdc++.h>
using namespace std;
int cx[] = {-1, 0, 0, 1, -1, -1, 1, 1, 0},
    cy[] = {0, -1, 1, 0, -1, 1, 1, -1, 0};
int ingrid(int ii, int jj, int R, int C) {
  if (ii < 0 || jj < 0 || ii >= R || jj >= C) return 0;
  return 1;
}
vector<pair<string, int> > V;
int main() {
  int n, m;
  double k;
  cin >> n >> m >> k;
  k *= 1000;
  for (int i = 0; i < n; i++) {
    string skill;
    int lvl;
    cin >> skill >> lvl;
    if (lvl * k >= 100000) {
      V.push_back(make_pair(skill, (int)(lvl * k) / 1000));
    }
  }
  for (int i = 0; i < m; i++) {
    string skill;
    cin >> skill;
    int ch = 0;
    for (int j = 0; j < V.size(); j++)
      if (V[j].first == skill) ch = 1;
    if (ch == 0) V.push_back(make_pair(skill, 0));
  }
  sort(V.begin(), V.end());
  printf("%d\n", V.size());
  for (int i = 0; i < V.size(); i++) {
    cout << V[i].first << " " << V[i].second << endl;
  }
  return 0;
}
