Chinese Paper Folding, or Zhezhi, is the art of folding paper that originated in China. It is the predecessor of origami.
Here we only consider a simplified problem. You are given a paper L cm by W cm in size and a list of operations to fold it.
Four types of operation are listed below:
1. L v , fold the left part of paper along the straight line x = v.
2. R v , fold the right part of paper along the straight line x = v.
3. U v , fold the upper part of paper along the straight line y = v.
4. D v , fold the lower part of paper along the straight line y = v.
Note that v is always an integer.
We define the left-lower corner of current paper as (0, 0) at every step (refer to the picture below). It is guaranteed that each operation is legal, that is, each operation is asked to fold paper of a positive area.
It is obvious that folding will make the straight lines into creases. We wonder the total length of all creases when paper is completely unfolded.