#include using namespace std; #include namespace mp=boost::multiprecision; template class field{ public: function add=[](double A,double B){ return (A+B); }; function product=[](double A,double B){ return (A*B); }; function in=[this](type a){ int comp; return true; };//引数が体の要素か否か function add_inverse=[this](type a){ return -a; }; function product_inverse=[this](type a){ return 1.0/a; }; double one=1.0,zero=0; field(string s="real",int param=1000000007){ if(s=="residue"){ int MOD=param; add=[MOD](int a,int b){ long long A=a,B=b; return (A+B)%MOD; }; product=[MOD](int a,int b){ long long A=a,B=b; return (A*B)%MOD; }; in=[MOD](type a){ int comp; return typeid(comp)==typeid(a) && 0<=a && a0){ if(p%2){ ans=(ans*temp)%MOD; } temp=(temp*temp)%MOD; p/=2; } int l=ans; return l; }; one=1,zero=0; }else if(s=="real"){ } } }; template class matrix{ public: vector> value; field f; matrix(vector> value,field f){ this->value=value; this->f=f; } matrix operator + (matrix a){ vector> ret(value.size(),vector(a.value[0].size())); type temp; for(int i=value.size()-1;i>=0;--i){ for(int j=value[0].size()-1;j>=0;--j){ ret[i][j]=f.add(value[i][j],a.value[i][j]); } } return matrix(ret,f); } matrix operator * (matrix a){ vector> ret(value.size(),vector(a.value[0].size())); type temp; for(int i=value.size()-1;i>=0;i--){ for(int j=a.value[0].size()-1;j>=0;j--){ temp=f.zero; for(int k=a.value.size()-1;k>=0;k--){ temp=f.add(temp,f.product(value[i][k],a.value[k][j])); } ret[i][j]=temp; } } return matrix(ret,f); } matrix pow(long long p){ matrix temp(value,f); matrix ans=temp; bool flg=false; while(p>0){ if(p%2){ if(flg){ ans=ans*temp; }else{ flg=true; ans=temp; } } p=p/2; temp=temp*temp; } return ans; } matrix reduct(){//行簡約化 vector> ret=value; int N=ret.size(),M=ret[0].size(); int determined=0;//定められた行の個数 for(int i=0;i R(ret,f); return R; } matrix inv(){ int N=value.size(); int M=value[0].size(); vector> memo(N,vector(M*2)); vector> ret(N,vector(M)); for(int i=0;i(memo,f).reduct().value; for(int i=0;i R(ret,f); return R; } }; int main(){ double a,b,c,d,e,f; cin>>a>>b>>c>>d>>e>>f; field W("real"); vector> v={{a,b},{d,e}}; vector> r={{c},{f}}; matrix awt(v,W); matrix bawta(r,W); matrix cela=awt.inv()*bawta; cout<