#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e6 + 5;
const long long INF = 1e18 + 7;
long long poww(long long a, long long b, long long md) {
  return (!b ? 1
             : (b & 1 ? a * poww(a * a % md, b / 2, md) % md
                      : poww(a * a % md, b / 2, md) % md));
}
long long MOD(long long a) { return ((a % INF) + INF) % INF; }
long long inv(long long a) { return poww(a, INF - 2, INF); }
vector<pair<int, pair<int, int> > > adjList[MAXN];
vector<pair<int, bool> > newAdjList[MAXN];
bool Possible[MAXN];
long long dist[MAXN], deg[MAXN], n, m, k;
int djikstra() {
  set<pair<long long, int> > s;
  for (int i = 1; i <= n; ++i) dist[i] = INF;
  dist[1] = 0;
  s.insert({0, 1});
  while (!s.empty()) {
    pair<int, int> now = *s.begin();
    s.erase(s.begin());
    for (auto u : adjList[now.second]) {
      if (now.first + u.second.first < dist[u.first]) {
        s.erase({dist[u.first], u.first});
        dist[u.first] = now.first + u.second.first;
        s.insert({dist[u.first], u.first});
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (auto u : adjList[i]) {
      if (dist[i] + u.second.first == dist[u.first]) {
        newAdjList[i].push_back({u.first, Possible[u.second.second]});
      }
    }
  }
  for (int i = 1; i <= n; ++i)
    for (auto u : newAdjList[i]) deg[u.first]++;
  int cnt = k;
  for (int i = 1; i <= n; ++i) {
    for (auto u : newAdjList[i]) {
      if (u.second) {
        if (deg[u.first] > 1)
          --deg[u.first];
        else
          --cnt;
      }
    }
  }
  return cnt;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  cin >> n >> m >> k;
  for (int i = 0; i < m; ++i) {
    int c, d, we;
    cin >> c >> d >> we;
    adjList[c].push_back({d, {we, i}});
    adjList[d].push_back({c, {we, i}});
  }
  for (int i = 0; i < k; ++i) {
    int c, we;
    cin >> c >> we;
    adjList[1].push_back({c, {we, i + m}});
    adjList[c].push_back({1, {we, i + m}});
    Possible[i + m] = 1;
  }
  cout << djikstra();
}
