// clang-format off
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define loop(i, a, n) for (int i = (a); i < (n); i++)
#define rep(i, n) loop(i, 0, n)
#define all(v) (v).begin(), (v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define prec(n) fixed << setprecision(n)
constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000;
constexpr int MOD = 1000000007;
constexpr double PI = 3.14159265358979;
template<typename A, typename B> bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; }
template<typename A, typename B> bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; }
bool odd(const int &n) { return n & 1; }
bool even(const int &n) { return ~n & 1; }
template<typename T> int len(const T &v) { return v.size(); }
template<typename T = int> T in() { T x; cin >> x; return x; }
template<typename T = int> T in(T &&x) { T z(forward<T>(x)); cin >> z; return z; }
template<typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &x : v) is >> x; return is; }
template<typename A, typename B> istream &operator>>(istream &is, pair<A, B> &p) { return is >> p.first >> p.second; }
template<typename T> ostream &operator<<(ostream &os, const vector<vector<T>> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; }
template<typename A, typename B> ostream &operator<<(ostream &os, const pair<A, B> &p) { return os << p.first << ' ' << p.second; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
// clang-format on

using Weight = int;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(const int &s = 0, const int &d = 0, const Weight &w = 0) : src(s), dst(d), weight(w) {}
};

using Edges = vector<Edge>;
using Array = vector<Weight>;
using Matrix = vector<Array>;

class Graph {
  vector<Edges> g;
  using iterator = vector<Edges>::iterator;
  using const_iterator = vector<Edges>::const_iterator;

public:
  Graph(const int &size = 0) : g(size) {}
  size_t size() const { return g.size(); }
  const Edges &operator[](const int &i) const { return g[i]; }
  Edges &operator[](const int &i) { return g[i]; }
  void addArc(const int &src, const int &dst, const Weight &w = 1) { g[src].emplace_back(src, dst, w); }
  void addEdge(const int &node1, const int &node2, const Weight &w = 1) {
    addArc(node1, node2, w);
    addArc(node2, node1, w);
  }
  iterator begin() { return g.begin(); }
  const_iterator begin() const { return g.begin(); }
  iterator end() { return g.end(); }
  const_iterator end() const { return g.end(); }
};

class HLDecomposition {
  Graph g;
  int vertexId = 0;
  vector<int> _parent; // _parent[v] := parent of v, _parent[root] = -1
  vector<int> subsize; // subsize[v] := size of subtree rooted at v
  vector<int> depth; // depth[v] := depth of v
  vector<int> next; // next[v] := next vertex of v on heavy-path, next[last] := -1
  vector<int> head; // head[v] := head vertex on heavy-path contains v
  vector<int> treeId; // treeId[v] := id of tree contains v
  vector<int> newVertexId; // newVertexId[v] := reassigned vertex id of v
  vector<int> left, right; // [left[v], right[v]) := segment of subtree

  void decompose(const int &r) {
    stack<pair<int, int>> s;
    _parent[r] = -1;
    depth[r] = 0;
    s.emplace(r, 0);
    while (s.size()) {
      int v = s.top().first;
      int &i = s.top().second;
      if (i < g[v].size()) {
        int u = g[v][i++].dst;
        if (u == _parent[v]) continue;
        _parent[u] = v;
        depth[u] = depth[v] + 1;
        s.emplace(u, 0);
      } else {
        s.pop();
        int mini = 0;
        rep(i, g[v].size()) {
          auto &e = g[v][i];
          if (e.dst == _parent[v]) swap(e, g[v].back());
          if (e.dst == _parent[v]) continue;
          subsize[v] += subsize[e.dst];
          if (subsize[e.dst] > subsize[g[v].front().dst]) swap(e, g[v].front());
        }
      }
    }
  }

  void reassign(const int &root, const int &tid) {
    stack<tuple<int, int, int>> s;
    s.emplace(root, root, 0);
    while (s.size()) {
      int v, h;
      tie(v, h, ignore) = s.top();
      int &i = get<2>(s.top());
      if (i == 0) {
        treeId[v] = tid;
        left[v] = newVertexId[v] = vertexId++;
        head[v] = h;
        if (g[v].size() && g[v][0].dst != _parent[v]) next[v] = g[v][0].dst;
      }
      if (i < g[v].size()) {
        auto &e = g[v][i++];
        if (e.dst == _parent[v]) continue;
        s.emplace(e.dst, next[v] == e.dst ? h : e.dst, 0);
      } else {
        s.pop();
        right[v] = vertexId;
      }
    }
  }

public:
  struct segment {
    int l, r; // [l, r)
    segment(const int &l, const int &r) : l(l), r(r) {}
  };

  vector<segment> vertexSegments(int u, int v) {
    vector<segment> segs;
    while (true) {
      if (newVertexId[u] > newVertexId[v]) swap(u, v);
      segs.emplace_back(max(newVertexId[u], newVertexId[head[v]]), newVertexId[v] + 1);
      if (head[u] == head[v]) break;
      v = _parent[head[v]];
    }
    return segs;
  }

  vector<segment> edgeSegments(int u, int v) {
    vector<segment> segs;
    while (true) {
      if (newVertexId[u] > newVertexId[v]) swap(u, v);
      if (head[u] == head[v]) {
        if (u != v) segs.emplace_back(newVertexId[u] + 1, newVertexId[v] + 1);
        break;
      }
      segs.emplace_back(newVertexId[head[v]], newVertexId[v] + 1);
      v = _parent[head[v]];
    }
    return segs;
  }

  int parent(const int &v) { return _parent[v]; }

  int lca(int u, int v) {
    while (true) {
      if (newVertexId[u] > newVertexId[v]) swap(u, v);
      if (head[u] == head[v]) return u;
      v = _parent[head[v]];
    }
  }

  int distance(const int &u, const int &v) { return depth[u] + depth[v] - 2 * depth[lca(u, v)]; }

  HLDecomposition(const Graph &g, const vector<int> &roots = {0})
      : g(g), _parent(g.size()), subsize(g.size(), 1), depth(g.size()), //
        next(g.size(), -1), head(g.size()), treeId(g.size()), newVertexId(g.size(), -1), //
        left(g.size()), right(g.size()) {
    int treeId = 0;
    for (auto &r : roots) decompose(r), reassign(r, treeId++);
  }
};

template<typename LSTTrait> class LazySegTree {
  using FoldMonoid = typename LSTTrait::FoldMonoid;
  using ActionMonoid = typename LSTTrait::ActionMonoid;
  using T = typename FoldMonoid::value_type;
  using Q = typename ActionMonoid::value_type;

  LSTTrait lstTrait; // apply :: (T, Q) -> T, pow :: (Q, int) -> Q
  FoldMonoid foldM;
  ActionMonoid actionM;
  int size = 1;
  vector<T> tree; // 1-indexed
  vector<Q> lazy; // 1-indexed

  void push(int i) {
    stack<pair<int, int>> s;
    for (int d = 1; i /= 2; d *= 2) s.emplace(i, d);
    for (int x, d; s.size(); s.pop()) {
      tie(x, d) = s.top();
      update(x * 2, lazy[x], d);
      update(x * 2 + 1, lazy[x], d);
      lazy[x] = actionM.id();
    }
  }

  void update(const int &i, const Q &x, const int &d) {
    tree[i] = lstTrait.apply(tree[i], lstTrait.pow(x, d));
    if (i < size) lazy[i] = actionM(lazy[i], x);
  }

  void build(int i) {
    for (int d = 2; i /= 2; d *= 2) tree[i] = lstTrait.apply(foldM(tree[i * 2], tree[i * 2 + 1]), lstTrait.pow(lazy[i], d));
  }

public:
  LazySegTree(const int &n = 0) {
    while (size < n) size *= 2;
    tree.assign(size * 2, foldM.id());
    lazy.assign(size, actionM.id());
  }

  LazySegTree(const int &n, const T &x) {
    while (size < n) size *= 2;
    tree.assign(size * 2, x);
    lazy.assign(size, actionM.id());
    for (int i = size - 1; i >= 1; i--) tree[i] = foldM(tree[i * 2], tree[i * 2 + 1]);
  }

  template<typename InputIterator> LazySegTree(InputIterator first, InputIterator last) {
    int n = distance(first, last);
    while (size < n) size *= 2;
    tree.resize(size * 2, foldM.id());
    lazy.assign(size, actionM.id());
    copy(first, last, tree.begin() + size);
    for (int i = size - 1; i >= 1; i--) tree[i] = foldM(tree[i * 2], tree[i * 2 + 1]);
  }

  void act(int l, int r, const Q &x) { // [l, r) += x
    int l0 = l += size, r0 = r += size;
    push(l0), push(r0 - 1);
    for (int d = 1; l < r; l /= 2, r /= 2, d *= 2) {
      if (l & 1) update(l++, x, d);
      if (r & 1) update(--r, x, d);
    }
    build(l0), build(r0 - 1);
  }

  void update(int i, const T &x) {
    push(i += size);
    tree[i] = x;
    while (i /= 2) tree[i] = foldM(tree[i * 2], tree[i * 2 + 1]);
  }

  T fold(int l, int r) { // [l, r)
    T accl = foldM.id(), accr = foldM.id();
    for (push(l += size), push((r += size) - 1); l < r; l /= 2, r /= 2) {
      if (l & 1) accl = foldM(accl, tree[l++]);
      if (r & 1) accr = foldM(tree[--r], accr);
    }
    return foldM(accl, accr);
  }

  T operator[](int i) { return push(i += size), tree[i]; }
};

template<typename T> class RangeSumRangeAdd {
  struct trait {
    struct FoldMonoid {
      using value_type = T;
      T id() { return T(); }
      T operator()(const T &a, const T &b) { return a + b; }
    };
    struct ActionMonoid {
      using value_type = T;
      T id() { return T(); }
      T operator()(const T &a, const T &b) { return a + b; }
    };
    T apply(const T &t, const T &q) { return t + q; }
    T pow(const T &q, const int &d) { return q * d; }
  };

  LazySegTree<trait> lst;

public:
  RangeSumRangeAdd(const int &n = 0) : lst(n) {}
  RangeSumRangeAdd(const int &n, const T &x) : lst(n, x) {}
  template<typename InputIterator> RangeSumRangeAdd(InputIterator first, InputIterator last) : lst(first, last) {}
  void add(const int &l, const int &r, const T &x) { lst.act(l, r, x); }
  void update(const int &i, const T &x) { lst.update(i, x); }
  T sum(const int &l, const int &r) { return lst.fold(l, r); }
  T operator[](const int &i) { return lst[i]; }
};

main() {
  int n = in();
  Graph g(n);
  rep(i, n) {
    int k = in();
    while (k--) g.addEdge(i, in());
  }
  HLDecomposition hld(g);
  RangeSumRangeAdd<int> rsra(n);
  int q = in();
  while (q--) {
    if (in()) {
      int sum = 0;
      for (auto &p : hld.edgeSegments(0, in())) sum += rsra.sum(p.l, p.r);
      cout << sum << endl;
    } else {
      int v, w;
      cin >> v >> w;
      for (auto &p : hld.edgeSegments(0, v)) rsra.add(p.l, p.r, w);
    }
  }
}



Measured memory_bytes: 30596