#include <bits/stdc++.h>
using namespace std;
template <typename IndexType, typename WeightType, typename DisType,
          size_t MAX_N>
void dijkstra(int n, vector<pair<IndexType, WeightType> > nei[],
              DisType (&dis)[MAX_N], int src = 0) {
  const DisType INF = numeric_limits<DisType>::max();
  bool* mark = new bool[n];
  fill(dis, dis + n, INF);
  memset(mark, 0, n);
  dis[src] = 0;
  set<pair<DisType, int> > s;
  for (int i = 0; i < n; ++i) {
    s.insert(make_pair(dis[i], i));
  }
  for (int i = 0; i < n - 1; ++i) {
    int v = (*s.begin()).second;
    if (dis[v] == INF) break;
    s.erase(s.begin());
    mark[v] = 1;
    for (int j = 0; j < (int)nei[v].size(); ++j) {
      int u = nei[v][j].first;
      if (!mark[u]) {
        s.erase(make_pair(dis[u], u));
        dis[u] = min(dis[u], dis[v] + nei[v][j].second);
        s.insert(make_pair(dis[u], u));
      }
    }
  }
  delete[] mark;
  for (int i = 0; i < n; ++i)
    if (dis[i] == INF) dis[i] = -1;
}
const int MAX_N = 1E5 + 10;
int n, m, k;
vector<pair<int, int> > nei[MAX_N];
pair<int, int> train[MAX_N];
long long dis[MAX_N];
int ans;
int main() {
  cin >> n >> m >> k;
  for (int i = 0; i < m; ++i) {
    int u, v, w;
    cin >> u >> v >> w;
    --u;
    --v;
    nei[u].push_back(pair<int, int>(v, w));
    nei[v].push_back(pair<int, int>(u, w));
  }
  for (int i = 0; i < k; ++i) {
    int u, w;
    cin >> u >> w;
    --u;
    train[i] = pair<int, int>(u, w);
  }
  sort(train, train + k);
  for (int i = 0; i < k - 1; ++i) {
    if (train[i].first == train[i + 1].first) {
      ++ans;
      if (train[i].second >= train[i + 1].second) {
        train[i].first = -1;
      } else {
        train[i + 1].first = -1;
        swap(train[i], train[i + 1]);
      }
    }
  }
  for (int i = 0; i < k; ++i) {
    int u = train[i].first;
    int w = train[i].second;
    if (u == -1) continue;
    nei[0].push_back(pair<int, int>(u, w));
    nei[u].push_back(pair<int, int>(0, w));
  }
  dijkstra(n, nei, dis);
  for (int i = 0; i < k; ++i) {
    int v = train[i].first;
    if (v == -1) continue;
    bool f = 0;
    for (int j = 0; j < (int)nei[v].size(); ++j) {
      int u = nei[v][j].first;
      int w = nei[v][j].second;
      if (!f && u == 0 && w == train[i].second) {
        f = 1;
        continue;
      }
      if (dis[u] + w == dis[v]) {
        ++ans;
        break;
      }
    }
  }
  cout << ans << endl;
  return 0;
}
