#include using namespace std; int Count(int nrROW, int nrCOL, int nrOfMoves, char *a){ int count = 0; if(nrOfMoves == 0) return 0; for(int i=0; i < nrOfMoves; ++i){ if(a[i] == 'L'){ count++; nrCOL--; } if(a[i] == 'R' && a[i - 1] == 'L'){ nrCOL++; } if(a[i] == 'L' && a[i - 1] == 'R'){ nrCOL++; } if(a[i] == 'R'){ count++; nrCOL--; } if(a[i] == 'U'){ count++; nrROW--; } if(a[i] == 'D' && a[i - 1] == 'U'){ nrROW++; } if(a[i] == 'U' && a[i - 1] == 'D'){ nrROW++; } if(a[i] == 'D'){ count++; nrROW--; } } if(nrROW >=1 && nrCOL >= 1) return count; else return 0; } 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<