C++ Short Solution
\n#define MOD 1000000007\n#define INF INT_MAX\nclass Solution {\npublic:\n  using pii = pair<int, int>;\n  int countRestrictedPaths(int n, vector<vector<int>>& 
```\n#define MOD 1000000007\n#define INF INT_MAX\nclass Solution {\npublic:\n  using pii = pair<int, int>;\n  int countRestrictedPaths(int n, vector<vector<int>>& edges) {\n    vector<int> dist(n, INF); dist[n - 1] = 0;\n    priority_queue<pii, vector<pii>, greater<pii>> pq; pq.push({0, n - 1});\n    vector<vector<pii>> graph(n);\n    vector<int> dp(n, 0); dp[n - 1] = 1;\n    vector<bool> vis(n, false);\n    for (auto&& edge : edges) {\n      graph[edge[0] - 1].push_back({edge[1] - 1, edge[2]});\n      graph[edge[1] - 1].push_back({edge[0] - 1, edge[2]});\n    }\n    while (pq.size()) {\n      const int u = pq.top().second; pq.pop();\n      for (auto&&[v, weight] : graph[u]) {\n        if (dist[v] > dist[u] + weight) {\n          dist[v] = dist[u] + weight;\n          pq.push({dist[v], v});\n        }\n        if (!vis[u] && dist[v] > dist[u]) {\n          dp[v] = (dp[u] + dp[v]) % MOD;\n        }\n      }\n      vis[u] = true;\n    }\n    return dp[0];\n  }\n};\n```
['C']