#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define rep(i,s,n) for(long long i = (s); (n) > i; i++) #define REP(i,n) rep(i,0,n) #define RANGE(x,a,b) ((a) <= (x) && (x) <= (b)) #define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b)) #define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d)) #define POWT(x) ((x)*(x)) #define ALL(x) (x).begin(), (x).end() #define MODU 1000000007 #define bitcheck(a,b) ((a >> b) & 1) #define bitset(a,b) ( a |= (1 << b)) #define bitunset(a,b) (a &= ~(1 << b)) using namespace std; typedef pair pii; typedef long long ll; const pii four_Dir[4] = { { -1 ,0 },{ 0 ,1 }, { 1 ,0 },{ 0,-1 } }; signed main() { char num1[201] = "", num2[201] = ""; scanf("%s %s", num1, num2); char sum[202] = "", kt[200][202] = { "" }, kake[401] = ""; REP(i, strlen(num1)) { num1[i] -= '0'; } REP(i, strlen(num2)) { num2[i] -= '0'; } REP(i, max(strlen(num1),strlen(num2))) { sum[i] = num1[i] + num2[i]; sum[i + 1] += sum[i]/10; sum[i] %=10; } REP(i, strlen(num1)) { REP(j, strlen(num2)) { kt[i][j] = num1[i] * num2[j]; kt[i][j + 1] += kt[i][j] / 10; kt[i][j] %= 10; } } REP(i, strlen(num1)) { REP(j, strlen(kt[i])) { kake[i] += kt[i][j + i]; } kake[i + 1] = kake[i] / 10; kake[i] %= 10; } if (strlen(sum) > strlen(kake)) { printf("S\n"); } else if (strlen(sum) < strlen(kake)) { printf("P\n"); return 0; } else { for (int i = strlen(sum) - 1; 0 <= i; i--) { if (sum[i] > kake[i]) { printf("S\n"); return 0; } if (sum[i] < kake[i]) { printf("P\n"); return 0; } } } printf("E\n"); return 0; }