#include <bits/stdc++.h>
using namespace std;
struct node {
  int id;
  long long d;
  node(int _id, long long _d) {
    id = _id;
    d = _d;
  }
  node() {}
};
vector<int> W[100005], L[100005];
vector<int> WT[100005], LT[100005];
bool operator<(node n1, node n2) { return n1.d > n2.d; }
long long D[100005];
bool best[100005];
void Dijkstra(int source) {
  priority_queue<node> Q;
  Q.push(node(source, 0));
  memset(D, -1, sizeof D);
  D[source] = 0;
  while (!Q.empty()) {
    node pd = Q.top();
    Q.pop();
    if (best[pd.id]) continue;
    best[pd.id] = true;
    int to, w;
    for (int i = 0; i < L[pd.id].size(); i++) {
      to = L[pd.id][i];
      w = W[pd.id][i];
      if (D[to] == -1 || D[to] > pd.d + w) Q.push(node(to, D[to] = pd.d + w));
    }
    for (int i = 0; i < LT[pd.id].size(); i++) {
      to = LT[pd.id][i];
      w = WT[pd.id][i];
      if (D[to] == -1 || D[to] > pd.d + w) Q.push(node(to, D[to] = pd.d + w));
    }
  }
}
bool vis[100005], have[100005];
int Y[100005], WY[100005];
int main() {
  int n, m, k;
  while (scanf("%d%d%d", &n, &m, &k) == 3) {
    int x, y, w;
    for (int i = 0; i < m; i++) {
      scanf("%d%d%d", &x, &y, &w);
      L[x].push_back(y), L[y].push_back(x);
      W[x].push_back(w), W[y].push_back(w);
    }
    for (int i = 0; i < k; i++) {
      scanf("%d%d", &Y[i], &WY[i]);
      LT[1].push_back(Y[i]);
      LT[Y[i]].push_back(1);
      WT[1].push_back(WY[i]);
      WT[Y[i]].push_back(WY[i]);
    }
    Dijkstra(1);
    int ans = k;
    for (int i = 1; i <= n; i++) {
      for (int j = 0; j < L[i].size(); j++) {
        int to = L[i][j];
        int w = W[i][j];
        if (D[i] == D[to] + w) {
          have[i] = true;
          break;
        }
      }
    }
    for (int i = 0; i < k; i++) {
      int id = Y[i];
      if (WY[i] != D[id])
        ans--;
      else {
        if (have[id])
          ans--;
        else {
          if (!vis[id])
            vis[id] = true;
          else
            ans--;
        }
      }
    }
    printf("%d\n", k - ans);
  }
}
