//
// Created by Dmitry Gorbunov on 05/08/2017.
//
//
// Created by Dmitry Gorbunov on 01/08/2017.
//
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <set>
#include <bitset>
#include <map>
#include <deque>
#include <string>
#include <algorithm>
#include <numeric>
#include <cstdio>
#include <cassert>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#define pb push_back
#define pbk pop_back
#define mp make_pair
#define fs first
#define sc second
#define all(x) (x).begin(), (x).end()
#define foreach(i, a) for (__typeof((a).begin()) i = (a).begin(); i != (a).end(); ++i)
#define len(a) ((int) (a).size())
#ifdef CUTEBMAING
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define eprintf(...) 42
#endif
using namespace std;
typedef long long int64;
typedef long double ld;
typedef unsigned long long lint;
const int inf = (1 << 30) - 1;
const int64 linf = (1ll << 62) - 1;
const int N = static_cast<int>(1e5 + 100);
const int MAX_INCREASE = static_cast<int>(1e6 + 100);
const int s = 0;
int n, m, q;
int a[N], b[N], c[N];
namespace graph {
int first[N], next[N], from[N], to[N], cost[N], w[N];
inline void clear() {
fill_n(first, n, -1);
fill_n(next, n, -1);
}
inline void addEdge(int i, int u, int v, int c) {
graph::from[i] = u, graph::to[i] = v, graph::cost[i] = c;
graph::next[i] = graph::first[u];
graph::first[u] = i;
}
}
int64 dist[N];
bool used[N];
void initialDijkstra() {
fill_n(dist, n, linf);
dist[s] = 0;
set<pair<int, int>> q = { { dist[s], s } };
while (!q.empty()) {
int v = q.begin()->second;
q.erase(q.begin());
used[v] = true;
for (int edge = graph::first[v]; edge != -1; edge = graph::next[edge]) {
int to = graph::to[edge], cost = graph::cost[edge];
if (dist[to] > dist[v] + cost) {
q.erase(make_pair(dist[to], to));
dist[to] = dist[v] + cost;
q.insert(make_pair(dist[to], to));
}
}
}
}
int total = 0;
namespace queue {
int first[MAX_INCREASE], vertex[N], next[N], cc = 0;
inline void clear() {
fill_n(first, total, -1);
cc = 0;
}
inline void addToQueue(int dist, int vertex) {
queue::vertex[cc] = vertex;
queue::next[cc] = queue::first[dist];
queue::first[dist] = cc++;
}
}
void recalc() {
queue::clear();
for (int i = 0; i < m; i++) {
if (graph::cost[i] + dist[graph::from[i]] - dist[graph::to[i]] > total) {
graph::w[i] = inf;
} else {
graph::w[i] = static_cast<int>(graph::cost[i] + dist[graph::from[i]] - dist[graph::to[i]]);
}
}
static int potentialDist[N];
fill_n(potentialDist, n, inf);
potentialDist[s] = 0;
queue::addToQueue(potentialDist[s], s);
for (int i = 0; i <= total; i++) {
while (queue::first[i] != -1) {
int start = queue::first[i];
queue::first[i] = -1;
for (int index = start; index != -1; index = queue::next[index]) {
int v = queue::vertex[index];
if (potentialDist[v] != i) {
continue;
}
for (int edge = graph::first[v]; edge != -1; edge = graph::next[edge]) {
int to = graph::to[edge], cost = graph::w[edge];
int newDistance = potentialDist[v] + cost;
if (newDistance <= total && potentialDist[to] > newDistance) {
potentialDist[to] = newDistance;
queue::addToQueue(potentialDist[to], to);
}
}
}
}
}
for (int i = 0; i < n; i++) {
dist[i] += potentialDist[i];
}
total = 0;
}
int main() {
cin >> n >> m >> q;
graph::clear();
for (int i = 0; i < m; i++) {
int u, v, c; scanf("%d%d%d", &u, &v, &c), u--, v--;
graph::addEdge(i, u, v, c);
}
initialDijkstra();
for (int i = 0; i < q; i++) {
int t; scanf("%d", &t);
if (t == 1) {
int v; scanf("%d", &v); v--;
if (total > 0) {
recalc();
}
if (used[v]) {
printf("%lld\n", dist[v]);
} else {
printf("-1\n");
}
} else if (t == 2) {
int c; scanf("%d", &c);
for (int j = 0; j < c; j++) {
int edge; scanf("%d", &edge); edge--;
++graph::cost[edge];
}
total += c;
} else {
assert(false);
}
}
return 0;
}
Ly8KLy8gQ3JlYXRlZCBieSBEbWl0cnkgR29yYnVub3Ygb24gMDUvMDgvMjAxNy4KLy8KCi8vCi8vIENyZWF0ZWQgYnkgRG1pdHJ5IEdvcmJ1bm92IG9uIDAxLzA4LzIwMTcuCi8vCgojaW5jbHV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To6YWRkVG9RdWV1ZShwb3RlbnRpYWxEaXN0W3RvXSwgdG8pOwogICAgICAgICAgfQogICAgICAgIH0KICAgICAgfQogICAgfQogIH0KICBmb3IgKGludCBpID0gMDsgaSA8IG47IGkrKykgewogICAgZGlzdFtpXSArPSBwb3RlbnRpYWxEaXN0W2ldOwogIH0KICB0b3RhbCA9IDA7Cn0KCmludCBtYWluKCkgewogIGNpbiA+PiBuID4+IG0gPj4gcTsKICBncmFwaDo6Y2xlYXIoKTsKICBmb3IgKGludCBpID0gMDsgaSA8IG07IGkrKykgewogICAgaW50IHUsIHYsIGM7IHNjYW5mKCIlZCVkJWQiLCAmdSwgJnYsICZjKSwgdS0tLCB2LS07CiAgICBncmFwaDo6YWRkRWRnZShpLCB1LCB2LCBjKTsKICB9CiAgaW5pdGlhbERpamtzdHJhKCk7CiAgZm9yIChpbnQgaSA9IDA7IGkgPCBxOyBpKyspIHsKICAgIGludCB0OyBzY2FuZigiJWQiLCAmdCk7CiAgICBpZiAodCA9PSAxKSB7CiAgICAgIGludCB2OyBzY2FuZigiJWQiLCAmdik7IHYtLTsKICAgICAgaWYgKHRvdGFsID4gMCkgewogICAgICAgIHJlY2FsYygpOwogICAgICB9CiAgICAgIGlmICh1c2VkW3ZdKSB7CiAgICAgICAgcHJpbnRmKCIlbGxkXG4iLCBkaXN0W3ZdKTsKICAgICAgfSBlbHNlIHsKICAgICAgICBwcmludGYoIi0xXG4iKTsKICAgICAgfQogICAgfSBlbHNlIGlmICh0ID09IDIpIHsKICAgICAgaW50IGM7IHNjYW5mKCIlZCIsICZjKTsKICAgICAgZm9yIChpbnQgaiA9IDA7IGogPCBjOyBqKyspIHsKICAgICAgICBpbnQgZWRnZTsgc2NhbmYoIiVkIiwgJmVkZ2UpOyBlZGdlLS07CiAgICAgICAgKytncmFwaDo6Y29zdFtlZGdlXTsKICAgICAgfQogICAgICB0b3RhbCArPSBjOwogICAgfSBlbHNlIHsKICAgICAgYXNzZXJ0KGZhbHNlKTsKICAgIH0KICB9CiAgcmV0dXJuIDA7Cn0=