import java.util.*; import java.io.*; public class flashingflourescents_font { public static void main(String[] args) throws Exception { PrintWriter out = new PrintWriter(System.out); new flashingflourescents_font(new FastScanner(System.in), out); out.close(); } int oo = 987654321; int toMask(String s) { int res = 0; for (int i=0; i 0) { numFlips++; for (int mask=0; mask<=allOn; mask++) if (dist[mask] < numFlips) { for (int button=0; button= numChars){ curChar = 0; try{ numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 0) return -1; } return buf[curChar++]; } boolean isSpaceChar(int c) { return c==' '||c=='\n'||c=='\r'||c=='\t'||c==-1; } boolean isEndline(int c) { return c=='\n'||c=='\r'||c==-1; } int nextInt() { return Integer.parseInt(next()); } long nextLong() { return Long.parseLong(next()); } double nextDouble() { return Double.parseDouble(next()); } String next(){ int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do{ res.appendCodePoint(c); c = read(); }while(!isSpaceChar(c)); return res.toString(); } String nextLine(){ int c = read(); while (isEndline(c)) c = read(); StringBuilder res = new StringBuilder(); do{ res.appendCodePoint(c); c = read(); }while(!isEndline(c)); return res.toString(); } }