// #ifdef DEBUG // #define _GLIBCXX_DEBUG // #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // these require C++11 #include #include #include #include #include using namespace std; #define int long long #define all(c) c.begin(), c.end() #define repeat(i, n) for (int i = 0; i < static_cast(n); i++) #define debug(x) #x << "=" << (x) #ifdef DEBUG #define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl #else #define dump(x) #endif template ostream &operator<<(ostream&os,const pair& p){ os << "(" << p.first << "," << p.second << ")"; return os; } typedef complex point; // template // struct _v_traits {using type = std::vector::type>;}; // template // struct _v_traits {using type = std::vector;}; // template // using vec = typename _v_traits::type; template ostream &operator<<(ostream &os, const vector &vec) { os << "["; for (const auto &v : vec) { os << v << ","; } os << "]"; return os; } template T apply_doubling(const T& x, const long long& n, const T& id_elem, const F& binary_op){ if(n == 0) return id_elem; T ret = apply_doubling(binary_op(x,x),n/2,id_elem,binary_op); if(n % 2 == 1) ret = binary_op(ret,x); return ret; } struct P { double k; int p; }; double EPS = 1e-7; P multi(P l,P r){ double k = l.k * r.k; int p = l.p + r.p; while(k >= 10 - EPS){ k /= 10; p++; } return P{k,p}; } ostream& operator<<(ostream& os,const P& p){ int x = (int)floor(p.k); int y = (int)floor(p.k*10) % 10; return os << x << " " << y << " " << p.p; } P henkan(int k){ return multi(P{1.0*k,0},P{1,0}); } P solve(int a,int b){ return apply_doubling(henkan(a),b,P{1,0},multi); } signed main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; for(int i=0;i> A >> B; cout << solve(A,B) << endl; } return 0; }