#include <bits/stdc++.h>
using namespace std;
vector<vector<pair<pair<int, int>, int> > > graph(100005);
long long dist[100005];
bool visited[100005], train[100005];
int trainss[100005];
vector<pair<int, int> > trains;
bool compare(pair<int, int> a, pair<int, int> b) {
  if (a.first == b.first) return a.second > b.second;
  return a.first < b.first;
}
int main() {
  int n, m, k, x, y, z;
  cin >> n >> m >> k;
  for (int i = 1; i <= n; i++) dist[i] = -1 * (long long)(1e16);
  for (int i = 0; i < m; i++) {
    scanf("%d %d %d", &x, &y, &z);
    graph[x].push_back(make_pair(make_pair(-z, y), 0));
    graph[y].push_back(make_pair(make_pair(-z, x), 0));
  }
  for (int i = 0; i < k; i++) {
    scanf("%d %d", &x, &y);
    trains.push_back(make_pair(x, -y));
  }
  sort(trains.begin(), trains.end(), compare);
  int counter = 0;
  for (int i = 0; i < k; i++) {
    if (i == 0)
      graph[1].push_back(
          make_pair(make_pair(trains[i].second, trains[i].first), 1));
    else if (trains[i].first != trains[i - 1].first)
      graph[1].push_back(
          make_pair(make_pair(trains[i].second, trains[i].first), 1));
    else
      counter++;
  }
  priority_queue<pair<pair<long long, int>, int> > dijkstra;
  dijkstra.push(make_pair(make_pair(0, 1), 0));
  dist[1] = 0;
  while (!dijkstra.empty()) {
    int temp = dijkstra.top().first.second;
    int tempo = dijkstra.top().second;
    long long path = dijkstra.top().first.first;
    dijkstra.pop();
    if (path == dist[temp]) train[temp] = tempo;
    if (visited[temp]) continue;
    visited[temp] = true;
    train[temp] = tempo;
    for (int i = 0; i < graph[temp].size(); i++) {
      if ((!visited[graph[temp][i].first.second] &&
           graph[temp][i].first.first + dist[temp] >
               dist[graph[temp][i].first.second]) ||
          ((graph[temp][i].first.first + dist[temp] ==
                dist[graph[temp][i].first.second] &&
            !graph[temp][i].second))) {
        dist[graph[temp][i].first.second] =
            graph[temp][i].first.first + dist[temp];
        dijkstra.push(
            make_pair(make_pair(graph[temp][i].first.first + dist[temp],
                                graph[temp][i].first.second),
                      graph[temp][i].second));
      }
    }
  }
  for (int i = 0; i < k; i++) {
    if (i && trains[i].first == trains[i - 1].first) continue;
    if (trains[i].second < dist[trains[i].first])
      counter++;
    else if (!train[trains[i].first])
      counter++;
  }
  cout << counter;
  return 0;
}
