Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm  ×  h mm sheet of glass, a diamond glass cutter and lots of enthusiasm. What he lacks is understanding of what to carve and how.

In order not to waste time, he decided to practice the technique of carving. To do this, he makes vertical and horizontal cuts through the entire sheet. This process results in making smaller rectangular fragments of glass. Leonid does not move the newly made glass fragments. In particular, a cut divides each fragment of glass that it goes through into smaller fragments.

After each cut Leonid tries to determine what area the largest of the currently available glass fragments has. Since there appear more and more fragments, this question takes him more and more time and distracts him from the fascinating process.

Leonid offers to divide the labor — he will cut glass, and you will calculate the area of the maximum fragment after each cut. Do you agree?

Input

The first line contains three integers w, h, n (2 ≤ w, h ≤ 200 000, 1 ≤ n ≤ 200 000).

Next n lines contain the descriptions of the cuts. Each description has the form H y or V x. In the first case Leonid makes the horizontal cut at the distance y millimeters (1 ≤ y ≤ h - 1) from the lower edge of the original sheet of glass. In the second case Leonid makes a vertical cut at distance x (1 ≤ x ≤ w - 1) millimeters from the left edge of the original sheet of glass. It is guaranteed that Leonid won't make two identical cuts.

Output

After each cut print on a single line the area of the maximum available glass fragment in mm2.

Examples

Input

4 3 4
H 2
V 2
V 3
V 1


Output

8
4
4
2


Input

7 6 5
H 4
V 3
V 5
H 2
V 1


Output

28
16
12
6
4

Note

Picture for the first sample test: 

<image> Picture for the second sample test:  <image>
//package c296;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.Scanner;
import java.util.StringTokenizer;
import java.util.TreeSet;

public class q3

{

    public static void main(String args[])
    {
        new q3().solve();
    }
    public void solve()
    {
        FasterScanner s=new FasterScanner();
        TreeSet<pair> h=new TreeSet<pair>();
        TreeSet<pair> w=new TreeSet<q3.pair>();
        long w1=s.nextLong();
        long h1=s.nextLong();
        long n=s.nextLong();
        int [] wa=new int[(int)w1+1];
        int [] ha=new int[(int)h1+1];
        
        wa[0]=0;
        wa[(int)w1]=(int)w1;
        
        h.add(new pair(0,h1));

        w.add(new pair(0,w1));
        ha[0]=0;
        ha[(int)h1]=(int)h1;
    //  System.out.println(Arrays.toString(wa)+" "+Arrays.toString(ha));
    //  System.out.println(h.toString()+" "+w.toString());
        SegTree wq=new SegTree(wa,-1);

        SegTree hq=new SegTree(ha,-1);
        
    //  System.out.println(Arrays.toString(wq.dp)+" "+Arrays.toString(hq.dp));
        StringBuilder ans=new StringBuilder();
        
        int [] wma=new int[(int)w1+1];
        int [] hma=new int[(int)h1+1];
        
        Arrays.fill(wma, Integer.MAX_VALUE);

        Arrays.fill(hma, Integer.MAX_VALUE);
        wma[0]=0;
        wma[(int)w1]=(int)w1;
        
        
        hma[0]=0;
        hma[(int)h1]=(int)h1;
        
        SegTree wqmin=new SegTree(wma,Integer.MAX_VALUE);

        SegTree hqmin=new SegTree(hma,Integer.MAX_VALUE);
        
        
        for(int i=0;i<n;i++)
        {
            String c=s.nextString();
            int val=s.nextInt();
            if(c.charAt(0)=='H')
            {
                int l=hq.query(0, val);

                int r=hqmin.query(val+1,(int)h1+1);
                ha[val]=val;
                hq.upd(val, val);
                hma[val]=val;
                hqmin.upd(val, val);
                pair tmp=new pair(l,r);
                pair tmp1=new pair(l,val);
                pair tmp2=new pair(val,r);
                h.remove(tmp);
                h.add(tmp1);
                h.add(tmp2);
                
                long tmpa=h.last().v;
                long tmpb=w.last().v;
                //System.out.println(h.toString()+" "+w.toString()+" "+i+" "+tmpa*tmpb);
                
                //System.out.println(h.toString()+" "+w.toString()+" "+i+" "+tmpa*tmpb+" tmp= "+tmp+" "+tmp1+" "+tmp2+" l="+l+" r="+r);
                
                ans.append(tmpa*tmpb+"\n");
            }
            else
            {
                int l=wq.query(0, val);

                int r=wqmin.query(val+1,(int)w1+1);
                //System.out.println(Arrays.toString(wq.dp));
                wa[val]=val;
                wq.upd(val, val);
                wma[val]=val;
                wqmin.upd(val, val);
                pair tmp=new pair(l,r);
                pair tmp1=new pair(l,val);
                pair tmp2=new pair(val,r);
                w.remove(tmp);
                w.add(tmp1);
                w.add(tmp2);

                long tmpa=w.last().v;
                long tmpb=h.last().v;

                //System.out.println(h.toString()+" "+w.toString()+" "+i+" "+tmpa*tmpb+" tmp= "+tmp+" tmpa="+tmp1+" tmpb="+tmp2+" l="+l+" r="+r+" val="+val);
                ans.append(tmpa*tmpb+"\n");
            }
        }
        System.out.println(ans);
            
        
    }
    
    static class pair implements Comparable<pair>
    {
        long l;
        long r;
        long v;
        public pair(long l,long r)
        {
            this.l=l;
            this.r=r;
            this.v=r-l;         
        }
        @Override
        public int compareTo(pair o) {
            // TODO Auto-generated method stub
            if(v!=o.v)
            return (int)(v-o.v);
            else
                return (int)(l-o.l);
        }
        
        public boolean equals(Object o)
        {
            o=(pair)o;
            if(this.l==((pair)o).l && this.r==((pair)o).r)
            return true;
            
            return false;
            
        }
        public String toString()
        {
            return l+" "+r+" ";
        }
    }


    public static long gcd(long a, long b) 
    {

        if(a==b)
            return a;
        if(a==0)
            return b;
        if(b==0)
            return a;

        if(a>b)
            return gcd(b,a%b);
        else
            return gcd(a,b%a);
    }

    public static long modPow( long a, long b, long mod )
    {
        long res=1,pow=a;
        while( b>0 )
        {
            if( (b&1)==1 )
            {
                res = (pow*res)%mod;
            }
            pow = (pow*pow)%mod;
            b=b/2;
        }
        return res;
    }
    
    static class nck
    {
        public static long ncr[][];
        
        public nck(long z,long p)//z==maxvalue  p==mod
        {
            generateNCR(z, p);
        }
        
        private static void generateNCR( long z, long p )
        {
            ncr = new long[(int)z+1][(int)z+1];
            ncr[0][0] = 1;
            for(int i=1; i<=z; i++)
            {
                ncr[i][0] = 1;
                ncr[0][i] = 0;
            }
            for(int i=1; i<=z; i++)
            {
                for(int j=1; j<=z; j++)
                {
                    ncr[i][j] = (ncr[i-1][j] + ncr[i-1][j-1]) % p;
                }
            }
        }

        private static long lucas(long n, long k, long p) 
        {
        
            long ans = 1;
            
            while(n>0)
            {
                int N = (int)(n%p);
                int K = (int)(k%p);
                if(K>N)
                    return 0;
                ans *= (ncr[N][K] );
                n /= p;
                k /= p;
            }
            return ans % p;
        }
    }
    
     class SegTree
    {
         int seg[];
         int dp[];
        int n;
        int d;
        public SegTree(int[] arr,int defaul)
        {
            this.dp=arr;
            n=dp.length;
            seg=new int[4*arr.length];
            this.d=defaul;
            build(1,0,n);
            
        }

        public void build(int id,int l,int r){
            if(r-l<2){
                seg[id]=dp[l];
                return;
            }
            int mid=(l+r)/2;
            build(2*id,l,mid);
            build(2*id+1,mid,r);
            seg[id]=merge(seg[2*id],seg[2*id+1]);
        }

        public int query(int l,int r)
        {
            return givemin(1,l,r,0,n);
        }

        public  int givemin(int id,int x,int y,int l,int r){
            if(x<=l && y>=r){
                return seg[id];
            }
            if(y<=l || r<=x){
                return d;
            }
            int mid=(l+r)/2;
            return merge(givemin(2*id, x, y, l, mid),givemin(2*id+1, x, y, mid, r));
        }

        public int upd(int id,int value)
        {
            return update(1,id,value,0,n);
        }
        public  int update(int id,int p,int value,int l,int r){
            if(r-l<2){
                dp[p]=value;
                seg[id]=value;
                return value;
            }
            int mid=(l+r)/2;
            if(p<mid){
                update(2*id, p, value, l, mid);
                seg[id]=merge(seg[2*id], seg[2*id+1]);
                return seg[id];
            }
            else{
                update(2*id+1, p, value, mid,r);
                seg[id]=merge(seg[2*id+1], seg[2*id]);
                return seg[id];

            }
        }

        public int merge(int l,int r)
        {

            //set initial value
            if(d==-1)
            return Math.max(l, r);
            else
                return Math.min(l, r);
        }
    }


    static class UF {

        private int[] parent;  // parent[i] = parent of i
        private byte[] rank;   // rank[i] = rank of subtree rooted at i (never more than 31)
        private int count;   
        int[] seg;
        int max;
        // number of components
        public UF(int N) {
            if (N < 0) throw new IllegalArgumentException();
            count = N;
            parent = new int[N];
            rank = new byte[N];
            seg=new int[N];
            for (int i = 0; i < N; i++) {
                parent[i] = i;
                rank[i] = 0;
                seg[i]=1;
            }
            max=1;
        }

        public int find(int p) {
            if (p < 0 || p >= parent.length) throw new IndexOutOfBoundsException();
            while (p != parent[p]) {
                parent[p] = parent[parent[p]];    // path compression by halving
                p = parent[p];
            }
            return p;
        }
        public int count() {
            return count;
        }

        public boolean connected(int p, int q) {
            return find(p) == find(q);
        }

        public boolean union(int p, int q) {
            //    System.out.println("uf "+p+" "+q);
            int rootP = find(p);
            int rootQ = find(q);
            if (rootP == rootQ) return false;

            // make root of smaller rank point to root of larger rank
            if      (rank[rootP] < rank[rootQ])
            {
                parent[rootP] = rootQ;
                seg[rootQ]+=seg[rootP];
                max=Math.max(seg[rootQ],max);
            }
            else if (rank[rootP] > rank[rootQ])
            {
                parent[rootQ] = rootP;
                seg[rootP]+=seg[rootQ];
                max=Math.max(seg[rootP],max);
            }
            else {
                parent[rootQ] = rootP;
                rank[rootP]++;
                seg[rootP]+=seg[rootQ];
                max=Math.max(seg[rootP],max);
            }
            count--;
            return true;
        }

    }



    static class SparseTable
    {
        int[][] st;
        public SparseTable(int[] h){
            int n=h.length;
            int MAX_LOG=(int)Math.ceil(Math.log(n)/Math.log(2))+1;
            st=new int[n][MAX_LOG];
            for (int i = 0; i < n; i++)
                st[i][0] = h[i];
            for (int j = 1; (1 << j) <= n; j++)
            {
                for (int i = 0;( i + (1 << j) - 1 )< n; i++)
                {
                    st[i][j]=Math.max(st[i][j-1],st[i+(1<<(j-1))][j-1]);
                }
            }
        }
        public int query(int l,int r)
        {
            int x=(int )Math.floor((Math.log(r-l+1)/Math.log(2)));
            int ans=Math.max(st[l][x],st[r-(1<<x)+1][x]);
            return ans;
        }

    }

    public static class FasterScanner {
        private byte[] buf = new byte[1024];
        private int curChar;
        private int numChars;

        public int read() {
            if (numChars == -1)
                throw new InputMismatchException();
            if (curChar >= numChars) {
                curChar = 0;
                try {
                    numChars = System.in.read(buf);
                } catch (IOException e) {
                    throw new InputMismatchException();
                }
                if (numChars <= 0)
                    return -1;
            }
            return buf[curChar++];
        }

        public String nextLine() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isEndOfLine(c));
            return res.toString();
        }

        public String nextString() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            StringBuilder res = new StringBuilder();
            do {
                res.appendCodePoint(c);
                c = read();
            } while (!isSpaceChar(c));
            return res.toString();
        }

        public long nextLong() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            long res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int nextInt() {
            int c = read();
            while (isSpaceChar(c))
                c = read();
            int sgn = 1;
            if (c == '-') {
                sgn = -1;
                c = read();
            }
            int res = 0;
            do {
                if (c < '0' || c > '9')
                    throw new InputMismatchException();
                res *= 10;
                res += c - '0';
                c = read();
            } while (!isSpaceChar(c));
            return res * sgn;
        }

        public int[] nextIntArray(int n) {
            int[] arr = new int[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextInt();
            }
            return arr;
        }

        public long[] nextLongArray(int n) {
            long[] arr = new long[n];
            for (int i = 0; i < n; i++) {
                arr[i] = nextLong();
            }
            return arr;
        }

        private boolean isSpaceChar(int c) {
            return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
        }

        private boolean isEndOfLine(int c) {
            return c == '\n' || c == '\r' || c == -1;
        }
    }

}

