inlinechargc(){ if (i == j) j = (i = b) + fread(b, 1, n, stdin); return i == j ? EOF : *i ++; }
template <typename T> inline T read(){ T x = 0; int f = 0; while (!isdigit(c = gc())) f |= c == '-'; while (isdigit(c)) x = (x << 1) + (x << 3) + (c & 15), c = gc(); return f ? -x : x; }
template <> inline string read(){ string s = ""; while (!isgraph(c = gc())); while (isgraph(c)) s += c, c = gc(); return s; } }