#ifndef ONLINE_JUDGE #define _GLIBCXX_DEBUG #endif #include #include using namespace std; using ll=long long; using ld=long double; using st=string; using P=pair; typedef atcoder::modint mint; ll inf=9e18; template auto vec(const ll (&sizes)[s], const T& init = T()){ if constexpr(i < s) return vector(sizes[i], vec(sizes, init)); else return init; } int main(){ ll t,hc,ac,sc,hg,ag,sg; mint p; cin>>t; for(ll T=0;T>hc>>ac>>sc>>hg>>ag>>sg; hc=(hc-1)/ag; hg=(hg-1)/ac; // cout<sg) p=10; if(schg){ p=1; p/=10; p=p.pow(hc-hg); if(scsg){ p/=11; }else{ p/=2; } cout<<(1-p).val()<<"\n"; }else{ p=1; p/=10; p=p.pow(hg-hc); if(sc>sg){ p*=10; p/=11; }else if(sc