跳到正文

剪贴板

剪贴板 scbgdzl0

原文
剪贴板信息

剪贴板信息

收录
更新
C++
#include <bits/stdc++.h>
using namespace std;
using ull = unsigned long long;

int n,m,TT;
pair<int,int> pos_[505];
ull maskLo, maskHi;

struct Bits{
    ull lo, hi;
};
static inline Bits mk(ull lo=0, ull hi=0){ return {lo & maskLo, hi & maskHi}; }
static inline Bits And(Bits a,Bits b){ return {a.lo&b.lo, a.hi&b.hi}; }
static inline Bits Or(Bits a,Bits b){ return {a.lo|b.lo, a.hi|b.hi}; }
static inline Bits Xor(Bits a,Bits b){ return {(a.lo^b.lo)&maskLo, (a.hi^b.hi)&maskHi}; }
static inline Bits Not(Bits a){ return {~a.lo & maskLo, ~a.hi & maskHi}; }
static inline bool hasAny(Bits a){ return (a.lo|a.hi)!=0; }
static inline bool neq(Bits a,Bits b){ return ((a.lo^b.lo)|(a.hi^b.hi))!=0; }
static inline Bits Shl1(Bits a){ return {(a.lo<<1)&maskLo, ((a.hi<<1)|(a.lo>>63))&maskHi}; }
static inline Bits Shr1(Bits a){ return {((a.lo>>1)|(a.hi<<63))&maskLo, (a.hi>>1)&maskHi}; }
static inline int popcnt(Bits a){ return __builtin_popcountll(a.lo)+__builtin_popcountll(a.hi); }
static inline bool testBit(Bits a,int p){ --p; return p<64 ? ((a.lo>>p)&1) : ((a.hi>>(p-64))&1); }
static inline void setBit(Bits &a,int p){ --p; if(p<64) a.lo|=1ull<<p; else a.hi|=1ull<<(p-64); a.lo&=maskLo; a.hi&=maskHi; }
static inline Bits oneBit0(int p){ return p<64 ? Bits{1ull<<p,0} : Bits{0,1ull<<(p-64)}; }

Bits rowBits[105], epBits[105], firstMask[105][105];
int epStamp[105], reqMark[105][105], forbMark[105][105];
int curStamp, curB;

static inline int idOf(int x,int y){ return (x-1)*m + (y-1); }
static inline bool inside(int x,int y){ return 1<=x && x<=n && 1<=y && y<=m; }
static inline int bcol(int w,int i,int j,int P){ if(w==0) w=P; if(w==P+1) w=1; return (i<=w && w<=j); }

static inline void addLineFromDir(vector<int>& S, vector<int>& D, int x, int y, int dx, int dy){
    if(dx==dy) D.push_back(x-y);
    else S.push_back(x+y);
}
static inline void addCornerLines(vector<int>& S, vector<int>& D){
    D.push_back(0);
    S.push_back(1 + m);
    D.push_back(n - m);
    S.push_back(n + 1);
}
static inline void addTransitionLine(vector<int>& S, vector<int>& D, pair<int,int> p, pair<int,int> q){
    int awayx = p.first - q.first;
    int awayy = p.second - q.second;
    int bestdx=0,bestdy=0,best=-100;
    for(int dx=-1; dx<=1; dx+=2){
        for(int dy=-1; dy<=1; dy+=2){
            if(!inside(p.first+dx, p.second+dy)) continue;
            int dot = dx*awayx + dy*awayy;
            if(dot > best){ best=dot; bestdx=dx; bestdy=dy; }
        }
    }
    if(bestdx) addLineFromDir(S,D,p.first,p.second,bestdx,bestdy);
}

bool connectedColor(int color){
    static Bits msk[105], seen[105];
    int total=0, st=0, sb=0;
    for(int i=1;i<=n;i++){
        msk[i] = color ? rowBits[i] : Not(rowBits[i]);
        seen[i]={0,0};
        int pc=popcnt(msk[i]); total+=pc;
        if(!st && pc){
            st=i;
            ull lo=msk[i].lo;
            if(lo) sb=__builtin_ctzll(lo);
            else sb=64+__builtin_ctzll(msk[i].hi);
        }
    }
    if(!total) return false;
    static int qr[200000];
    int head=0,tail=0;
    auto add=[&](int r,Bits bits){
        bits=And(bits,msk[r]);
        bits=And(bits,Not(seen[r]));
        if(hasAny(bits)){ seen[r]=Or(seen[r],bits); qr[tail++]=r; }
    };
    add(st, oneBit0(sb));
    while(head<tail){
        int r=qr[head++];
        Bits v=seen[r], old;
        do{
            old=v;
            v=Or(v, And(Or(Shl1(v),Shr1(v)), msk[r]));
        }while(neq(v,old));
        seen[r]=v;
        if(r>1) add(r-1,v);
        if(r<n) add(r+1,v);
    }
    int got=0;
    for(int i=1;i<=n;i++) got+=popcnt(seen[i]);
    return got==total;
}

bool calcFast(int L,int R,const array<pair<int,int>,4>& ep){
    ++curStamp;
    for(auto t: ep){
    	int x=t.first,y=t.second;
        if(epStamp[x]!=curStamp){ epStamp[x]=curStamp; epBits[x]={0,0}; }
        setBit(epBits[x],y);
    }
    rowBits[1]=firstMask[L][R];
    Bits full={maskLo,maskHi};
    Bits zero={0,0};
    Bits noLeft=full; noLeft.lo &= ~1ull;
    Bits noRight=full;
    if(m<=64) noRight.lo &= ~(1ull<<(m-1));
    else noRight.hi &= ~(1ull<<(m-65));

    for(int i=1;i<=n;i++){
        Bits cur=rowBits[i];
        Bits E = (epStamp[i]==curStamp ? epBits[i] : zero);
        Bits NE = Not(E);
        Bits up = (i>1 ? Not(Xor(rowBits[i-1],cur)) : zero);
        Bits lef = And(Not(Xor(cur,Shl1(cur))), noLeft);
        Bits rig = And(Not(Xor(cur,Shr1(cur))), noRight);
        Bits nup=Not(up), nlef=Not(lef), nrig=Not(rig);
        Bits cnt0=And(And(nup,nlef),nrig);
        Bits cnt1=Or(Or(And(And(up,nlef),nrig), And(And(nup,lef),nrig)), And(And(nup,nlef),rig));
        Bits cnt2=Or(Or(And(And(up,lef),nrig), And(And(up,nlef),rig)), And(And(nup,lef),rig));
        Bits cnt3=And(And(up,lef),rig);
        if(i==n){
            Bits bad=Or(And(E,Not(cnt1)), And(NE,Not(cnt2)));
            if(hasAny(bad)) return false;
        }else{
            Bits bad=Or(And(E,Or(cnt2,cnt3)), And(NE,Or(cnt0,cnt3)));
            if(hasAny(bad)) return false;
            Bits sameBelow=Or(And(E,cnt0), And(NE,cnt1));
            rowBits[i+1]=Xor(cur,Not(sameBelow));
        }
    }
    int ec[2]={0,0};
    for(auto t: ep){
    	int x=t.first,y=t.second;
    	ec[testBit(rowBits[x],y)]++;
	}
    if(ec[0]!=2 || ec[1]!=2) return false;
    return connectedColor(0) && connectedColor(1);
}

struct Key { ull a,b; bool operator==(const Key& o) const { return a==o.a && b==o.b; } };
struct KeyHash { size_t operator()(const Key& k) const { ull x=k.a^(k.b+0x9e3779b97f4a7c15ull+(k.a<<6)+(k.a>>2)); x^=x>>30; x*=0xbf58476d1ce4e5b9ull; x^=x>>27; x*=0x94d049bb133111ebull; x^=x>>31; return (size_t)x; } };
static inline Key makeKey(int L,int R,const array<pair<int,int>,4>& ep){
    int ids[4];
    for(int i=0;i<4;i++) ids[i]=idOf(ep[i].first,ep[i].second);
    sort(ids,ids+4);
    return { (ull)L | ((ull)R<<7) | ((ull)ids[0]<<14) | ((ull)ids[1]<<28) | ((ull)ids[2]<<42), (ull)ids[3] };
}
static inline void tryOne(int L,int R,const array<pair<int,int>,4>& ep, unordered_set<Key,KeyHash>& seen, int &ans){
    Key k=makeKey(L,R,ep);
    if(!seen.insert(k).second) return;
    if(calcFast(L,R,ep)) ans++;
}

int solve(){
//    cin>>n>>m;
    if(m<=64){ maskLo=(m==64?~0ull:((1ull<<m)-1)); maskHi=0; }
    else { maskLo=~0ull; maskHi=(m==128?~0ull:((1ull<<(m-64))-1)); }
    for(int L=0;L<=m;L++) for(int R=0;R<=m;R++) firstMask[L][R]={0,0};
    for(int L=1;L<=m;L++){
        Bits cur={0,0};
        for(int R=L;R<=m;R++){ setBit(cur,R); firstMask[L][R]=cur; }
    }

    int P=2*n+2*m-4;
    for(int i=1;i<=m;i++) pos_[i]={1,i};
    for(int i=2;i<=n;i++) pos_[m+i-1]={i,m};
    for(int i=m-1;i>=1;i--) pos_[n+m-1+(m-1)-i+1]={n,i};
    for(int i=n-1;i>=2;i--) pos_[n+m-1+m-1+(n-1)-i+1]={i,1};
    pos_[0]=pos_[P]; pos_[P+1]=pos_[1];

    unordered_set<Key,KeyHash> seen;
    seen.reserve(1<<20);
    int ans=0;
    for(int i=2;i<=P;i++){
        for(int j=i;j<=P;j++){
            int L=0,R=0;
            if(i<=m){ L=i; R=min(j,m); }

            ++curB;
            vector<pair<int,int>> req;
            req.reserve(4);
            for(int w=1; w<=P; ++w){
                int c=bcol(w,i,j,P);
                int bd=(bcol(w-1,i,j,P)==c) + (bcol(w+1,i,j,P)==c);
                auto p=pos_[w];
                if(bd==0){ reqMark[p.first][p.second]=curB; req.push_back(p); }
                else if(bd==2) forbMark[p.first][p.second]=curB;
            }
            if((int)req.size()>4) continue;

            vector<int> S,D;
            S.reserve(8); D.reserve(8);
            pair<int,int> srcs[8]={pos_[i],pos_[i-1],pos_[j],pos_[j+1],pos_[1],pos_[m],pos_[n+m-1],pos_[n+2*m-2]};
            sort(srcs,srcs+8);
            int tot=unique(srcs,srcs+8)-srcs;
            addCornerLines(S,D);
            addTransitionLine(S,D,pos_[i],pos_[i-1]);
            addTransitionLine(S,D,pos_[i-1],pos_[i]);
            addTransitionLine(S,D,pos_[j],pos_[j+1]);
            addTransitionLine(S,D,pos_[j+1],pos_[j]);
            sort(S.begin(),S.end()); S.erase(unique(S.begin(),S.end()),S.end());
            sort(D.begin(),D.end()); D.erase(unique(D.begin(),D.end()),D.end());

            vector<pair<int,int>> eds;
            eds.reserve(24);
            for(int u=0;u<tot;u++) eds.push_back(srcs[u]);
            for(int s:S) for(int d:D){
                int xx=s+d, yy=s-d;
                if((xx&1)||(yy&1)) continue;
                int x=xx/2, y=yy/2;
                if(inside(x,y)) eds.push_back({x,y});
            }
            sort(eds.begin(),eds.end()); eds.erase(unique(eds.begin(),eds.end()),eds.end());
            bool ok=true;
            for(auto p:req) if(!binary_search(eds.begin(),eds.end(),p)){ ok=false; break; }
            if(!ok) continue;
            vector<pair<int,int>> base,opt;
            for(auto p:req) base.push_back(p);
            sort(base.begin(),base.end()); base.erase(unique(base.begin(),base.end()),base.end());
            if((int)base.size()>4) continue;
            for(auto p:eds){
                if(reqMark[p.first][p.second]==curB) continue;
                if(forbMark[p.first][p.second]==curB) continue;
                opt.push_back(p);
            }
            int need=4-(int)base.size(), E=(int)opt.size();
            array<pair<int,int>,4> ep;
            for(int z=0; z<(int)base.size(); ++z) ep[z]=base[z];
            if(need==0){ tryOne(L,R,ep,seen,ans); }
            else if(need==1){ for(int a=0;a<E;a++){ ep[base.size()]=opt[a]; tryOne(L,R,ep,seen,ans); } }
            else if(need==2){ for(int a=0;a<E;a++) for(int b=a+1;b<E;b++){ ep[base.size()]=opt[a]; ep[base.size()+1]=opt[b]; tryOne(L,R,ep,seen,ans); } }
            else if(need==3){ for(int a=0;a<E;a++) for(int b=a+1;b<E;b++) for(int c=b+1;c<E;c++){ ep[base.size()]=opt[a]; ep[base.size()+1]=opt[b]; ep[base.size()+2]=opt[c]; tryOne(L,R,ep,seen,ans); } }
            else { for(int a=0;a<E;a++) for(int b=a+1;b<E;b++) for(int c=b+1;c<E;c++) for(int d=c+1;d<E;d++){ ep[0]=opt[a]; ep[1]=opt[b]; ep[2]=opt[c]; ep[3]=opt[d]; tryOne(L,R,ep,seen,ans); } }
        }
    }
    return 2*ans;
}
int w[105][105]; 
int main(){
	w[30][30]=1440;w[30][31]=2480;w[30][32]=2332;w[30][33]=2552;w[30][34]=2948;w[30][35]=2640;w[30][36]=2236;w[30][37]=2672;w[30][38]=2932;w[30][39]=2728;w[30][40]=2352;w[30][41]=2720;w[30][42]=2480;w[30][43]=2744;w[30][44]=2360;w[30][45]=2696;w[30][46]=2860;w[30][47]=2688;w[30][48]=2340;w[30][49]=2624;w[30][50]=2696;w[30][51]=2600;w[30][52]=2360;w[30][53]=2464;w[30][54]=2556;w[30][55]=2424;w[30][56]=2368;w[30][57]=2248;w[30][58]=2636;w[30][59]=2160;w[30][60]=2288;w[31][30]=2480;w[31][31]=1728;w[31][32]=2720;w[31][33]=2960;w[31][34]=3344;w[31][35]=3128;w[31][36]=2604;w[31][37]=3168;w[31][38]=3416;w[31][39]=3328;w[31][40]=2840;w[31][41]=3360;w[31][42]=3012;w[31][43]=3448;w[31][44]=3052;w[31][45]=3472;w[31][46]=3624;w[31][47]=3616;w[31][48]=3172;w[31][49]=3632;w[31][50]=3612;w[31][51]=3752;w[31][52]=3500;w[31][53]=3736;w[31][54]=3744;w[31][55]=3848;w[31][56]=3780;w[31][57]=3816;w[31][58]=4192;w[31][59]=3952;w[31][60]=4008;w[32][30]=2332;w[32][31]=2720;w[32][32]=1536;w[32][33]=2688;w[32][34]=3236;w[32][35]=2792;w[32][36]=2340;w[32][37]=2848;w[32][38]=3228;w[32][39]=2920;w[32][40]=2480;w[32][41]=2952;w[32][42]=2632;w[32][43]=2952;w[32][44]=2596;w[32][45]=2976;w[32][46]=3164;w[32][47]=2952;w[32][48]=2484;w[32][49]=2928;w[32][50]=2904;w[32][51]=2880;w[32][52]=2604;w[32][53]=2848;w[32][54]=2756;w[32][55]=2720;w[32][56]=2612;w[32][57]=2680;w[32][58]=2948;w[32][59]=2512;w[32][60]=2456;w[33][30]=2552;w[33][31]=2960;w[33][32]=2688;w[33][33]=1920;w[33][34]=3744;w[33][35]=3376;w[33][36]=2800;w[33][37]=3424;w[33][38]=3796;w[33][39]=3584;w[33][40]=3024;w[33][41]=3632;w[33][42]=3304;w[33][43]=3688;w[33][44]=3216;w[33][45]=3752;w[33][46]=3924;w[33][47]=3848;w[33][48]=3268;w[33][49]=3864;w[33][50]=3820;w[33][51]=3928;w[33][52]=3544;w[33][53]=3968;w[33][54]=3856;w[33][55]=3960;w[33][56]=3748;w[33][57]=4008;w[33][58]=4252;w[33][59]=4016;w[33][60]=3864;w[34][30]=2948;w[34][31]=3344;w[34][32]=3236;w[34][33]=3744;w[34][34]=3264;w[34][35]=4832;w[34][36]=4404;w[34][37]=4960;w[34][38]=5560;w[34][39]=5120;w[34][40]=4680;w[34][41]=5216;w[34][42]=5020;w[34][43]=5312;w[34][44]=4916;w[34][45]=5360;w[34][46]=5704;w[34][47]=5456;w[34][48]=4884;w[34][49]=5448;w[34][50]=5500;w[34][51]=5480;w[34][52]=5100;w[34][53]=5456;w[34][54]=5400;w[34][55]=5464;w[34][56]=5172;w[34][57]=5360;w[34][58]=5680;w[34][59]=5352;w[34][60]=5040;w[35][30]=2640;w[35][31]=3128;w[35][32]=2792;w[35][33]=3376;w[35][34]=4832;w[35][35]=2304;w[35][36]=3288;w[35][37]=3896;w[35][38]=4372;w[35][39]=4088;w[35][40]=3524;w[35][41]=4152;w[35][42]=3828;w[35][43]=4248;w[35][44]=3720;w[35][45]=4288;w[35][46]=4500;w[35][47]=4464;w[35][48]=3760;w[35][49]=4464;w[35][50]=4384;w[35][51]=4584;w[35][52]=4068;w[35][53]=4608;w[35][54]=4416;w[35][55]=4712;w[35][56]=4284;w[35][57]=4688;w[35][58]=4868;w[35][59]=4840;w[35][60]=4388;w[36][30]=2236;w[36][31]=2604;w[36][32]=2340;w[36][33]=2800;w[36][34]=4404;w[36][35]=3288;w[36][36]=1296;w[36][37]=2688;w[36][38]=3328;w[36][39]=2784;w[36][40]=2292;w[36][41]=2832;w[36][42]=2588;w[36][43]=2872;w[36][44]=2408;w[36][45]=2904;w[36][46]=3216;w[36][47]=2928;w[36][48]=2256;w[36][49]=2944;w[36][50]=2892;w[36][51]=2912;w[36][52]=2400;w[36][53]=2888;w[36][54]=2696;w[36][55]=2840;w[36][56]=2408;w[36][57]=2816;w[36][58]=2968;w[36][59]=2704;w[36][60]=2212;w[37][30]=2672;w[37][31]=3168;w[37][32]=2848;w[37][33]=3424;w[37][34]=4960;w[37][35]=3896;w[37][36]=2688;w[37][37]=2448;w[37][38]=4764;w[37][39]=4280;w[37][40]=3696;w[37][41]=4352;w[37][42]=4020;w[37][43]=4448;w[37][44]=3900;w[37][45]=4528;w[37][46]=4884;w[37][47]=4696;w[37][48]=3948;w[37][49]=4768;w[37][50]=4760;w[37][51]=4880;w[37][52]=4300;w[37][53]=4952;w[37][54]=4696;w[37][55]=5040;w[37][56]=4548;w[37][57]=5128;w[37][58]=5324;w[37][59]=5224;w[37][60]=4680;w[38][30]=2932;w[38][31]=3416;w[38][32]=3228;w[38][33]=3796;w[38][34]=5560;w[38][35]=4372;w[38][36]=3328;w[38][37]=4764;w[38][38]=4104;w[38][39]=6084;w[38][40]=5680;w[38][41]=6236;w[38][42]=6096;w[38][43]=6388;w[38][44]=5988;w[38][45]=6508;w[38][46]=7080;w[38][47]=6652;w[38][48]=5980;w[38][49]=6716;w[38][50]=6876;w[38][51]=6828;w[38][52]=6284;w[38][53]=6844;w[38][54]=6676;w[38][55]=6892;w[38][56]=6412;w[38][57]=6892;w[38][58]=7200;w[38][59]=6932;w[38][60]=6288;w[39][30]=2728;w[39][31]=3328;w[39][32]=2920;w[39][33]=3584;w[39][34]=5120;w[39][35]=4088;w[39][36]=2784;w[39][37]=4280;w[39][38]=6084;w[39][39]=2880;w[39][40]=4256;w[39][41]=4880;w[39][42]=4600;w[39][43]=5000;w[39][44]=4456;w[39][45]=5080;w[39][46]=5508;w[39][47]=5280;w[39][48]=4464;w[39][49]=5320;w[39][50]=5332;w[39][51]=5488;w[39][52]=4796;w[39][53]=5520;w[39][54]=5200;w[39][55]=5624;w[39][56]=4988;w[39][57]=5656;w[39][58]=5808;w[39][59]=5824;w[39][60]=5024;w[40][30]=2352;w[40][31]=2840;w[40][32]=2480;w[40][33]=3024;w[40][34]=4680;w[40][35]=3524;w[40][36]=2292;w[40][37]=3696;w[40][38]=5680;w[40][39]=4256;w[40][40]=1920;w[40][41]=3712;w[40][42]=3564;w[40][43]=3800;w[40][44]=3364;w[40][45]=3872;w[40][46]=4468;w[40][47]=3960;w[40][48]=3204;w[40][49]=4000;w[40][50]=4112;w[40][51]=4032;w[40][52]=3412;w[40][53]=4072;w[40][54]=3792;w[40][55]=4056;w[40][56]=3452;w[40][57]=4056;w[40][58]=4284;w[40][59]=4040;w[40][60]=3232;w[41][30]=2720;w[41][31]=3360;w[41][32]=2952;w[41][33]=3632;w[41][34]=5216;w[41][35]=4152;w[41][36]=2832;w[41][37]=4352;w[41][38]=6236;w[41][39]=4880;w[41][40]=3712;w[41][41]=3072;w[41][42]=5000;w[41][43]=5248;w[41][44]=4688;w[41][45]=5344;w[41][46]=5968;w[41][47]=5560;w[41][48]=4688;w[41][49]=5632;w[41][50]=5632;w[41][51]=5776;w[41][52]=5048;w[41][53]=5880;w[41][54]=5628;w[41][55]=5984;w[41][56]=5280;w[41][57]=6072;w[41][58]=6328;w[41][59]=6248;w[41][60]=5348;w[42][30]=2480;w[42][31]=3012;w[42][32]=2632;w[42][33]=3304;w[42][34]=5020;w[42][35]=3828;w[42][36]=2588;w[42][37]=4020;w[42][38]=6096;w[42][39]=4600;w[42][40]=3564;w[42][41]=5000;w[42][42]=3024;w[42][43]=5112;w[42][44]=4700;w[42][45]=5224;w[42][46]=6072;w[42][47]=5368;w[42][48]=4588;w[42][49]=5440;w[42][50]=5600;w[42][51]=5536;w[42][52]=4868;w[42][53]=5568;w[42][54]=5436;w[42][55]=5640;w[42][56]=4948;w[42][57]=5632;w[42][58]=6016;w[42][59]=5680;w[42][60]=4752;w[43][30]=2744;w[43][31]=3448;w[43][32]=2952;w[43][33]=3688;w[43][34]=5312;w[43][35]=4248;w[43][36]=2872;w[43][37]=4448;w[43][38]=6388;w[43][39]=5000;w[43][40]=3800;w[43][41]=5248;w[43][42]=5112;w[43][43]=3360;w[43][44]=5160;w[43][45]=5704;w[43][46]=6524;w[43][47]=5944;w[43][48]=4980;w[43][49]=6008;w[43][50]=6140;w[43][51]=6192;w[43][52]=5496;w[43][53]=6272;w[43][54]=5968;w[43][55]=6432;w[43][56]=5572;w[43][57]=6480;w[43][58]=6836;w[43][59]=6696;w[43][60]=5608;w[44][30]=2360;w[44][31]=3052;w[44][32]=2596;w[44][33]=3216;w[44][34]=4916;w[44][35]=3720;w[44][36]=2408;w[44][37]=3900;w[44][38]=5988;w[44][39]=4456;w[44][40]=3364;w[44][41]=4688;w[44][42]=4700;w[44][43]=5160;w[44][44]=2640;w[44][45]=4800;w[44][46]=5848;w[44][47]=4944;w[44][48]=4084;w[44][49]=5024;w[44][50]=5320;w[44][51]=5120;w[44][52]=4520;w[44][53]=5184;w[44][54]=4972;w[44][55]=5224;w[44][56]=4436;w[44][57]=5272;w[44][58]=5728;w[44][59]=5288;w[44][60]=4200;w[45][30]=2696;w[45][31]=3472;w[45][32]=2976;w[45][33]=3752;w[45][34]=5360;w[45][35]=4288;w[45][36]=2904;w[45][37]=4528;w[45][38]=6508;w[45][39]=5080;w[45][40]=3872;w[45][41]=5344;w[45][42]=5224;w[45][43]=5704;w[45][44]=4800;w[45][45]=3600;w[45][46]=7060;w[45][47]=6248;w[45][48]=5232;w[45][49]=6320;w[45][50]=6624;w[45][51]=6504;w[45][52]=5748;w[45][53]=6592;w[45][54]=6384;w[45][55]=6712;w[45][56]=5772;w[45][57]=6792;w[45][58]=7248;w[45][59]=6960;w[45][60]=5728;w[46][30]=2860;w[46][31]=3624;w[46][32]=3164;w[46][33]=3924;w[46][34]=5704;w[46][35]=4500;w[46][36]=3216;w[46][37]=4884;w[46][38]=7080;w[46][39]=5508;w[46][40]=4468;w[46][41]=5968;w[46][42]=6072;w[46][43]=6524;w[46][44]=5848;w[46][45]=7060;w[46][46]=6072;w[46][47]=8972;w[46][48]=8168;w[46][49]=9156;w[46][50]=9752;w[46][51]=9372;w[46][52]=8820;w[46][53]=9532;w[46][54]=9556;w[46][55]=9700;w[46][56]=8904;w[46][57]=9804;w[46][58]=10528;w[46][59]=9972;w[46][60]=8804;w[47][30]=2688;w[47][31]=3616;w[47][32]=2952;w[47][33]=3848;w[47][34]=5456;w[47][35]=4464;w[47][36]=2928;w[47][37]=4696;w[47][38]=6652;w[47][39]=5280;w[47][40]=3960;w[47][41]=5560;w[47][42]=5368;w[47][43]=5944;w[47][44]=4944;w[47][45]=6248;w[47][46]=8972;w[47][47]=4128;w[47][48]=5904;w[47][49]=6960;w[47][50]=7384;w[47][51]=7176;w[47][52]=6452;w[47][53]=7288;w[47][54]=7140;w[47][55]=7464;w[47][56]=6496;w[47][57]=7544;w[47][58]=8096;w[47][59]=7808;w[47][60]=6468;w[48][30]=2340;w[48][31]=3172;w[48][32]=2484;w[48][33]=3268;w[48][34]=4884;w[48][35]=3760;w[48][36]=2256;w[48][37]=3948;w[48][38]=5980;w[48][39]=4464;w[48][40]=3204;w[48][41]=4688;w[48][42]=4588;w[48][43]=4980;w[48][44]=4084;w[48][45]=5232;w[48][46]=8168;w[48][47]=5904;w[48][48]=2304;w[48][49]=4784;w[48][50]=5404;w[48][51]=4904;w[48][52]=4300;w[48][53]=4984;w[48][54]=4976;w[48][55]=5064;w[48][56]=4184;w[48][57]=5120;w[48][58]=5828;w[48][59]=5184;w[48][60]=3892;w[49][30]=2624;w[49][31]=3632;w[49][32]=2928;w[49][33]=3864;w[49][34]=5448;w[49][35]=4464;w[49][36]=2944;w[49][37]=4768;w[49][38]=6716;w[49][39]=5320;w[49][40]=4000;w[49][41]=5632;w[49][42]=5440;w[49][43]=6008;w[49][44]=5024;w[49][45]=6320;w[49][46]=9156;w[49][47]=6960;w[49][48]=4784;w[49][49]=4320;w[49][50]=7880;w[49][51]=7424;w[49][52]=6696;w[49][53]=7544;w[49][54]=7416;w[49][55]=7712;w[49][56]=6716;w[49][57]=7816;w[49][58]=8580;w[49][59]=8048;w[49][60]=6644;w[50][30]=2696;w[50][31]=3612;w[50][32]=2904;w[50][33]=3820;w[50][34]=5500;w[50][35]=4384;w[50][36]=2892;w[50][37]=4760;w[50][38]=6876;w[50][39]=5332;w[50][40]=4112;w[50][41]=5632;w[50][42]=5600;w[50][43]=6140;w[50][44]=5320;w[50][45]=6624;w[50][46]=9752;w[50][47]=7384;w[50][48]=5404;w[50][49]=7880;w[50][50]=6000;w[50][51]=9240;w[50][52]=8740;w[50][53]=9424;w[50][54]=9552;w[50][55]=9616;w[50][56]=8800;w[50][57]=9760;w[50][58]=10808;w[50][59]=9944;w[50][60]=8644;w[51][30]=2600;w[51][31]=3752;w[51][32]=2880;w[51][33]=3928;w[51][34]=5480;w[51][35]=4584;w[51][36]=2912;w[51][37]=4880;w[51][38]=6828;w[51][39]=5488;w[51][40]=4032;w[51][41]=5776;w[51][42]=5536;w[51][43]=6192;w[51][44]=5120;w[51][45]=6504;w[51][46]=9372;w[51][47]=7176;w[51][48]=4904;w[51][49]=7424;w[51][50]=9240;w[51][51]=4800;w[51][52]=7376;w[51][53]=8128;w[51][54]=8132;w[51][55]=8320;w[51][56]=7376;w[51][57]=8424;w[51][58]=9344;w[51][59]=8696;w[51][60]=7088;w[52][30]=2360;w[52][31]=3500;w[52][32]=2604;w[52][33]=3544;w[52][34]=5100;w[52][35]=4068;w[52][36]=2400;w[52][37]=4300;w[52][38]=6284;w[52][39]=4796;w[52][40]=3412;w[52][41]=5048;w[52][42]=4868;w[52][43]=5496;w[52][44]=4520;w[52][45]=5748;w[52][46]=8820;w[52][47]=6452;w[52][48]=4300;w[52][49]=6696;w[52][50]=8740;w[52][51]=7376;w[52][52]=3744;w[52][53]=6816;w[52][54]=7032;w[52][55]=6960;w[52][56]=6172;w[52][57]=7072;w[52][58]=8240;w[52][59]=7216;w[52][60]=5700;w[53][30]=2464;w[53][31]=3736;w[53][32]=2848;w[53][33]=3968;w[53][34]=5456;w[53][35]=4608;w[53][36]=2888;w[53][37]=4952;w[53][38]=6844;w[53][39]=5520;w[53][40]=4072;w[53][41]=5880;w[53][42]=5568;w[53][43]=6272;w[53][44]=5184;w[53][45]=6592;w[53][46]=9532;w[53][47]=7288;w[53][48]=4984;w[53][49]=7544;w[53][50]=9424;w[53][51]=8128;w[53][52]=6816;w[53][53]=5088;w[53][54]=8708;w[53][55]=8680;w[53][56]=7704;w[53][57]=8800;w[53][58]=9980;w[53][59]=9088;w[53][60]=7392;w[54][30]=2556;w[54][31]=3744;w[54][32]=2756;w[54][33]=3856;w[54][34]=5400;w[54][35]=4416;w[54][36]=2696;w[54][37]=4696;w[54][38]=6676;w[54][39]=5200;w[54][40]=3792;w[54][41]=5628;w[54][42]=5436;w[54][43]=5968;w[54][44]=4972;w[54][45]=6384;w[54][46]=9556;w[54][47]=7140;w[54][48]=4976;w[54][49]=7416;w[54][50]=9552;w[54][51]=8132;w[54][52]=7032;w[54][53]=8708;w[54][54]=5832;w[54][55]=9420;w[54][56]=8656;w[54][57]=9588;w[54][58]=11088;w[54][59]=9804;w[54][60]=8248;w[55][30]=2424;w[55][31]=3848;w[55][32]=2720;w[55][33]=3960;w[55][34]=5464;w[55][35]=4712;w[55][36]=2840;w[55][37]=5040;w[55][38]=6892;w[55][39]=5624;w[55][40]=4056;w[55][41]=5984;w[55][42]=5640;w[55][43]=6432;w[55][44]=5224;w[55][45]=6712;w[55][46]=9700;w[55][47]=7464;w[55][48]=5064;w[55][49]=7712;w[55][50]=9616;w[55][51]=8320;w[55][52]=6960;w[55][53]=8680;w[55][54]=9420;w[55][55]=5520;w[55][56]=8360;w[55][57]=9328;w[55][58]=10752;w[55][59]=9640;w[55][60]=7804;w[56][30]=2368;w[56][31]=3780;w[56][32]=2612;w[56][33]=3748;w[56][34]=5172;w[56][35]=4284;w[56][36]=2408;w[56][37]=4548;w[56][38]=6412;w[56][39]=4988;w[56][40]=3452;w[56][41]=5280;w[56][42]=4948;w[56][43]=5572;w[56][44]=4436;w[56][45]=5772;w[56][46]=8904;w[56][47]=6496;w[56][48]=4184;w[56][49]=6716;w[56][50]=8800;w[56][51]=7376;w[56][52]=6172;w[56][53]=7704;w[56][54]=8656;w[56][55]=8360;w[56][56]=4032;w[56][57]=7512;w[56][58]=9228;w[56][59]=7696;w[56][60]=5980;w[57][30]=2248;w[57][31]=3816;w[57][32]=2680;w[57][33]=4008;w[57][34]=5360;w[57][35]=4688;w[57][36]=2816;w[57][37]=5128;w[57][38]=6892;w[57][39]=5656;w[57][40]=4056;w[57][41]=6072;w[57][42]=5632;w[57][43]=6480;w[57][44]=5272;w[57][45]=6792;w[57][46]=9804;w[57][47]=7544;w[57][48]=5120;w[57][49]=7816;w[57][50]=9760;w[57][51]=8424;w[57][52]=7072;w[57][53]=8800;w[57][54]=9588;w[57][55]=9328;w[57][56]=7512;w[57][57]=5808;w[57][58]=11424;w[57][59]=10000;w[57][60]=8096;w[58][30]=2636;w[58][31]=4192;w[58][32]=2948;w[58][33]=4252;w[58][34]=5680;w[58][35]=4868;w[58][36]=2968;w[58][37]=5324;w[58][38]=7200;w[58][39]=5808;w[58][40]=4284;w[58][41]=6328;w[58][42]=6016;w[58][43]=6836;w[58][44]=5728;w[58][45]=7248;w[58][46]=10528;w[58][47]=8096;w[58][48]=5828;w[58][49]=8580;w[58][50]=10808;w[58][51]=9344;w[58][52]=8240;w[58][53]=9980;w[58][54]=11088;w[58][55]=10752;w[58][56]=9228;w[58][57]=11424;w[58][58]=9744;w[58][59]=14384;w[58][60]=12740;w[59][30]=2160;w[59][31]=3952;w[59][32]=2512;w[59][33]=4016;w[59][34]=5352;w[59][35]=4840;w[59][36]=2704;w[59][37]=5224;w[59][38]=6932;w[59][39]=5824;w[59][40]=4040;w[59][41]=6248;w[59][42]=5680;w[59][43]=6696;w[59][44]=5288;w[59][45]=6960;w[59][46]=9972;w[59][47]=7808;w[59][48]=5184;w[59][49]=8048;w[59][50]=9944;w[59][51]=8696;w[59][52]=7216;w[59][53]=9088;w[59][54]=9804;w[59][55]=9640;w[59][56]=7696;w[59][57]=10000;w[59][58]=14384;w[59][59]=6480;w[59][60]=8936;w[60][30]=2288;w[60][31]=4008;w[60][32]=2456;w[60][33]=3864;w[60][34]=5040;w[60][35]=4388;w[60][36]=2212;w[60][37]=4680;w[60][38]=6288;w[60][39]=5024;w[60][40]=3232;w[60][41]=5348;w[60][42]=4752;w[60][43]=5608;w[60][44]=4200;w[60][45]=5728;w[60][46]=8804;w[60][47]=6468;w[60][48]=3892;w[60][49]=6644;w[60][50]=8644;w[60][51]=7088;w[60][52]=5700;w[60][53]=7392;w[60][54]=8248;w[60][55]=7804;w[60][56]=5980;w[60][57]=8096;w[60][58]=12740;w[60][59]=8936;w[60][60]=2880;
	w[61][61]=6672;w[61][62]=13124;w[61][63]=11464;w[61][64]=10608;w[61][65]=11632;w[61][66]=11172;w[61][67]=11824;w[61][68]=10612;w[61][69]=11976;w[61][70]=11624;w[61][71]=12168;w[61][72]=10220;w[61][73]=12288;w[61][74]=13404;w[61][75]=12576;w[61][76]=11132;w[61][77]=12720;w[61][78]=11804;w[61][79]=12880;w[61][80]=11140;w[62][61]=13124;w[62][62]=11160;w[62][63]=16476;w[62][64]=15960;w[62][65]=16756;w[62][66]=16648;w[62][67]=17036;w[62][68]=16116;w[62][69]=17276;w[62][70]=17252;w[62][71]=17524;w[62][72]=15780;w[62][73]=17700;w[62][74]=19200;w[62][75]=17964;w[62][76]=16700;w[62][77]=18100;w[62][78]=17416;w[62][79]=18268;w[62][80]=16668;w[63][61]=11464;w[63][62]=16476;w[63][63]=7392;w[63][64]=11568;w[63][65]=12496;w[63][66]=12152;w[63][67]=12712;w[63][68]=11552;w[63][69]=12864;w[63][70]=12600;w[63][71]=13088;w[63][72]=11100;w[63][73]=13168;w[63][74]=14420;w[63][75]=13504;w[63][76]=11992;w[63][77]=13600;w[63][78]=12668;w[63][79]=13776;w[63][80]=11924;w[64][61]=10608;w[64][62]=15960;w[64][63]=11568;w[64][64]=6144;w[64][65]=10928;w[64][66]=10844;w[64][67]=11112;w[64][68]=10172;w[64][69]=11272;w[64][70]=11256;w[64][71]=11432;w[64][72]=9604;w[64][73]=11552;w[64][74]=13092;w[64][75]=11704;w[64][76]=10372;w[64][77]=11824;w[64][78]=11036;w[64][79]=11888;w[64][80]=10156;w[65][61]=11632;w[65][62]=16756;w[65][63]=12496;w[65][64]=10928;w[65][65]=7776;w[65][66]=12872;w[65][67]=13184;w[65][68]=11992;w[65][69]=13352;w[65][70]=13332;w[65][71]=13592;w[65][72]=11516;w[65][73]=13704;w[65][74]=15236;w[65][75]=14032;w[65][76]=12460;w[65][77]=14200;w[65][78]=13404;w[65][79]=14368;w[65][80]=12400;w[66][61]=11172;w[66][62]=16648;w[66][63]=12152;w[66][64]=10844;w[66][65]=12872;w[66][66]=7920;w[66][67]=13208;w[66][68]=12276;w[66][69]=13408;w[66][70]=13692;w[66][71]=13624;w[66][72]=11740;w[66][73]=13776;w[66][74]=15664;w[66][75]=14000;w[66][76]=12604;w[66][77]=14120;w[66][78]=13560;w[66][79]=14280;w[66][80]=12428;w[67][61]=11824;w[67][62]=17036;w[67][63]=12712;w[67][64]=11112;w[67][65]=13184;w[67][66]=13208;w[67][67]=8256;w[67][68]=12768;w[67][69]=13936;w[67][70]=14160;w[67][71]=14200;w[67][72]=12004;w[67][73]=14312;w[67][74]=16140;w[67][75]=14688;w[67][76]=13232;w[67][77]=14840;w[67][78]=13980;w[67][79]=15072;w[67][80]=13160;w[68][61]=10612;w[68][62]=16116;w[68][63]=11552;w[68][64]=10172;w[68][65]=11992;w[68][66]=12276;w[68][67]=12768;w[68][68]=6528;w[68][69]=11808;w[68][70]=12324;w[68][71]=12008;w[68][72]=9996;w[68][73]=12152;w[68][74]=14320;w[68][75]=12360;w[68][76]=11096;w[68][77]=12496;w[68][78]=11824;w[68][79]=12608;w[68][80]=10856;w[69][61]=11976;w[69][62]=17276;w[69][63]=12864;w[69][64]=11272;w[69][65]=13352;w[69][66]=13408;w[69][67]=13936;w[69][68]=11808;w[69][69]=8640;w[69][70]=14928;w[69][71]=14672;w[69][72]=12408;w[69][73]=14792;w[69][74]=16968;w[69][75]=15168;w[69][76]=13656;w[69][77]=15336;w[69][78]=14672;w[69][79]=15536;w[69][80]=13540;w[70][61]=11624;w[70][62]=17252;w[70][63]=12600;w[70][64]=11256;w[70][65]=13332;w[70][66]=13692;w[70][67]=14160;w[70][68]=12324;w[70][69]=14928;w[70][70]=10080;w[70][71]=16176;w[70][72]=14172;w[70][73]=16392;w[70][74]=19004;w[70][75]=16688;w[70][76]=15440;w[70][77]=16888;w[70][78]=16516;w[70][79]=17096;w[70][80]=15296;w[71][61]=12168;w[71][62]=17524;w[71][63]=13088;w[71][64]=11432;w[71][65]=13592;w[71][66]=13624;w[71][67]=14200;w[71][68]=12008;w[71][69]=14672;w[71][70]=16176;w[71][71]=9216;w[71][72]=13248;w[71][73]=15488;w[71][74]=17992;w[71][75]=15896;w[71][76]=14540;w[71][77]=16080;w[71][78]=15600;w[71][79]=16328;w[71][80]=14160;w[72][61]=10220;w[72][62]=15780;w[72][63]=11100;w[72][64]=9604;w[72][65]=11516;w[72][66]=11740;w[72][67]=12004;w[72][68]=9996;w[72][69]=12408;w[72][70]=14172;w[72][71]=13248;w[72][72]=5184;w[72][73]=10704;w[72][74]=13564;w[72][75]=10920;w[72][76]=9764;w[72][77]=11056;w[72][78]=10796;w[72][79]=11192;w[72][80]=9176;w[73][61]=12288;w[73][62]=17700;w[73][63]=13168;w[73][64]=11552;w[73][65]=13704;w[73][66]=13776;w[73][67]=14312;w[73][68]=12152;w[73][69]=14792;w[73][70]=16392;w[73][71]=15488;w[73][72]=10704;w[73][73]=9504;w[73][74]=18792;w[73][75]=16256;w[73][76]=14912;w[73][77]=16448;w[73][78]=16004;w[73][79]=16688;w[73][80]=14492;w[74][61]=13404;w[74][62]=19200;w[74][63]=14420;w[74][64]=13092;w[74][65]=15236;w[74][66]=15664;w[74][67]=16140;w[74][68]=14320;w[74][69]=16968;w[74][70]=19004;w[74][71]=17992;w[74][72]=13564;w[74][73]=18792;w[74][74]=15984;w[74][75]=23544;w[74][76]=22604;w[74][77]=23880;w[74][78]=23868;w[74][79]=24224;w[74][80]=22368;w[75][61]=12576;w[75][62]=17964;w[75][63]=13504;w[75][64]=11704;w[75][65]=14032;w[75][66]=14000;w[75][67]=14688;w[75][68]=12360;w[75][69]=15168;w[75][70]=16688;w[75][71]=15896;w[75][72]=10920;w[75][73]=16256;w[75][74]=23544;w[75][75]=10368;w[75][76]=16056;w[75][77]=17480;w[75][78]=17184;w[75][79]=17744;w[75][80]=15600;w[76][61]=11132;w[76][62]=16700;w[76][63]=11992;w[76][64]=10372;w[76][65]=12460;w[76][66]=12604;w[76][67]=13232;w[76][68]=11096;w[76][69]=13656;w[76][70]=15440;w[76][71]=14540;w[76][72]=9764;w[76][73]=14912;w[76][74]=22604;w[76][75]=16056;w[76][76]=8208;w[76][77]=14832;w[76][78]=14844;w[76][79]=15048;w[76][80]=13140;w[77][61]=12720;w[77][62]=18100;w[77][63]=13600;w[77][64]=11824;w[77][65]=14200;w[77][66]=14120;w[77][67]=14840;w[77][68]=12496;w[77][69]=15336;w[77][70]=16888;w[77][71]=16080;w[77][72]=11056;w[77][73]=16448;w[77][74]=23880;w[77][75]=17480;w[77][76]=14832;w[77][77]=10800;w[77][78]=18024;w[77][79]=18272;w[77][80]=16080;w[78][61]=11804;w[78][62]=17416;w[78][63]=12668;w[78][64]=11036;w[78][65]=13404;w[78][66]=13560;w[78][67]=13980;w[78][68]=11824;w[78][69]=14672;w[78][70]=16516;w[78][71]=15600;w[78][72]=10796;w[78][73]=16004;w[78][74]=23868;w[78][75]=17184;w[78][76]=14844;w[78][77]=18024;w[78][78]=11232;w[78][79]=18600;w[78][80]=16700;w[79][61]=12880;w[79][62]=18268;w[79][63]=13776;w[79][64]=11888;w[79][65]=14368;w[79][66]=14280;w[79][67]=15072;w[79][68]=12608;w[79][69]=15536;w[79][70]=17096;w[79][71]=16328;w[79][72]=11192;w[79][73]=16688;w[79][74]=24224;w[79][75]=17744;w[79][76]=15048;w[79][77]=18272;w[79][78]=18600;w[79][79]=11376;w[79][80]=16984;w[80][61]=11140;w[80][62]=16668;w[80][63]=11924;w[80][64]=10156;w[80][65]=12400;w[80][66]=12428;w[80][67]=13160;w[80][68]=10856;w[80][69]=13540;w[80][70]=15296;w[80][71]=14160;w[80][72]=9176;w[80][73]=14492;w[80][74]=22368;w[80][75]=15600;w[80][76]=13140;w[80][77]=16080;w[80][78]=16700;w[80][79]=16984;w[80][80]=7680;
	w[81][81]=11760;w[81][82]=23240;w[81][83]=20064;w[81][84]=16560;w[81][85]=20184;w[81][86]=23340;w[81][87]=20632;w[81][88]=18488;w[81][89]=20824;w[81][90]=19224;w[82][81]=23240;w[82][82]=19680;w[82][83]=29000;w[82][84]=25884;w[82][85]=29344;w[82][86]=33112;w[82][87]=29792;w[82][88]=28056;w[82][89]=30128;w[82][90]=28948;w[83][81]=20064;w[83][82]=29000;w[83][83]=12720;w[83][84]=17768;w[83][85]=21328;w[83][86]=24780;w[83][87]=21808;w[83][88]=19756;w[83][89]=22016;w[83][90]=20520;w[84][81]=16560;w[84][82]=25884;w[84][83]=17768;w[84][84]=6048;w[84][85]=13464;w[84][86]=17320;w[84][87]=13704;w[84][88]=11868;w[84][89]=13848;w[84][90]=12572;w[85][81]=20184;w[85][82]=29344;w[85][83]=21328;w[85][84]=13464;w[85][85]=13008;w[85][86]=25676;w[85][87]=22168;w[85][88]=20144;w[85][89]=22384;w[85][90]=20924;w[86][81]=23340;w[86][82]=33112;w[86][83]=24780;w[86][84]=17320;w[86][85]=25676;w[86][86]=21672;w[86][87]=31956;w[86][88]=30400;w[86][89]=32348;w[86][90]=31368;w[87][81]=20632;w[87][82]=29792;w[87][83]=21808;w[87][84]=13704;w[87][85]=22168;w[87][86]=31956;w[87][87]=14016;w[87][88]=21472;w[87][89]=23584;w[87][90]=22272;w[88][81]=18488;w[88][82]=28056;w[88][83]=19756;w[88][84]=11868;w[88][85]=20144;w[88][86]=30400;w[88][87]=21472;w[88][88]=10560;w[88][89]=19408;w[88][90]=18420;w[89][81]=20824;w[89][82]=30128;w[89][83]=22016;w[89][84]=13848;w[89][85]=22384;w[89][86]=32348;w[89][87]=23584;w[89][88]=19408;w[89][89]=14496;w[89][90]=23200;w[90][81]=19224;w[90][82]=28948;w[90][83]=20520;w[90][84]=12572;w[90][85]=20924;w[90][86]=31368;w[90][87]=22272;w[90][88]=18420;w[90][89]=23200;w[90][90]=12960;
	w[91][91]=15072;w[91][92]=23480;w[91][93]=25368;w[91][94]=29644;w[91][95]=25896;w[91][96]=22004;w[91][97]=26056;w[91][98]=28224;w[91][99]=26504;w[91][100]=23108;w[92][91]=23480;w[92][92]=12144;w[92][93]=21792;w[92][94]=26584;w[92][95]=22128;w[92][96]=18500;w[92][97]=22336;w[92][98]=24940;w[92][99]=22616;w[92][100]=19480;w[93][91]=25368;w[93][92]=21792;w[93][93]=15600;w[93][94]=30804;w[93][95]=26536;w[93][96]=22560;w[93][97]=26704;w[93][98]=29316;w[93][99]=27152;w[93][100]=23672;w[94][91]=29644;w[94][92]=26584;w[94][93]=30804;w[94][94]=25944;w[94][95]=38252;w[94][96]=34744;w[94][97]=38660;w[94][98]=41932;w[94][99]=39156;w[94][100]=36132;w[95][91]=25896;w[95][92]=22128;w[95][93]=26536;w[95][94]=38252;w[95][95]=16704;w[95][96]=23968;w[95][97]=28016;w[95][98]=30924;w[95][99]=28496;w[95][100]=25108;w[96][91]=22004;w[96][92]=18500;w[96][93]=22560;w[96][94]=34744;w[96][95]=23968;w[96][96]=9216;w[96][97]=19168;w[96][98]=22512;w[96][99]=19440;w[96][100]=16300;w[97][91]=26056;w[97][92]=22336;w[97][93]=26704;w[97][94]=38660;w[97][95]=28016;w[97][96]=19168;w[97][97]=17088;w[97][98]=31948;w[97][99]=28968;w[97][100]=25576;w[98][91]=28224;w[98][92]=24940;w[98][93]=29316;w[98][94]=41932;w[98][95]=30924;w[98][96]=22512;w[98][97]=31948;w[98][98]=24696;w[98][99]=37524;w[98][100]=34600;w[99][91]=26504;w[99][92]=22616;w[99][93]=27152;w[99][94]=39156;w[99][95]=28496;w[99][96]=19440;w[99][97]=28968;w[99][98]=37524;w[99][99]=18096;w[99][100]=26952;w[100][91]=23108;w[100][92]=19480;w[100][93]=23672;w[100][94]=36132;w[100][95]=25108;w[100][96]=16300;w[100][97]=25576;w[100][98]=34600;w[100][99]=26952;w[100][100]=12000;
	int T;
	cin>>T;
	while(T--){
		cin>>n>>m;
		cout<<"Case #"<<++TT<<": ";
		if(w[]){
			cout<<w[n][m]<<"\n";
		}else{
			cout<<solve()<<"\n";
		}
	} 
}