#include <bits/stdc++.h>   using namespace std;   bool isAscending(const vector<int64_t>& vec) {     for (int i = 1; i < vec.size(); ++i) {       if (vec[i - 1] >= vec[i]) {         return false;       }     }     return true;   }   bool Requal(const vector<int64_t>& av, const vector<int64_t>& bv) {     for (int i = 0; i < av.size(); ++i) {       if (av[i] != bv[bv.size() - i - 1]) {         return false;       }     }     return true;   }   bool Equal(const vector<int64_t>& av, const vector<int64_t>& bv) {     for (int i = 0; i < av.size(); ++i) {       if (av[i] != bv[i]) {         return false;       }     }     return true;   }   int main() {     std::ios_base::sync_with_stdio(false);     std::cin.tie(nullptr);     int len;     cin >> len;     vector<int64_t> av(len), bv(len);     for (auto&& e : av) {       cin >> e;     }     for (auto&& e : bv) {       cin >> e;     }     if (len == 1) {       if (av[0] == bv[0]) {         cout <<  SMALL  << endl;         cout << 0 << endl;         cout << endl;       } else {         cout <<  IMPOSSIBLE  << endl;       }       return 0;     }     if (len == 2) {       int64_t total = 0;       vector<pair<char, int64_t>> buf;       string res;       if (av[0] > av[1]) {         swap(av[0], av[1]);         res +=  R ;       }       while (1) {         if (bv[0] > bv[1]) {           swap(bv[0], bv[1]);           buf.push_back({ R , 1});         }         if (bv[0] == av[0]) {           if (bv[1] >= av[1] && ((bv[1] - av[1]) % bv[0]) == 0) {             buf.push_back({ P , (bv[1] - av[1]) / bv[0]});             total += (bv[1] - av[1]) / bv[0];           } else {             total = -1;           }           break;         }         if (bv[0] == bv[1]) {           total = -1;           break;         }         buf.push_back({ P , bv[1] / bv[0]});         bv[1] = bv[1] % bv[0];         total += buf.back().second;         if (bv[1] == 0) {           bv[1] = bv[0];           total--;           buf.back().second--;         }       }       if (total < 0) {         cout <<  IMPOSSIBLE  << endl;         return 0;       }       if (total > 200000) {         cout <<  BIG  << endl;         cout << total << endl;       } else {         cout <<  SMALL  << endl;         for (auto it = buf.rbegin(); it != buf.rend(); ++it) {           for (int i = 0; i < it->second; ++i) {             res += it->first;           }         }         cout << res.size() << endl;         cout << res << endl;       }       return 0;     }     int64_t total = 0;     string res;     while (1) {       if (Equal(av, bv)) {         break;       }       if (Requal(av, bv)) {         res +=  R ;         break;       }       if (bv[0] > bv[1]) {         reverse(begin(bv), end(bv));         res +=  R ;       }       if (isAscending(bv) and bv[0] > 0) {         for (int i = len; i-- > 1;) {           bv[i] -= bv[i - 1];         }         res +=  P ;         ++total;       } else {         res =   ;         break;       }     }     if (res ==   ) {       cout <<  IMPOSSIBLE  << endl;     } else if (total > 200000) {       cout <<  BIG  << endl;       cout << total << endl;     } else {       cout <<  SMALL  << endl;       reverse(begin(res), end(res));       cout << res.size() << endl;       cout << res << endl;     }     return 0;   }