#include <bits/stdc++.h>
#define ll long long
#define INF 1000000005
#define MOD 1000000007
#define EPS 1e-10
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;--i)
#define srep(i,s,t) for(int i=(int)(s);i<(int)(t);++i)
#define each(a,b) for(auto& (a): (b))
#define all(v) (v).begin(),(v).end()
#define len(v) (int)(v).size()
#define zip(v) sort(all(v)),v.erase(unique(all(v)),v.end())
#define cmx(x,y) x=max(x,y)
#define cmn(x,y) x=min(x,y)
#define fi first
#define se second
#define pb push_back
#define show(x) cout<<#x<<" = "<<(x)<<endl
#define sar(a,n) cout<<#a<<":";rep(pachico,n)cout<<" "<<a[pachico];cout<<endl

using namespace std;

template<typename S,typename T>auto&operator<<(ostream&o,pair<S,T>p){return o<<"{"<<p.fi<<","<<p.se<<"}";}
template<typename T>auto&operator<<(ostream&o,set<T>s){for(auto&e:s)o<<e<<" ";return o;}
template<typename S,typename T,typename U>
auto&operator<<(ostream&o,priority_queue<S,T,U>q){while(!q.empty())o<<q.top()<<" ",q.pop();return o;}
template<typename K,typename T>auto&operator<<(ostream&o,map<K,T>m){for(auto&e:m)o<<e<<" ";return o;}
template<typename T>auto&operator<<(ostream&o,vector<T>v){for(auto&e:v)o<<e<<" ";return o;}
void ashow(){}template<typename T,typename...A>void ashow(T t,A...a){cout<<t<<endl;ashow(a...);}

typedef pair<int,int> P;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef vector<string> vs;

const int MAX_N = 100005;

template<typename T> class LinkCutTree{
public:
    struct node {
        int id, sz;
        T val, lazy, al;
        node *left, *right, *par;
        bool rev;
        node(int num) : id(num), left(nullptr), right(nullptr), par(nullptr), rev(false){}
        static const T id1 = (T)0;
        static const T id2 = (T)0;
        void opr1(T& arg1, const T arg2) const {
            arg1 += arg2;
        }
        T opr2(const T arg1, const T arg2) const {
            return arg1 + arg2;
        }
        bool isRoot(){
            return (!par) || (par->left != this && par->right != this);
        }
        //スプレー木を反転させる
        void push(){
            // 反対にしたらダメ？
            if(lazy != id1){
                opr1(val, lazy), al += lazy * sz;
                if(left) opr1(left->lazy, lazy);
                if(right) opr1(right->lazy, lazy);
                lazy = id1;
            }
            if(!rev) return;
            swap(left,right);
            if(left) left->rev = !(left->rev);
            if(right) right->rev = !(right->rev);
            rev = false;
        }
        void recalc(){
            sz = 1, al = val;
            if(left) left->push(), sz += left->sz, al = opr2(left->al, al);
            if(right) right->push(), sz += right->sz, al = opr2(al, right->al);
        }
    };

// private:
    // 回転
    void rotate(node* u, bool right){
        node *p = u->par, *g = p->par;
        if(right){
            if((p->left = u->right)) u->right->par = p;
            u->right = p, p->par = u;
        }else{
            if((p->right = u->left)) u->left->par = p;
            u->left = p, p->par = u;
        }
        p->recalc(), u->recalc(), u->par = g;
        if(!g) return;
        if(g->left == p) g->left = u;
        if(g->right == p) g->right = u;
        g->recalc();
    }
    // u を splay 木の根にする
    void splay(node* u){
        while(!(u->isRoot())){
            node *p = u->par, *gp = p->par;
            if(p->isRoot()){ // zig
                p->push(), u->push();
                rotate(u, (u == p->left));
            }else{
                gp->push(), p->push(), u->push();
                bool flag = (u == p->left);
                if((u == p->left) == (p == gp->left)){ // zig-zig
                    rotate(p, flag), rotate(u, flag);
                }else{ // zig-zag
                    rotate(u, flag), rotate(u, !flag);
                }
            }
        }
    }
    node* expose(node* u){
        node* last = nullptr;
        for(node* v = u; v; v = v->par){
            splay(v);
            v->right = last;
            v->recalc();
            last = v;
        }
        splay(u);
        return last;
    }
    bool connected(node* u, node* v){
        expose(u), expose(v);
        return u->par;
    }
    // u と v を結ぶ (v の preferred child を u とする.)
    void link(node* u, node* v){
        // u, v が同じ連結成分にないか
        // assert(!connected(u, v));
        expose(u), expose(v);
        u->par = v, v->right = u;
    }
    // u とその親の間の辺を削除
    void cut(node* u){
        expose(u);
        // u と親の間に辺があるか
        // assert(u->left);
        u->left->par = nullptr, u->left = nullptr;
    }
    node* lca(node* u, node* v){
        // u,v が同じ連結成分内にあるか
        // assert(connected(u, v));
        expose(u);
        return expose(v);
    }
    void evert(node* u){
        expose(u), u->rev = !(u->rev), u->push();
    }
    int depth(node* u){
        expose(u);
        return u->sz - 1;
    }
    void range(node* u, const T x){
        expose(u);
        u->opr1(u->lazy, x);
        u->push();
    }

public:
    node** arr;
    LinkCutTree(int node_size){
        arr = new node* [node_size];
        for(int i = 0; i < node_size; i++){
            arr[i] = new node(i);
        }
    }
    // id1 と id2 が同じ木(連結成分)に属するか
    bool connected(int id1, int id2){ return connected(arr[id1],arr[id2]); }
    // 木(連結成分)の根 id1 の親を id2 にする
    void link(int id1, int id2){ return link(arr[id1],arr[id2]); }
    // id とその親の間の辺を削除する
    void cut(int id){ return cut(arr[id]); }
    // id1 と id2 の LCA を求める
    int lca(int id1, int id2){ return lca(arr[id1],arr[id2])->id; }
    // 元の木の根を id にする
    void evert(int id){ return evert(arr[id]); }
    int depth(int id){ return depth(arr[id]); }
    void range(int id, T x){ return range(arr[id], x); }
};

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    LinkCutTree<ll> lc(n);
    rep(i,n){
        int a;
        cin >> a;
        rep(j,a){
            int b;
            cin >> b;
            lc.link(b, i);
        }
    }
    int q;
    cin >> q;
    ll diff = 0;
    rep(i,q){
        int a;
        cin >> a;
        if(a == 0){
            int b,c;
            cin >> b >> c;
            lc.range(b,c);
            diff += c;
        }else{
            int b;
            cin >> b;
            lc.expose(lc.arr[b]);
            cout << lc.arr[b]->al - diff << "\n";
        }
    }
    return 0;
}



Measured memory_bytes: 11788