#include <bits/stdc++.h>
using namespace std;
char IN;
bool NEG;
inline void Int(int &x) {
  NEG = 0;
  while (!isdigit(IN = getchar()))
    if (IN == '-') NEG = 1;
  x = IN - '0';
  while (isdigit(IN = getchar())) x = x * 10 + IN - '0';
  if (NEG) x = -x;
}
inline void LL(long long &x) {
  NEG = 0;
  while (!isdigit(IN = getchar()))
    if (IN == '-') NEG = 1;
  x = IN - '0';
  while (isdigit(IN = getchar())) x = x * 10 + IN - '0';
  if (NEG) x = -x;
}
const int MAXN = 2e5 + 5;
const long long INF = 1e18;
struct node {
  int y, val;
  bool is;
  node() {}
  node(int _y, int _val, int _is) : y(_y), val(_val), is(_is) {}
};
vector<node> adj[MAXN];
int n, m, k;
queue<int> q;
long long dis[MAXN];
bool pre[MAXN];
bool use[MAXN];
void spfa() {
  for (int i = 1; i <= n; i++) {
    dis[i] = INF;
    pre[i] = 1;
  }
  memset(use, 0, sizeof(use));
  dis[1] = 0;
  q.push(1);
  use[1] = 1;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    use[x] = false;
    for (int i = 0; i < (int)adj[x].size(); i++) {
      int y = adj[x][i].y;
      int val = adj[x][i].val;
      if (dis[y] > dis[x] + val) {
        dis[y] = dis[x] + val;
        pre[y] = adj[x][i].is;
        if (!use[y]) {
          use[y] = true;
          q.push(y);
        }
      } else if (dis[y] == dis[x] + val)
        pre[y] = pre[y] && adj[x][i].is;
    }
  }
  int ans = 0;
  for (int i = 2; i <= n; i++) {
    ans += pre[i];
  }
  cout << k - ans << endl;
}
int main() {
  scanf("%d%d%d", &n, &m, &k);
  int x, y, val;
  for (int i = 0; i < m; i++) {
    Int(x);
    Int(y);
    Int(val);
    adj[x].push_back(node(y, val, 0));
    adj[y].push_back(node(x, val, 0));
  }
  x = 1;
  for (int i = 0; i < k; i++) {
    Int(y);
    Int(val);
    adj[x].push_back(node(y, val, 1));
    adj[y].push_back(node(x, val, 1));
  }
  spfa();
  return 0;
}
