#include <iostream>
using namespace std;
int Count(int nrROW, int nrCOL, int nrOfMoves, char *a){
    int count = 0, countL = 0, countR = 0, countU = 0, countD = 0;
      if(nrOfMoves == 0)
        return 0;
      for(int i=0; i < nrOfMoves; ++i){
            if(a[i] == 'L')
              countL++;
            if(a[i] == 'R')
              countR++;
            if(a[i] == 'U')
              countU++;
            if(a[i] == 'D')
              countD++;
      }
      if(countL == countR && countU == countD)
        return nrOfMoves;
      while(countL > 0 && nrCOL > 1){
          count++;
          countL--;
          nrCOL--;

      }
      while(countR > 0 && nrCOL > 1){
          count++;
          countR--;
          nrCOL--;

      }
      while(countU > 0 && nrROW > 1){
          count++;
          countU--;
          nrROW--;

      }
      while(countD > 0 && nrROW > 1){
          count++;
          countD--;
          nrROW--;

      }
    return count;
}
int main(){
    int nrROW, nrCOL, k;
    cin>>nrROW>>nrCOL;
    cin>>k;
    char moves[k];
      for(int i=0; i < k; ++i)
        cin>>moves[i];
    cout<<Count(nrROW, nrCOL, k, moves);
    return 0;
}