Problem: Oh, no!

The coronavirus has caught you, and now you're sitting in a dark cellar, with tied legs (but not hands). You have a delicious cookie, a laptop in front of you, and your ideal development environment is open. The coronavirus convinces you to solve the following problem.

You are given two arrays A and B of size n. You can do operations of two types with array A: 

  * Reverse array A. That is the array [A_1,\ A_2,\ …,\ A_n] transformes into [A_n,\ A_{n-1},\ …,\ A_1]. 
  * Replace A with an array of its prefix sums. That is, the array [A_1,\ A_2,\ …,\ A_n] goes to [A_1,\ (A_1+A_2),\ …,\ (A_1+A_2+…+A_n)]. 



You need to understand if you can get an array B from the array A. If it is possible, you will have to restore the order of these operations by minimizing the number of operations of the second type. Fortunately, the coronavirus is good today, so he has allowed you not to restore actions if the minimum number of second type operations is more than 2⋅ 10^5. But coronavirus resents you, so if you restore the answer, the total number of operations should not exceed 5⋅ 10^5.

Solve this problem and get the cookie, or the coronavirus will extend the quarantine for five years and make the whole economy collapse! 

Input

The first line contains a single integer n (1≤ n ≤ 2⋅ 10^5).

The second line contains n integers A_1, A_2, …, A_n (1 ≤ A_i ≤ 10 ^ {12}).

The third line contains n integers B_1, B_2, …, B_n (1 ≤ B_i ≤ 10 ^ {12}).

Output

If you cannot get B from the A array, print "IMPOSSIBLE" (without quotes) on a single line.

If the minimum number of operations of the second type exceeds 2⋅ 10^5, print "BIG" (without quotes). In the second line print the number of operations of the second type, that needs to be applied to get array B from A.

Otherwise, in the first line print "SMALL" (without quotes). In the second line print the total number of operations of the first and second types m ≤ 5⋅ 10^5 (it is guaranteed that in this case there is such a sequence of actions). In the third line print a line of length m, consisting of characters 'R"and 'P' (without quotes).

The i-th character should be 'R', if the i-th action is of the first type, and should be 'P', otherwise.

If there are several such sequences, you can print any of them.

You can print each character in the uppercase or in the lowercase.

Examples

Input


2
5 7
5 7


Output


SMALL
0



Input


2
1 1
300000 1


Output


BIG
299999


Input


2
10 1
13 14


Output


SMALL
6
RPPPRP


Input


3
1 2 1
2 1 2


Output


IMPOSSIBLE

Note

In the first example, the arrays A and B already equal, so the number of required operations =0.

In the second example, we need to replace A with the prefix sums 299999 times and then reverse the array. Since 299999>2⋅ 10^5, there is no need to restore the answer.

In the fourth example, you cannot get B from the A.

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
template <class S, class T>
inline S max_L(S a, T b) {
  return a >= b ? a : b;
}
inline int my_getchar() {
  static char buf[1048576];
  static int s = 1048576;
  static int e = 1048576;
  if (s == e && e == 1048576) {
    e = fread(buf, 1, 1048576, stdin);
    s = 0;
  }
  if (s == e) {
    return EOF;
  }
  return buf[s++];
}
inline void rd(int &x) {
  int k;
  int m = 0;
  x = 0;
  for (;;) {
    k = my_getchar();
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      x = k - '0';
      break;
    }
  }
  for (;;) {
    k = my_getchar();
    if (k < '0' || k > '9') {
      break;
    }
    x = x * 10 + k - '0';
  }
  if (m) {
    x = -x;
  }
}
inline void rd(long long &x) {
  int k;
  int m = 0;
  x = 0;
  for (;;) {
    k = my_getchar();
    if (k == '-') {
      m = 1;
      break;
    }
    if ('0' <= k && k <= '9') {
      x = k - '0';
      break;
    }
  }
  for (;;) {
    k = my_getchar();
    if (k < '0' || k > '9') {
      break;
    }
    x = x * 10 + k - '0';
  }
  if (m) {
    x = -x;
  }
}
struct MY_WRITER {
  char buf[1048576];
  int s;
  int e;
  MY_WRITER() {
    s = 0;
    e = 1048576;
  }
  ~MY_WRITER() {
    if (s) {
      fwrite(buf, 1, s, stdout);
    }
  }
};
MY_WRITER MY_WRITER_VAR;
void my_putchar(int a) {
  if (MY_WRITER_VAR.s == MY_WRITER_VAR.e) {
    fwrite(MY_WRITER_VAR.buf, 1, MY_WRITER_VAR.s, stdout);
    MY_WRITER_VAR.s = 0;
  }
  MY_WRITER_VAR.buf[MY_WRITER_VAR.s++] = a;
}
inline void wt_L(char a) { my_putchar(a); }
inline void wt_L(int x) {
  int s = 0;
  int m = 0;
  char f[10];
  if (x < 0) {
    m = 1;
    x = -x;
  }
  while (x) {
    f[s++] = x % 10;
    x /= 10;
  }
  if (!s) {
    f[s++] = 0;
  }
  if (m) {
    my_putchar('-');
  }
  while (s--) {
    my_putchar(f[s] + '0');
  }
}
inline void wt_L(long long x) {
  int s = 0;
  int m = 0;
  char f[20];
  if (x < 0) {
    m = 1;
    x = -x;
  }
  while (x) {
    f[s++] = x % 10;
    x /= 10;
  }
  if (!s) {
    f[s++] = 0;
  }
  if (m) {
    my_putchar('-');
  }
  while (s--) {
    my_putchar(f[s] + '0');
  }
}
inline void wt_L(const char c[]) {
  int i = 0;
  for (i = 0; c[i] != '\0'; i++) {
    my_putchar(c[i]);
  }
}
int N;
long long A[200000];
long long B[200000];
int ress;
char res[5000000];
long long cnt;
int main() {
  long long s;
  rd(N);
  {
    int Lj4PdHRW;
    for (Lj4PdHRW = (0); Lj4PdHRW < (N); Lj4PdHRW++) {
      rd(A[Lj4PdHRW]);
    }
  }
  {
    int e98WHCEY;
    for (e98WHCEY = (0); e98WHCEY < (N); e98WHCEY++) {
      rd(B[e98WHCEY]);
    }
  }
  if (N == 1) {
    if (A[0] == B[0]) {
      wt_L("SMALL\n0\n");
      wt_L('\n');
    } else {
      wt_L("IMPOSSIBLE");
      wt_L('\n');
    }
    return 0;
  }
  for (;;) {
    int i;
    for (i = (0); i < (N); i++) {
      if (A[i] != B[i]) {
        break;
      }
    }
    if (i == N) {
      break;
    }
    for (i = (0); i < (N); i++) {
      if (A[i] != B[N - 1 - i]) {
        break;
      }
    }
    if (i == N) {
      res[ress++] = 'R';
      break;
    }
    if (B[0] > B[N - 1]) {
      res[ress++] = 'R';
      reverse(B, B + N);
    }
    if (N == 2) {
      s = (B[1] - max_L(A[0], A[1])) / B[0];
      if (s <= 0) {
        s = 1;
      }
      cnt += s;
      if (cnt <= 200000) {
        int a2conNHc;
        for (a2conNHc = (0); a2conNHc < (s); a2conNHc++) {
          res[ress++] = 'P';
        }
      }
      B[1] -= B[0] * s;
    } else {
      cnt++;
      res[ress++] = 'P';
      s = 0;
      for (i = (0); i < (N); i++) {
        B[i] -= s;
        s += B[i];
      }
    }
    for (i = (0); i < (N); i++) {
      if (B[i] <= 0) {
        wt_L("IMPOSSIBLE");
        wt_L('\n');
        return 0;
      }
    }
    if (max_L(A[0], A[N - 1]) > max_L(B[0], B[N - 1])) {
      wt_L("IMPOSSIBLE");
      wt_L('\n');
      return 0;
    }
  }
  if (cnt > 200000) {
    wt_L("BIG");
    wt_L('\n');
    wt_L(cnt);
    wt_L('\n');
  } else {
    reverse(res, res + ress);
    wt_L("SMALL");
    wt_L('\n');
    wt_L(ress);
    wt_L('\n');
    wt_L(res);
    wt_L('\n');
  }
  return 0;
}