#include <stdio.h>
#include <ctype.h>
int main(void)
{
double t; char c;
scanf("%lf %c", &t, &c);
c = toupper(c);
if (c != 'C' && c != 'F') {
puts("Please Check Your Data");
}
printf("RESULT = %f\n", c == 'C' ? (1.8 * t + 32): (5.0/9.0)*(t-32));
return 0;
}