//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
#include <stdio.h>

using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;
ll MODP = 998244353;

ll kai(ll x,ll y){
  if(y == 0)return 1;
  if(y == 1)return x;
  if(y&1){
    return (x*kai(x,y-1))%MOD;
  }else{
    ll t = kai(x,y/2);
    return (t*t)%MOD;
  }
}

ll comb(ll a,ll b,vector<ll> &p){
  if(a == 0)return 1;
  if(b == 0)return 1;
  ll ans = p[a+b];
  ans = (ans*kai(p[a],MOD-2))%MOD;
  ans = (ans*kai(p[b],MOD-2))%MOD;
  return ans;
}

ll mind(int x,vector<int> &v){
  int ok = v.size()-1,ng = -1;
  while(ok - ng > 1){
    int next = (ok+ng)/2;
    if(v[next] > x){
      ok = next;
    }else{
      ng = next;
    }
  }
  return ok;
}

ll maxd(int x,vector<int> &v){
  int ok = 0,ng = v.size();
  while(ng - ok > 1){
    int next = (ok+ng)/2;
    if(v[next] < x){
      ok = next;
    }else{
      ng = next;
    }
  }
  return ok;
}


int main(){
  string S;
  cin >> S;
  char cur = S.at(0);
  ll ans = 0;
  ll count = 0;
  if(cur == 'R')count++;
  for(int i = 1;i <= S.size()-1;i++){
    if(cur == 'R' && S.at(i) == 'R'){
      count++;
    }else if(cur == 'R' && S.at(i) == 'S'){
      cur = 'S';
      if(ans < count)ans = count;
      count = 0;
    }else if(S.at(i) == 'R'){
      count++;
      cur = 'R';
    }else{
      continue;
    }
  }
  if(count > ans)ans = count;
  cout << ans << endl;


  return 0;
}

#include<iostream>

int main()
{
    int a = 0;
    int Calc=0;

    std::cin >> a;
 
    Calc=a+(a*a)+(a*a*a);

    std::cout << Calc;

    return 0;
}