#include<iostream>
#include<iomanip>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<string>
#include<utility>
#include<numeric>
#include<algorithm>
#include<cmath>
#include<climits>
using namespace std;

using ll = long long;

class Stream{
public:
    Stream(){

    }
    //配列以外の入力を受け取る
    void read(){

    }
    template<typename First, typename... Rest>
    void read(First& first, Rest&... rest){
        cin >> first;
        read(rest...);
    }
    //配列を区切って出力する
    template<typename T>
    void write_vec(vector<T>& v, char divider){
        for(size_t i = 0; i < v.size(); i++){
            cout << v[i] << divider;
        }
    }
};

int main(){
    Stream io;
    
    int R, G;
    io.read(R, G);
    cout << G + G - R;
    return 0;
}
#include<bits/stdc++.h>
using namespace std;
int main(){
  char S;
  int mix=0;
  int a=0;
  for(int i=0; i<3;i++){
    cin >> S;
    if (S=='R'){
      a++;
      mix=max(a,mix);
    } else {
      a=0;
    }
  }
  cout << mix << endl;
}