You are given an N × N grid initially filled by zeros. Let the rows and columns of the grid be numbered from 1 to N, inclusive. There are two types of operations can be applied to the grid:

- RowAdd R X: all numbers in the row R should be increased by X.
- ColAdd C X: all numbers in the column C should be increased by X.

Now after performing the sequence of such operations you need to find the maximum element in the grid.

-----Input-----
The first line of the input contains two space separated integers N and Q denoting the size of the grid and the number of performed operations respectively. Each of the following Q lines describe an operation in the format described above.

-----Output-----
Output a single line containing the maximum number at the grid after performing all the operations.

-----Constraints-----
- 1 ≤ N ≤ 314159
- 1 ≤ Q ≤ 314159
- 1 ≤ X ≤ 3141
- 1 ≤ R, C ≤ N

-----Example-----
Input:
2 4
RowAdd 1 3
ColAdd 2 1
ColAdd 1 4
RowAdd 2 1

Output:
7

-----Explanation-----
The grid changes as follows:
00  33  34  74  74
00  00  01  41  52

The maximum number in the final grid is 7.

```python

USER_FILENAME = "<user_code>"
import sys, json, builtins
import math, heapq, bisect, itertools, functools, collections, statistics, fractions, decimal, operator, array, random, re, string, os, pathlib
try:
    import resource as _res
except Exception:
    _res = None
from collections import Counter, defaultdict, deque, OrderedDict
from functools import lru_cache, reduce
from itertools import accumulate, permutations, combinations, product
from math import gcd, ceil, floor, sqrt
from decimal import Decimal
try:
    from typing import *
except Exception:
    pass
try:
    sys.setrecursionlimit(1_000_000)
except Exception:
    pass
try:
    import site as _site
    try:
        _sys_sites = _site.getsitepackages() if hasattr(_site, "getsitepackages") else []
        for _p in _sys_sites:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
    try:
        _usp = _site.getusersitepackages()
        if isinstance(_usp, str):
            _usp = [_usp]
        for _p in _usp:
            if _p and _p not in sys.path:
                sys.path.append(_p)
    except Exception:
        pass
except Exception:
    pass

ns = {"__name__": "__main__"}
for _k, _v in list(globals().items()):
    if not _k.startswith("_"):
        ns[_k] = _v
_CODE = '\'\'\'\n\n          Online Python Compiler.\n       Code, Compile, Run and Debug python program online.\nWrite your code in this editor and press "Run" button to execute it.\n\n\'\'\'\n\nimport sys\nimport os\nimport math\nimport copy\nfrom bisect import bisect\nfrom io import BytesIO, IOBase\n# from math import sqrt,floor,factorial,gcd,log,ceil\nfrom collections import deque,Counter,defaultdict\nfrom itertools import permutations, combinations\n\n#define function \ndef Int(): return int(sys.stdin.readline())\ndef Mint(): return map(int,sys.stdin.readline().split())\ndef Lstr(): return list(sys.stdin.readline().strip())\ndef Str(): return sys.stdin.readline().strip()\ndef Mstr(): return map(str,sys.stdin.readline().strip().split())\ndef List(): return list(map(int,sys.stdin.readline().split()))\ndef Hash(): return dict()\ndef Mod(): return 1000000007\ndef Ncr(n,r,p): return ((fact[n])*((ifact[r]*ifact[n-r])%p))%p\ndef Most_frequent(list): return max(set(list), key = list.count)\ndef Mat2x2(n): return [List() for _ in range(n)]\n\n# Driver Code   \ndef solution():\n n,k=map(int,input().split())\n m=-float(\'inf\')\n a=[0 for i in range(n)]\n b=[0 for i in range(n)]\n for i in range(k):\n  q,r,e=map(str,input().split())\n  r,e=int(r),int(e)\n  if q[0]==\'R\':\n   a[r-1]+=e\n  else:\n   b[r-1]+=e\n print(str(max(a)+max(b))+\'\\n\')\n   \n  \n#Call the solve function          \ndef __starting_point():\n  solution() \n__starting_point()'
_co = compile(_CODE, USER_FILENAME, "exec")
exec(_co, ns, ns)

```

Measured memory_bytes: 179237