#include #include #include using namespace std; #define ll long long #define all(x) (x).begin(), (x).end() #define yes "Yes" #define no "No" #define ret return #define xin cin #define cpit cout #define farg frag #define fix(x) fixed << setprecision(x) #define fore(p, v) for (auto &p : v) #define mp(a, b) make_pair(a, b) #define mt(a, b, c) make_tuple(a, b, c) #define rep(i, l, r) for (ll i = (l); i < (r); i++) #define inf ((1LL << 62) - (1LL << 31)) #define built(bit) __builtin_popcount(bit) #define Pi 3.14159265 ll mod = 1e9 + 7; int main() { ll turn = 0; ll level = 1; ll EXP = 0; ll T = 1000; ll Now_X = 12; vector> Board(1e5, vector(25, 0)); vector> Point(1e5, vector(25, 0)); while (T--) { ll N; cin >> N; if (N == -1) break; vector H(N), P(N), X(N); for (ll i = 0; i < N; i++) { cin >> H[i] >> P[i] >> X[i]; Board[turn + 59][X[i]] += H[i]; Point[turn + 59][X[i]] += P[i]; } bool frag = 0; for (ll i = 1; i <= 59; i++) { if (Board[turn + i][Now_X] > i * ((EXP / 100) + 1)) { Now_X = (Now_X + 1) % 25; cout << 'R' << endl; frag = 1; Board[turn + i][Now_X] -= (EXP / 100) + 1; if (Board[turn + i][Now_X] == 0) EXP += Point[turn + i][Now_X]; break; } if (Board[turn + i][Now_X] != 0) { Board[turn + i][Now_X] -= (EXP / 100) + 1; if (Board[turn + i][Now_X] == 0) EXP += Point[turn + i][Now_X]; break; } } if (frag) continue; if (Board[turn + 1][Now_X] == 0) { cout << 'S' << endl; } else if (Board[turn + 1][(Now_X + 1) % 25] == 0) { cout << 'R' << endl; Now_X = (Now_X + 1) % 25; } else if (Board[turn + 1][(Now_X + 24) % 25] == 0) { cout << 'L' << endl; Now_X = (Now_X + 24) % 25; } else break; turn++; } }