import std.stdio;
import std.string;

void main() {
  int n;
  readf(" %s", &n);
  readln;
  auto s = readln.strip;
  auto rCount = s.count('R'), gCount = s.count('G'), bCount = s.count('B');
  auto reach = new bool[201][201][201];
  reach[rCount][gCount][bCount] = true;
  foreach_reverse (total; 0..201) {
    foreach (i; 0..total + 1) {
      foreach (j; 0..total + 1 - i) {
        int k = total - i - j;
        if (reach[i][j][k]) {
          if (i >= 1 && j >= 1) reach[i - 1][j - 1][k + 1] = true;
          if (i >= 1 && k >= 1) reach[i - 1][j + 1][k - 1] = true;
          if (j >= 1 && k >= 1) reach[i + 1][j - 1][k - 1] = true;
          if (i >= 2) reach[i - 1][j][k] = true;
          if (j >= 2) reach[i][j - 1][k] = true;
          if (k >= 2) reach[i][j][k - 1] = true;
        }
      }
    }
  }
  if (reach[0][0][1]) write('B');
  if (reach[0][1][0]) write('G');
  if (reach[1][0][0]) write('R');
  writeln;
}


import std.algorithm;
import std.range;
import std.stdio;
import std.typecons;
import std.traits;
import std.array;
struct Input
{
  T next(T)()
  {
    import std.conv;
    return to!T(nextWord);
  }
  string nextWord()
  {
    if (_nextWords.empty)
	_nextWords.insertFront(readln().split);
    string word = _nextWords.front; _nextWords.removeFront;
    return word;
  }
  import std.container;
  DList!string _nextWords;
}
Input input;
void read(T...)(ref T args)
{
  import std.traits;
  static foreach(i; 0 .. T.length)
    static if(isArray!(T[i]) && !is(T[i] == string))
      foreach(ref e; args[i])
    	read(e);
    else static if(isTuple!(T[i]))
      static foreach(n; 0 .. T[i].Types.length)
	read(args[i][n]);
    else
      args[i] = input.next!(typeof(args[i]))();
}
auto itup(alias k, alias F)()
{
  alias T = Parameters!F;
  foreach(i; 0 .. k)
    {
      T t; get(t);
      F(t);
    }
}
alias get = read;
void wone(T)(T t, char end)
{
  static if(isArray!T && !is(T == string))
    {
      foreach(i; 0 .. t.length - 1)
	  write(t[i], ' ');
      write(t[$ - 1], end);
    }
  else
      write(t, end);
}
void wr(T...)(T t)
{
  static foreach(i; 0 .. T.length)
    static if(i + 1 < T.length)
      wone(t[i], ' ');
    else
      wone(t[i], '\n');
}
void ans(T...)(T t)
{
  import core.stdc.stdlib;
  wr(t);
  exit(0);
}
void main()
{
  int l, r; get(l, r);
  for(int candidate = l; candidate <= r; candidate++)
    {
      int[10] count;
      int c = candidate;
      while(c)
	{
	  count[c % 10]++;
	  c /= 10;
	}
      bool issol = true;
      foreach(cn; count)
	{
	  if (cn > 1)
	    {
	      issol = false;
	      break;
	    }
	}
      if (issol)
	{
	  ans(candidate);
	}
    }
  ans(-1);
}


import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }
void modpow(ref long x, long y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(ref long x, long y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto n = RD!int;
	auto a = RDA;
	auto index = a.MAKE_IDX;

	auto tot = a.sum;
	if (tot % 2)
		writeln(0);
	else
	{
		auto dp = new bool[](cast(size_t)(tot/2+1));
		dp[0] = true;
		foreach (i; index)
		{
			foreach_reverse (j; 0..dp.length)
			{
				if (dp[j] == false) continue;
				auto x = cast(int)(a[i] + j);
				if (x > tot/2) continue;
				dp[x] = true;
			}
		}

		if (dp[$-1] == false)
			writeln(0);
		else
		{
			long pos = -1;
			foreach (i; 0..n)
			{
				if (a[i] % 2)
				{
					pos = i;
					break;
				}
			}
			if (pos != -1)
			{
				writeln(1);
				writeln(pos+1);
			}
			else
			{
				foreach (i; 0..n)
				{
					auto nTot = cast(int)(tot - a[i]);
					if (dp[nTot/2] == false)
					{
						pos = i;
						break;
					}
				}
				if (pos == -1)
					assert(0);
				writeln(1);
				writeln(pos+1);
			}
		}
	}
	stdout.flush;
	debug readln;
}


import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
bool minimize(T)(ref T x, T y) { if (x > y) { x = y; return true; } else { return false; } }
bool maximize(T)(ref T x, T y) { if (x < y) { x = y; return true; } else { return false; } }

long mod = 10^^9 + 7;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto N = RD;

	long f(long x)
	{
		if (x < 10) return 9;

		long ans = 1;
		++x;
		while (x % 10 == 0)
		{
			x /= 10;
		}
		return ans + f(x);
	}

	writeln(f(N));
	stdout.flush();
	debug readln();
}


import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		int res = 1;
		int total = 1;
		while (total < n)
		{
			total += total + 1;
			res += 1;
		}
		writeln (res);
	}
}


static immutable uint PRIMES_NUM = 16;
static immutable uint MAX_MASK = 1 << (PRIMES_NUM + 1);
static immutable uint MAX_NUM = 101;
static immutable uint MAXN = 58 + 1;
static immutable uint[] PRIME_DECOMP_MASKS = [0, 0, 1, 2, 1, 4, 3,  8, 1, 2,  5, 16, 3, 32,  9,  6, 1,  64, 3, 128,  5, 10, 17, 256, 3, 4, 33, 2,  9,  512,  7, 1024, 1, 18,  65, 12, 3, 2048, 129, 34,  5, 4096, 11,  8192, 17,  6, 257, 16384, 3,  8,  5,  66, 33, 32768, 3, 20,  9, 130,  513];

pure uint subabs(const uint a, const uint b) {
	return (a > b) ? a - b : b - a;
}

pure void solvedp(const uint[] as, out uint[] bs) {
	import std.typecons;

	alias Node = Tuple!(uint, "ind", uint, "mask");
	alias PrevNode = Tuple!(uint, "u", Node, "prev");

	pure bool nodeEq(const Node a, const Node b) {
		return (a.ind == b.ind) && (a.mask == b.mask);
	}

	PrevNode[][] prev = new PrevNode[][](MAX_NUM, MAX_MASK);
	auto cost = new uint[][](MAX_NUM, MAX_MASK);

	cost[0][] = uint.max;
	foreach(uint u; 1..59) {
		auto maskjoined = PRIME_DECOMP_MASKS[u];
		if (cost[0][maskjoined] > subabs(as[0], u)) {
			cost[0][maskjoined] = subabs(as[0], u);
			prev[0][maskjoined] = PrevNode(u, Node(0, maskjoined));
		}
	}
	foreach (i; 1..as.length) {
		cost[i][] = uint.max;
		foreach (mask, c; cost[i - 1]) {
			if (c == uint.max) {continue;}
			foreach (uint u; 1..MAXN) {
				auto umask = PRIME_DECOMP_MASKS[u];
				if (0 != (umask & mask)) {continue;}
				auto maskjoined = umask | mask;
				if (cost[i][maskjoined] > c + subabs(as[i], u)) {
					cost[i][maskjoined] = c + subabs(as[i], u);
					prev[i][maskjoined] = PrevNode(u, Node(i - 1, mask));
				}
			}
		}
	}

	auto minCost = uint.max;
	uint minMask = 0;
	foreach (mask, c; cost[as.length - 1]) {
		if (c < minCost) {
			minCost = c;
			minMask = mask;
		}
	}

	{
		bs.length = as.length;
		uint ind = as.length - 1;
		auto next = prev[ind][minMask];
		auto oldNext = next;
		do {
			bs[ind--] = next.u;
			oldNext = next;
			next = prev[next.prev.ind][next.prev.mask];
		} while(false == nodeEq(oldNext.prev, next.prev));
		if (0 == ind) {bs[ind] = next.u;}
	}
}

int main(string[] argv) {
    import std.stdio;

	uint n = 0;
	uint[] as;

	readf(" %s", &n);
	as.length = n;
	foreach (i; 0..n) {
		readf(" %s", &as[i]);
	}

	uint[] bs;
	solvedp(as, bs);

	foreach (b; bs) {
		write(b, ' ');
	}

    return 0;
}


import std.stdio, std.string, std.algorithm, std.conv, std.range, std.math;

void main() {
  string s1 = readln.chomp.toLower;
  string s2 = readln.chomp.toLower;

  if (s1 > s2) { "1".writeln; }
  else if (s1 == s2) { "0".writeln; }
  else { "-1".writeln; }
}


import std.stdio;

void main() {
    int n;
    scanf("%d", &n);
    int ans = 1;
    int x = 4;
    for (int i = 2; i <= n; ++i) {
        ans += x;
        x += 4;
    }
    printf("%d\n", ans);
}


import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0;
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	long n = rlong, m = rlong;
	Finite.mod = m;
	Finite ans = Finite(0);
	foreach(i; 1 .. n + 1){
		log("i:", i, "n+1-i:", n + 1 - i,  "perm(i):", perm(i), "perm(n-i):", perm(n - i));
		ans += Finite(n + 1 - i) * (n + 1 - i) * perm(i) * perm(n - i);
	}
	ans.writeln;
}

import std.conv;
struct Finite{
	long value; static long mod = 1_000_000_007;
	private static long[] _inv = [0, 1], _frac = [1, 1], _invfrac = [1, 1];
	this(long v){ value = val(v); }
	static long val(long v){
		if(v >= 0) return v % mod;
		else return (v + mod  - (v / mod) * mod) % mod;
	}
	bool opCast(T: bool)(){ return value != 0; }
	Finite opUnary(string s){ long v;
		if(s == "+") v = value;
		else if(s == "-") v = mod - value;
		else if(s == "++") v = value + 1;
		else if(s == "--") v = value + mod - 1;
		else assert(0, "Operator unary " ~ s ~ " not implemented");
		return Finite(v);
	}
	Finite opBinary(string s)(Finite b){
		return opBinary!s(b.value);
	}
	Finite opBinary(string s)(long u){ long v;
		if(s == "+") v = value + u;
		else if(s == "-") v = value + mod - u;
		else if(s == "*") v = value * u;
		else if(s == "/") v = value * inv(u);
		else assert(0, "Operator " ~ s ~ " not implemented");
		return Finite(v);
	}
	Finite opBinaryRight(string s)(long u){ long v;
		if(s == "+") v = u + value;
		else if(s == "-") v = u + mod - value;
		else if(s == "*") v = u * value;
		else if(s == "/") v = u * invvalue;
		else assert(0, "Operator " ~ s ~ " not implemented");
		return Finite(v);
	}
	Finite opAssign(long v){ value = v; return this; }
	Finite opOpAssign(string s)(Finite b){
		return opOpAssign!s(b.value);
	}
	Finite opOpAssign(string s)(long v){
		if(s == "+") value = (value + v) % mod;
		else if(s == "-") value = (value + mod - v) % mod;
		else if(s == "*") value = (value * v) % mod;
		else if(s == "/") value = (value * inv(v)) % mod;
		else assert(0, "Operator " ~ s ~ "= not implemented");
		return this;
	}
	bool opEquals(Finite b){
		return(value == b.value);
	}
	string toString(){ return value.to!string; }
	long inv(long v){
		v = val(v);
		while(v >= _inv.length){
			_inv ~= _inv[(mod % $).to!int] * (mod - mod / _inv.length) % mod;
		}
		return _inv[v.to!int];
	}
	long invvalue(){
		return inv(value);
	}
	static Finite opCall(long v){ return Finite(val(v)); }

}

// ---以下はユーティリティ--- //

/// mod p における階乗
/// 例 perm(6) = Finite(120)
/// オーダーはプログラム全体で出てくる最大の引数Nに対してO(N)
Finite perm(long x){
	static Finite[] _perm = [];
	if(_perm.length == 0) _perm ~= Finite(1);
	x = Finite.val(x);
	while(x >= _perm.length)
			_perm ~= _perm[$ - 1] * _perm.length;
	return _perm[x.to!int];
}

/// mod p における階乗の逆元
/// 例 invperm(6) = Finite(1) / Finite(120)
/// オーダーはプログラム全体で出てくる最大の引数Nに対してO(N)
/// ※ invperm(x) と inv(perm(x)) は同じ値だが、後者は計算量が O(mod) になる
Finite invperm(long x){
	static Finite[] _invperm = [];
	if(_invperm.length == 0) _invperm ~= Finite(1);
	x = Finite.val(x);
	while(x >= _invperm.length)
			_invperm ~= _invperm[$ - 1] / _invperm.length;
	return _invperm[x.to!int];
}

/// mod p における二項係数（定義に注意：(a + b)! / a! / b! ）
/// 例 pascal(3, 2) = Finite(10)
/// ただし、「a < 0 または b < 0」のとき答えは 0 を返します。
Finite pascal(long a, long b){
	if(a < 0 || b < 0) return Finite(0);
	Finite res = perm(a + b) * invperm(a) * invperm(b);
	return res;
}


import std.algorithm, std.conv, std.range, std.stdio, std.string;
void main () {
	int k = readln.split[1].to!int;
	int [] v;
	foreach (c; readln.strip.map!"a - 96".array.sort) if (v.empty || c > v.back + 1) v ~= c;
	writeln (v.length >= k ? v[0..k].sum : -1);
}


import std.conv, std.functional, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.complex, std.container, std.math, std.numeric, std.range, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

int N;
string S;

void main() {
  try {
    for (; ; ) {
      S = readToken();
      N = cast(int)(S.length);

      const a = S.count('a');

      int ans = a;
      foreach (x; a .. N + 1) {
        if (2 * a > x) {
          chmax(ans, x);
        }
      }
      writeln(ans);
    }
  } catch (EOFException e) {
  }
}


import std.algorithm;
import std.container;
import std.exception;
import std.math;
import std.stdio;
import std.string;
import std.typecons;

immutable int MAX_N = 54;
immutable int MOD = 1_000_000_007;

long [MAX_N] [MAX_N] c;

void main ()
{
    foreach (i; 0..MAX_N)
    {
        c[i][0] = 1;
        foreach (j; 1..i + 1)
        {
            c[i][j] = (c[i - 1][j - 1] + c[i - 1][j]) % MOD;
        }
    }

    int n, k;
    while (readf (" %s %s", &n, &k) > 0)
    {
        auto a = new int [n];
        k /= 50;
        int x = 0;
        int y = 0;
        foreach (i; 0..n)
        {
            readf (" %s", &a[i]);
            a[i] /= 50;
            if (a[i] == 1)
            {
                x++;
            }
            else if (a[i] == 2)
            {
                y++;
            }
            else
            {
                enforce (false);
            }
        }

        alias Tuple !(int, "b", int, "x", int, "y") state;
        alias Tuple !(int, "dist", int, "num") value;
        state [] q;
        q.reserve (2 * (x + 1) * (y + 1));
        auto f = new value [] [] [] (2, x + 1, y + 1);
        foreach (b; 0..2)
        {
            foreach (cx; 0..x + 1)
            {
                f[b][cx][] = value (int.max, 0);
            }
        }

        f[0][0][0] = value (0, 1);
        q ~= state (0, 0, 0);
        while (q.length > 0)
        {
            state cur = q[0];
            q = q[1..$];
            int cb = cur.b;
            int cx = cur.x;
            int cy = cur.y;
            int cd = f[cb][cx][cy].dist + 1;
            int cn = f[cb][cx][cy].num;
            debug {writefln ("%s %s %s", cb, cx, cy);}
            int nb = 1 - cb;
            foreach (dx; 0..x + 1)
            {
                foreach (dy; 0..y + 1)
                {
                    if (!dx && !dy)
                    {
                        continue;
                    }
                    if (dx + dy * 2 > k)
                    {
                        break;
                    }
                    int nx, ny;
                    long mult;
                    if (cb) // back
                    {
                        nx = cx - dx;
                        ny = cy - dy;
                        mult = (c[cx][dx] *
                                c[cy][dy]) % MOD;
                        if (nx < 0 || ny < 0)
                        {
                            continue;
                        }
                    }
                    else // forward
                    {
                        nx = cx + dx;
                        ny = cy + dy;
                        mult = (c[x - cx][dx] *
                                c[y - cy][dy]) % MOD;
                        if (nx > x || ny > y)
                        {
                            continue;
                        }
                    }
                    if (f[nb][nx][ny].dist == int.max)
                    {
                        f[nb][nx][ny].dist = cd;
                        q ~= state (nb, nx, ny);
                    }
                    if (f[nb][nx][ny].dist != cd)
                    {
                        continue;
                    }
                    f[nb][nx][ny].num =
                      (f[nb][nx][ny].num +
                       mult * cn) % MOD;
                }
            }
        }

        writefln ("%s", f[1][x][y].dist == int.max ?
                  -1 : f[1][x][y].dist);
        writefln ("%s", f[1][x][y].num);
    }
}


import std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	string s;
	while ((s = readln.strip) != "")
	{
		auto t = readln.split;
		bool ok = t.any !(r => r[0] == s[0] || r[1] == s[1]);
		writeln (ok ? "YES" : "NO");
	}
}


import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

//long mod = 10^^9 + 7;
long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto n = RD!int;
	auto a = RDA;
	a.sort();

	long ans = 1;
	foreach (i; 1..a.length)
	{
		bool ok;
		foreach (j; 0..i)
		{
			if (a[i] % a[j] == 0)
			{
				ok = true;
				continue;
			}
		}
		if (!ok)
			++ans;
	}

	writeln(ans);
	stdout.flush();
	debug readln();
}


import
		std.math,
		std.conv,
		std.file,
		std.array,
		std.stdio,
		std.string,
		std.algorithm;

void main()
{
	auto arr = readln.splitter.map!(to!int).array;

	auto l = arr[0], r = arr[1], a = arr[2];

	auto need = max(l, r) - min(l, r);
	auto rest = a - need;
	auto ans = min(l, r) + (rest < 0 ? a : need + rest / 2);

	writeln(ans * 2);
}


module main;

import core.stdc.stdio;

char[101] s;

int main(string[] argv)
{
	int n,want;
	scanf("%d%d",&n,&want);
	scanf("%s",&s);

	int mx=0;
	for(int at=0,to=at;at<n;at=to) {
	    while(to<n&&s[to]!='N') ++to;
	    if(s[at]!='N') continue;
	    while(to<n&&s[to]=='N') ++to;
	    int cur=to-at; if(cur>mx) mx=cur;
	}

	bool can=false; int nerr=0;
	for(int i=0;i<want;++i) if(s[i]=='Y') ++nerr;
	for(int i=0;i<=n-want;++i) {
	    if(nerr==0&&(i==0||s[i-1]!='N')&&(i==n-want||s[i+want]!='N')) can=true;
	    if(i==n-want) break;
	    if(s[i]=='Y') --nerr;
	    if(s[i+want]=='Y') ++nerr;
	}

	if(want>=mx&&can) printf("YES\n"); else printf("NO\n");
	return 0;
}


import std.stdio;
import std.conv;
import std.string;

void main()
{
    string[] lines;
    while(true)
    {
        string line = stdin.readln().strip();
        if (line == "") break;
        lines ~= [line];
    }
    auto result = process(lines);
    foreach (line; result)
    {
        write(line);
    }
}

string[] process(string[] lines)
{
    auto parts = split(lines[0], ' ');
    auto n = to!long(parts[0]);
    auto m = to!long(parts[1]);
    auto a = to!long(parts[2]);
    auto n_tiles = n % a == 0 ? n/a : n/a+1;
    auto m_tiles = m % a == 0 ? m/a : m/a+1;
    auto result = n_tiles*m_tiles;
    return [to!string(result)];
}

unittest
{
    auto expected = ["4"];
    auto actual = process(["6 6 4"]);
    writefln("expected: %s", expected[0]);
    writefln("actual: %s", actual[0]);
    assert(expected == actual);
}

unittest
{
    auto expected = ["27126743055556"];
    auto actual = process(["1000000000 1000000000 192"]);
    writefln("expected: %s", expected[0]);
    writefln("actual: %s", actual[0]);
    assert(expected == actual);
}


import std.stdio;
import std.string;

int main()
{
	int t=0;
	readf(" %d", &t);
	for (int i=0; i<t; i++)
	{
		int a=0;
		readf(" %d", &a);
		if (a%7==0)
		{
			writeln(a/7);
		}
		else
		{
			writeln(a/7+1);
		}
	}
	return 0;
}


import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import core.bitop;

immutable int medN = 150;
immutable int maxN = medN * 2 + 1;
immutable int dirs = 8;
immutable int [dirs] dRow = [-1, -1, -1,  0, +1, +1, +1,  0];
immutable int [dirs] dCol = [-1,  0, +1, +1, +1,  0, -1, -1];

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		readln;
		auto t = readln.split.map !(to !(int)).array;

		ubyte [maxN] [maxN] [3] f;
		int b = 0;
		f[b][medN][medN] |= 1 << 1;
		foreach (ct; t)
		{
			foreach (j; 0..ct)
			{
				b ^= 1;
				foreach (ref g; f[b][])
				{
					g[] = 0;
				}
				foreach (row; 0..maxN)
				{
					foreach (col; 0..maxN)
					{
						foreach (dir; 0..dirs)
						{
							if (f[!b][row][col] & (1 << dir))
							{
								int nrow = row + dRow[dir];
								int ncol = col + dCol[dir];
								f[b][nrow][ncol] |= 1 << dir;
							}
						}
					}
				}

				foreach (row; 0..maxN)
				{
					foreach (col; 0..maxN)
					{
						f[2][row][col] |= f[b][row][col];
					}
				}
			}

			b ^= 1;
			foreach (ref g; f[b][])
			{
				g[] = 0;
			}
			foreach (row; 0..maxN)
			{
				foreach (col; 0..maxN)
				{
					foreach (dir; 0..dirs)
					{
						if (f[!b][row][col] & (1 << dir))
						{
							f[b][row][col] |= 1 << ((dir + 1) & 7);
							f[b][row][col] |= 1 << ((dir + 7) & 7);
						}
					}
				}
			}
		}

		long res = 0;
		foreach (row; 0..maxN)
		{
			foreach (col; 0..maxN)
			{
				res += (f[2][row][col] != 0);
			}
		}
		writeln (res);
	}
}


import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.random;
import std.math;
import std.container;
import std.numeric;
import std.bigint;

bool is_prime(long x) {
  if (x <= 1 || x % 2 == 0) return false;
  long i = 3;
  while (i*i <= x) {
    if (x % i == 0)
      return false;
    i += 2;
  }
  return true;
}

void main() {
  auto N = readln.chomp.to!long;
  if (N == 2) writeln(1);
  else if (N == 3) writeln(1);
  else if (N == 5) writeln(1);
  else if (N % 2 == 0) writeln(2);
  else if (is_prime(N)) writeln(1);
  else if (is_prime(N-2)) writeln(2);
  else writeln(3);
}


import core.bitop;
import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.random;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		readln;
		int [] [] a;
		foreach (i; 0..n)
		{
			a ~= readln.splitter.map !(to !(int)).array;
		}
//		randomShuffle (a);

		int [] ans;
		foreach (i; 0..n)
		{
			bool ok = true;
			foreach (j; 0..n)
			{
				if (i == j)
				{
					continue;
				}
				foreach (k; j + 1..n)
				{
					if (i == k)
					{
						continue;
					}
					int v = 0;
					v += (a[i][0] - a[j][0]) *
					    (a[i][0] - a[k][0]);
					v += (a[i][1] - a[j][1]) *
					    (a[i][1] - a[k][1]);
					v += (a[i][2] - a[j][2]) *
					    (a[i][2] - a[k][2]);
					v += (a[i][3] - a[j][3]) *
					    (a[i][3] - a[k][3]);
					v += (a[i][4] - a[j][4]) *
					    (a[i][4] - a[k][4]);
					if (v > 0)
					{
						ok = false;
						break;
					}
				}
			}
			if (ok)
			{
				ans ~= i + 1;
			}
		}

		writeln (ans.length);
		foreach (c; ans)
		{
			writeln (c);
		}
	}
}


import std.stdio;
import core.stdc.stdio;

int main(string[] argv)
{
	long n1, n2, k1, k2;
	scanf("%d %d %d %d", &n1, &n2, &k1, &k2);
	if (n1 > n2)
	{
		printf("First");
	} else {
		printf("Second");
	}
	return 0;
}


import std.container;
import std.algorithm;
import std.range;
import std.array;
import std.stdio;
import std.utf;
import std.math;
import std.typecons;

DList!string _words;

void read(T...)(ref T t)
{
  void singleRead(W)(ref W w)
  {
    import std.stdio: readln;
    while(_words.empty)
      {
        import std.array: split;
        foreach(word; readln.split)
          {
            _words.insertBack(word);
          }
      }
    import std.conv: to;
    string word = _words.front;
    _words.removeFront;
    w = to!W(word);
  }
  static foreach(i; 0 .. T.length)
    {
      static if (is(typeof({foreach(ref e; t[i]){}})) && !is(T[i] == string))
        {
          foreach(ref element; t[i])
            read(element);
        }
      else
        {
          singleRead(t[i]);
        }
    }
}

auto next(T)()
{
  T t;
  read(t);
  return t;
}

size_t ind(T)(T t)
{
  return cast(size_t)t;
}

ref auto at(R, I)(ref R r, I i)
{
  return r[cast(size_t)i];
}

void set(R, I, V)(ref R r, I i, V v)
{
  r[cast(size_t)i] = v;
}

import std.conv;
import std.traits;
import std.meta;
int _loglevel = -1;
void _log(string functionName, argSeq...)()
{
  foreach(i; 0 .. _loglevel * 4)
    write(' ');
  write(functionName);
  static foreach(arg; argSeq)
    {
      write(" ", arg.stringof, " = ", arg);
    }
  writeln;
}
enum logCall =
  q{
    debug
    {
     {
     _loglevel++;
     alias _parameterTuple = ParameterIdentifierTuple!(mixin(split(__FUNCTION__, ".").back));
     static if (_parameterTuple.length > 0)
       mixin(`_log!(__FUNCTION__, `, [_parameterTuple].joiner(", ").array, `);`);
     else
       _log!(__FUNCTION__);
      }
     foreach(i; 0 .. _loglevel * 4) write(' ');
     writeln('{');
     scope(exit)
       {
         foreach(i; 0 .. _loglevel * 4) write(' ');
         writeln('}');
         _loglevel--;
       }
    }
};

void logSym(S...)(int line = __LINE__, string file = __FUNCTION__)
{
  debug
    {
      foreach(i; 0 .. _loglevel * 4) write(' ');
      write(file, "(", line, "):");
      static foreach(s; S)
        write(" ", s.stringof, " = ", s);
      writeln;

    }
}

Array!E makeArray(E, S)(S size, lazy E value = E.init)
{
  auto a = Array!E();
  a.length = cast(size_t) size;
  foreach(ref ai; a)
    ai = value();
  return a;
}
Array!E makeArray(E, S)(S size)
{
  auto a = Array!E();
  a.length = cast(size_t) size;
  return a;
}

template mem(alias F)
{
  ReturnType!F[Tuple!(Parameters!F)] table;
  ReturnType!F mem(Parameters!F args)
  {
    return table.require(tuple(args), F(args));
  }
}

string input(string names, string type = "long")
{
  return text(type, " ", names, "; read(", names, ");");
}

auto pmod(T, W)(T t, W w)
{
  return (t%w + w) % w;
}

void main()
{
  auto n = next!int;
  auto s = next!string;
  char[2] lastChar = [0, 0];
  auto color = new bool[n.ind];
  foreach(i, c; s)
    {
      if (c >= lastChar[0])
        {
          color[i] = 0;
          lastChar[0] = c;
        }
      else if (c >= lastChar[1])
        {
          color[i] = 1;
          lastChar[1] = c;
        }
      else
        {
          writeln("NO");
          return;
        }
    }
  writeln("YES");
  foreach(b; color)
    write(cast(int)b);
  writeln;
}


import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

immutable long mod = 10 ^^ 9 + 7;
immutable long oneHalf = mod / 2 + 1;

// x -> a1x + a0
// b1(a1x + a0) + b0 = b1a1x + b1a0+b0
long [2] apply (long [2] a, long [2] b)
{
	return [(b[1] * a[0] + b[0]) % mod, (b[1] * a[1]) % mod];
}

long [2] gen (long k)
{
	if (k == 0)
	{
		return [0L, 1];
	}
	if (k == 1)
	{
		return [mod - oneHalf, 2L];
	}
	auto res = gen (k / 2);
	res = apply (res, res);
	if (k & 1)
	{
		res = apply (res, gen (1));
	}
	return res;
}

long solve (long x, long k)
{
	if (x == 0)
	{
		return 0;
	}
	x %= mod;
	auto a = gen (k);
	a = apply (a, [0L, 2]);
	return (a[1] * x + a[0]) % mod;
}

void main ()
{
	long x, k;
	while (readf (" %s %s", &x, &k) > 0)
	{
		writeln (solve (x, k));
	}
}


import std.stdio;
import std.math;
int main()
{
	int[5][5] m;
	for (int i=0; i<5; i++)
	{
		for (int j=0; j<5; j++)
		{
			readf(" %d", &m[i][j]);
		}
	}
	int x=0;
	int y=0;
	for (int i=0; i<5; i++)
	{
		for (int j=0; j<5; j++)
		{
			if (m[i][j]==1)
			{
				x=i;
				y=j;
			}
		}
	}
	writeln(abs(x-2)+abs(y-2));
	return 0;
}


//prewritten code: https://github.com/antma/algo
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.traits;

void main() {
  int n;
  readf! " %d" (n);
  ulong res;
  if (!(n & 1)) {
    res = 1 << (n / 2);
  }
  writeln (res);
}


import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.exception;
import std.functional;
import std.math;
import std.numeric;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import core.bitop;

void main ()
{
	string s;
	while ((s = readln.strip) != "")
	{
		long nb, ns, nc;
		readf (" %s %s %s ", &nb, &ns, &nc);
		long pb, ps, pc;
		readf (" %s %s %s ", &pb, &ps, &pc);
		long kb, ks, kc;
		kb = count (s, 'B');
		ks = count (s, 'S');
		kc = count (s, 'C');
		long r;
		readf (" %s ", &r);

		bool go (long num)
		{
			long d = r;

			long gb = num * kb - nb;
			if (gb > 0)
			{
				d -= gb * pb;
			}

			long gs = num * ks - ns;
			if (gs > 0)
			{
				d -= gs * ps;
			}

			long gc = num * kc - nc;
			if (gc > 0)
			{
				d -= gc * pc;
			}

			return d >= 0;
		}

		long lo = 0L;
		long hi = 1L << 42;
		while (lo < hi)
		{
			long me = lo + ((hi - lo + 1) >> 1);
			if (go (me))
			{
				lo = me;
			}
			else
			{
				hi = me - 1;
			}
		}
		writeln (lo);
	}
}


import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional, std.meta;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n;
    readf("%s", &n);
    readln;

    string k = readln.chomp;

    ulong ans = 0;
    ulong pw = 1;
    int right = k.length.to!int - 1;
    while (right >= 0) {
        ulong cur = 0;
        int lft = right;
        ulong m = 1;
        while (lft >= 0 && cur + m * (k[lft] - '0') < n) {
            cur += m * (k[lft] - '0');
            m *= 10;
            --lft;
        }

        while (lft+1 < right && k[lft+1] == '0') { ++lft; }

        debug { writeln(cur, ' ', pw); }

        ans += cur * pw;
        right = lft;
        pw *= n;
    }

    ans.writeln;
}


import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.datetime.stopwatch;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

void main()
{
    int n, m, i, j, a, b;
    readf("%s %s %s %s %s %s", &n, &m, &i, &j, &a, &b);
    readln;

    immutable int INF = 10 ^^ 9 + 7;

    int Steps(int tox, int toy) {
        if ((tox - i) % a != 0 || (toy - j) % b != 0) { return INF; }

        int xd = abs(tox - i) / a, yd = abs(toy - j) / b;

        if (xd % 2 != yd % 2) { return INF; }

        if (xd < yd && (n - 1) < a) { return INF; }
        if (yd < xd && (m - 1) < b) { return INF; }

        return max(xd, yd);
    }

    int ans = INF;
    auto x = [1, n], y = [1, m];
    foreach (ex; x) {
        foreach (ey; y) {
            ans = min(ans, Steps(ex, ey));
        }
    }

    if (ans == INF) {
        writeln("Poor Inna and pony!");
        return;
    }

    ans.writeln;
}


module main;

import std.stdio;
import std.numeric;
import std.string;
import std.algorithm;
import std.conv;
import std.range;

void main(string[] args)
{
	string a = readln.chomp;
	string b = readln.chomp;
	foreach(e; zip(a, b)) {
		if (e[0] == e[1]) {
			write(0);
		} else {
			write(1);
		}
	}
	writeln;
}


import core.thread;
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex;

//	Input
class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { tokens = readln.split; if (stdin.eof) throw new EOFException; } auto token = tokens[0]; tokens.popFront; return token; }
int readInt() { return to!int(readToken); }
long readLong() { return to!long(readToken); }
real readReal() { return to!real(readToken); }

//	chmin/chmax
void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

//	Pair
struct Pair(S, T) {
	S x; T y;
	int opCmp(    const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }
	int opCmp(ref const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }
	string toString() const { return "(" ~ to!string(x) ~ ", " ~ to!string(y) ~ ")"; }
}
auto pair(S, T)(inout(S) x, inout(T) y) { return Pair!(S, T)(x, y); }

//	Array
int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = as.length; for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <  val); }); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <= val); }); }
T[] unique(T)(in T[] as) { T[] bs; foreach (a; as) if (bs.empty || bs[$ - 1] != a) bs ~= a; return bs; }

BigInt R, X0, Y0, X1, Y1;

void main(string[] args) {
	try {
	for (; ; ) {
		R = readLong;
		X0 = readLong;
		Y0 = readLong;
		X1 = readLong;
		Y1 = readLong;

		const d2 = (X1 - X0)^^2 + (Y1 - Y0)^^2;
		/*
			2 R x >= sqrt(d2)
		*/

		BigInt lo = -1, ho = d2 + 1;
		for (; lo + 1 < ho; ) {
			const mo = (lo + ho) / 2;
			((2 * R * mo)^^2 >= d2) ? (ho = mo) : (lo = mo);
		}
		writeln(ho);

	}
	} catch (EOFException) {}
}


import std.stdio;
import std.random;

static immutable N = 50;

int n, sum, now;
int[N + 1] a, b;
int[N + 1][N + 1] w;

int main() {
  auto input = stdin;
  auto output = stdout;
  input.readf(" %d", &n);
  for (int i = 1; i <= n; ++ i)
    input.readf(" %d", &a[i]), sum += a[i];
  for (int i = 1; i <= n; ++ i)
    for (int j = 1; j <= n - i + 1; ++ j)
      input.readf(" %d", &w[i][j]);
  int T = 100000;
  while (T --) {
    b = a, now = sum;
    for (int i = 1; i < n; ++ i) {
      int t = n - i + 1;
      for (int j = 1; j <= t; ++ j) {
        if (b[j] < w[i][j]) {
          now -= b[j], b[j] = 0;
          if (now < w[n][1]) break;
        } else if (j == n - i + 1) b[j - 1] += b[j], b[j] = 0;
        else if (j != 1)
          if (b[j - 1] + b[j] >= w[i + 1][j - 1])
            if ((uniform(0, 2) || T == 99999) && T != 99998) b[j - 1] += b[j], b[j] = 0;
      }
      if (now < w[n][1]) break;
    }
    if (now >= w[n][1] && b[1] >= w[n][1]) {
      output.writeln("Cerealguy");
      return 0;
    }
  }
  output.writeln("Fat Rat");
  return 0;
}


import std.algorithm;
import std.array;
import std.container;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
    readln;
    auto a = readln.chomp;
    if (a == "0") {
        writeln(a);
        return;
    }

    auto zrs = a.count!(c => c == '0');
    auto ans = "1" ~ '0'.repeat(zrs).array;
    writeln(ans);
}


import std.stdio;
import std.algorithm;
import std.string;
import std.range;
import std.array;
import std.conv;
import std.complex;
import std.math;
import std.ascii;
import std.bigint;
import std.container;
import std.typecons;

auto readInts() {
	return array(map!(to!int)(readln().strip().split()));
}
auto readInt() {
	return readInts()[0];
}
auto readLongs() {
	return array(map!(to!long)(readln().strip().split()));
}
auto readLong() {
	return readLongs()[0];
}

void readlnTo(T...)(ref T t) {
    auto s = readln().split();
    assert(s.length == t.length);
    foreach(ref ti; t) {
        ti = s[0].to!(typeof(ti));
        s = s[1..$];
    }
}

const real eps = 1e-10;

void main(){
    auto n = readInt();
    writeln(n/7 * 2 + max(0, n%7-5), " ", n/7*2+min(2, n%7));
}


import std.stdio: readln, writeln;
import std.string: strip;
import std.array: split;
import std.conv: to;
import std.algorithm: min, count;

/**
 * User: Jior
 * Date: 03.06.13
 * Time: 13:13
 */

void main() {
    auto rgb = strip(readln()).split().to!(int[]);
    int result = 0;
   	foreach(ref color; rgb) {
   		if(color) {
   			if (color % 3) {
   				result += color / 3;
   				color %= 3;
			} else {
				result += color / 3 - 1;
				color = 3;
			}
   		}
   	}

 	switch(rgb.count(3)) {
 		case 2:
 			result += 2;
 			break;
 		case 3:
 			result += 3;
 			break;
 		default:
 			result += min(rgb[0], rgb[1], rgb[2]);
 	}

   	writeln(result);
}


module _template;
import std.stdio;
import std.string;
import std.algorithm;
import std.container;
import std.range;
import std.math;
import std.numeric;
import std.conv;
import std.typecons;
import std.format;

struct IO {
        string read_string() {
                while (tokens.empty) {
                tokens = readln.split;
        }
        auto token = tokens.front;
                tokens.popFront;
                return token;
        }

        int read_int() {
                return read_string.to!int;
        }

        string[] tokens;
}

void main() {
        IO cin;
        int t = 1;
        // int t = cin.read_int;
        while (t--) {
                char[2] pos = cin.read_string.dup;
                int x = pos[0] - 'a';
                int y = pos[1] - '0';
                y--;
                int count = 0;

                for (int i = -1; i <= 1; i++) {
                        for (int j = -1; j <= 1; j++) {
                                if (x + i < 8 && x + i >= 0 && y + j >= 0 && y - j < 8)
                                    count++;
                        }
                }
                writeln(count - 1);
        }
}


import std.stdio, std.string, std.container, std.conv, std.numeric, std.range;
import std.array, std.bigint, std.algorithm, std.math, std.typecons, std.random;

void main() {

	int a, b, s;

	readf(" %s %s %s", &a, &b, &s);

	if (abs(a) + abs(b) == s)
		writeln("Yes");
	else
		if ((abs(a) + abs(b) > s))
			writeln("No");
		else
			if ((abs(a) + abs(b) < s) && !((abs(a) + abs(b) - s) % 2))
				writeln("Yes");
			else
				writeln("No");
}


import core.thread;
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex;

//	Input
class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { tokens = readln.split; if (stdin.eof) throw new EOFException; } auto token = tokens[0]; tokens.popFront; return token; }
int readInt() { return to!int(readToken); }
long readLong() { return to!long(readToken); }
real readReal() { return to!real(readToken); }

//	chmin/chmax
void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

//	Pair
struct Pair(S, T) {
	S x; T y;
	int opCmp(    const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }
	int opCmp(ref const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }
	string toString() const { return "(" ~ to!string(x) ~ ", " ~ to!string(y) ~ ")"; }
}
auto pair(S, T)(inout(S) x, inout(T) y) { return Pair!(S, T)(x, y); }

//	Array
int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = as.length; for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <  val); }); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <= val); }); }
T[] unique(T)(in T[] as) { T[] bs; foreach (a; as) if (bs.empty || bs[$ - 1] != a) bs ~= a; return bs; }

immutable long MO = 1_000_000_007;

void main(string[] args) {
	try {
	for (; ; ) {
		long a = readLong;
		long b = readLong;

		long ans = 1;
		(ans *= a) %= MO;
		(ans *= (-1 + b)) %= MO;
		(ans *= b) %= MO;
		(ans *= ((2 + b + a * b) % MO)) %= MO;
		for (; ans % 4 != 0; ans += MO) {}
		ans /= 4;

		ans = (ans % MO + MO) % MO;
		writeln(ans);
	}
	} catch (EOFException) {}
}


import std.stdio, std.string, std.conv, std.algorithm, std.numeric;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

void main() {
    int n;
    scan(n);

    while (n--) {
        int x;
        scan(x);
        writeln(judge(x) ? "YES" : "NO");
    }
}

bool judge(int x) {
    foreach (i ; 0 .. 100) {
        int d = x - 3*i;
        if (d >= 0 && d % 7 == 0) {
            return true;
        }
    }

    return false;
}

void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional, std.meta;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.ascii, std.typecons;

void main()
{
    int n, m;
    readf("%s %s", &n, &m);
    readln;

    auto arr = readln.chomp.split.map!(to!int).array;

    auto rbt = make!(RedBlackTree!(int, "a < b", true));
    int s = 0;
    int minans = 0;
    int[] res;
    foreach (e; arr) {
        int curans = minans;
        int curs = s;
        foreach_reverse (big; rbt) {
            if (curs + e <= m) { break; }

            curs -= big;
            curans += 1;
        }

        rbt.insert(e);
        s += e;

        while (s > m) {
            s -= rbt.back;
            rbt.removeBack();
            minans += 1;
        }

        res ~= curans;
    }

    res.map!(to!string).join(" ").writeln;
}


import core.thread;
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex;

//	Input
class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { tokens = readln.split; if (stdin.eof) throw new EOFException; } auto token = tokens[0]; tokens.popFront; return token; }
int readInt() { return to!int(readToken); }
long readLong() { return to!long(readToken); }
real readReal() { return to!real(readToken); }

//	chmin/chmax
void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

//	Pair
struct Pair(S, T) {
	S x; T y;
	int opCmp(    const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }
	int opCmp(ref const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }
	string toString() const { return "(" ~ to!string(x) ~ ", " ~ to!string(y) ~ ")"; }
}
auto pair(S, T)(inout(S) x, inout(T) y) { return Pair!(S, T)(x, y); }

//	Array
int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = as.length; for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <  val); }); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <= val); }); }
T[] unique(T)(in T[] as) { T[] bs; foreach (a; as) if (bs.empty || bs[$ - 1] != a) bs ~= a; return bs; }

int N, K;
int[] A;

void main(string[] args) {
	try {
	for (; ; ) {
		N = readInt;
		K = readInt;
		A = new int[N];
		foreach (i; 0 .. N) {
			A[i] = readInt;
		}

		auto ps = new Pair!(int, int)[N];
		foreach (i; 0 .. N) {
			ps[i] = pair(A[i], i);
		}
		ps.sort();

		int k = K;
		int[] ans;
		foreach (p; ps) {
			const i = p.y;
			if (k >= A[i]) {
				k -= A[i];
				ans ~= i + 1;
			}
		}

		writeln(ans.length);
		writeln(ans.to!string.removechars("[],"));

	}
	} catch (EOFException) {}
}


module main;
__gshared:
import std.bigint, std.container, std.array, std.algorithm, std.conv,
	std.parallelism, std.functional, std.math, std.string, std.range,
	std.complex, std.bitmanip, std.typecons, std.regex, std.random, std.uni,
	std.traits, std.stdio, std.variant, core.bitop, std.meta, std.datetime,
	core.stdc.stdio : freopen;
import std.numeric : fft, Fft, gcd, inverseFft;

alias big = BigInt;
alias pair(X, Y) = Tuple!(X, "fi", Y, "se");
alias mp = make_pair;
alias pii = pair!(int, int);
alias pll = pair!(long, long);
alias gcd = std.numeric.gcd;
alias lint = long;
alias rbt = RedBlackTree;
///modulo
public const int mod = 10 ^^ 9 + 7;
public
{
	pure nothrow
	{
		///lcm
		T lcm(T)(auto ref T a, auto ref T b)
		{
			return a / gcd(a, b) * b;
		}
		///make_pair
		pair!(X, Y) make_pair(X, Y)(in X x_, in Y y_)
		{
			return tuple!(X, "fi", Y, "se")(x_, y_);
		}
		///big greatest common divizor
		big gcd(big a, big b)
		{
			while (b)
			{
				a %= b;
				swap(a, b);
			}
			return a;
		}
		///square
		@property X sqr(X)(in X a_)
		{
			return a_ * a_;
		}
		///cube
		@property X cub(X)(in X a_)
		{
			return a_ * a_ * a_;
		}
		///integer size
		int sz(T)(T a) if (hasLength!T)
		{
			return cast(int) a.length;
		}
		///posicion lower bound
		size_t lowb(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			size_t l = 0, r = a.length;
			while (r - l > 1)
			{
				auto m = (l + r) >> 1;
				if (!(a[m] < g))
					r = m;
				else
					l = m;
			}
			return (!(a[l] < g)) ? l : r;
		}
		///posicion upper bound
		size_t upb(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			size_t l = 0, r = a.length;
			while (r - l > 1)
			{
				auto m = (l + r) >> 1;
				if (g < a[m])
					r = m;
				else
					l = m;
			}
			return (g < a[l]) ? l : r;
		}
		///posicion binary search
		size_t binf(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			auto pos = lowb(a, g);
			return (g == a[pos]) ? pos : a.length;
		}
		///binary search
		bool binary_search(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			return binf(a, g) != a.length;
		}
	}
	///write an array
	void putarr(X)(in X a, in char ch = ' ')
			if (isInputRange!X && !isInputRange!(ElementEncodingType!X))
	{
		foreach (const ref i; a)
			write(i, ch);
	}
	///write a matrix
	void putarr(X)(in X a)
			if (isInputRange!X && isInputRange!(ElementEncodingType!X))
	{
		foreach (ref const i; a)
		{
			foreach (ref const j; i)
				write(j, ' ');
			writeln;
		}
	}
	///get an array
	bool getarr(X)(X a, in size_t n)
	{
		bool b = 1;
		foreach (ref i; a[0 .. n])
			b = input(&i);
		return b;
	}
	///read without format
	bool input(T...)(ref T ptrs) if (ptrs.length > 0)
	{
		size_t s = 0;
		foreach (ref e; ptrs)
		{
			if (isSomeChar!(Unqual!(typeof(e))))
				s += readf(" %c", &e);
			else
				s += readf(" %s", &e);
		}
		return s == ptrs.length;
	}
	///readln without format
	bool read(T...)(ref T ptrs) if (ptrs.length > 0)
	{
		size_t s = 0;
		foreach (ref e; ptrs)
		{
			if (isSomeChar!(Unqual!(typeof(e))))
				s += readf(" %c", &e);
			else
				s += readf(" %s", &e);
		}
		readln;
		return s == ptrs.length;
	}
	///opening file
	nothrow auto inf(in char* name)
	{
		return freopen(name, "r", core.stdc.stdio.stdin);
	}
	///closing file
	nothrow auto ouf(in char* name)
	{
		return freopen(name, "w", core.stdc.stdio.stdout);
	}
	///parsing array from line
	@property auto arread(T)()
	{
		return readln.splitter.map!(to!(T)).array;
	}
	///outbuffer
	void enter(T...)(T args)
	{
		writeln(args);
		stdout.flush;
	}
}
//foreach_reverse isAlpha isNumber isWhite isLower isUpper toLower toUpper mixin
//cumulativeFold return static heapify join filter foreach
//compilation ldc2 -d-debug -d-version=home main.d
//------------------------------------------program beginning--------------------------
public
{

}
void main()
{
	version (home)
	{
		freopen("input.txt", "r", core.stdc.stdio.stdin);
		//assert(freopen("output.txt", "w", core.stdc.stdio.stdout));
		StopWatch sw;
		sw.start;
		scope (exit)
		{
			sw.stop;
			stderr.writefln("\nTime: %d ms", sw.peek.msecs);
		}
	}
	lint n, s;
	loop: while (read(n, s))
	{
		long l=1,r=n+1;
		lint check(lint k)
		{
			lint x,d=k;
			while(d>0)
			{
				x+=d%10;
				d/=10;
			}
			return k-x;
		}
		while(r-l>0)
		{
			long m=(l+r)/2;
			if(check(m)<s)l=m+1;
			else r=m;
		}
		writeln(n-l+1);
	}

}


import std.stdio, std.string, std.container, std.conv, std.numeric, std.range;
import std.array, std.bigint, std.algorithm, std.math, std.typecons, std.random;

void main() {

	byte n;
	long k;

	readf(" %s %s", &n, &k);
	--k;

	k <<= 1;
	int[] a, b;

	foreach_reverse (i; 0 .. n)
		if ((k >> i) % 2L)
			b ~= n - i;
		else
			a ~= n - i;

	writefln("%(%s %)", a ~ b.reverse);
}


import std.stdio;
import std.uni;
import std.conv;
import std.container;
import std.functional;
import std.algorithm;
import std.array;
import std.typecons;

void main(string[] args)
{
  inputFile = stdin;
  debug inputFile = File(args[1]);
  auto n = next!int;
  auto k = next!long;
  auto s = next!string;
  auto uniqsubs = new long[][](n + 1, n);
  auto uniqsubsacc = new long[][](n + 1, n);
  void calcacc(int size)
  {
    uniqsubsacc[size][0] = uniqsubs[size][0];
    foreach(i; 1 .. n)
      uniqsubsacc[size][i] = uniqsubsacc[size][i - 1] + uniqsubs[size][i];
  }
  auto getacc(int size, int i)
  {
    if (i < 0)
      return 0;
    if (i >= n)
      return uniqsubsacc[size][$ - 1];
    return uniqsubsacc[size][i];
  }
  uniqsubs[0][0] = 1;
  uniqsubs[0][1 .. $] = 0;
  calcacc(0);
  bool[char] seen;
  foreach(i; 0 .. n)
    {
      uniqsubs[1][i] = s[i] !in seen;
      seen[s[i]] = true;
    }
  calcacc(1);
  foreach(size; 2 .. n + 1)
    {
      int[char] lastpos;
      foreach(i; 0 .. n)
        {
          if (s[i] in lastpos)
            uniqsubs[size][i] = getacc(size - 1, i - 1) - getacc(size - 1, lastpos[s[i]] - 1);
          else
            uniqsubs[size][i] = getacc(size - 1, i - 1);
          lastpos[s[i]] = i;
        }
      calcacc(size);
    }
  auto totalcost = long(0);
  foreach_reverse(size; 0 .. n + 1)
    {
      if (k == 0)
        break;
      debug uniqsubsacc[size].writeln;
      auto toremove = min(k, uniqsubsacc[size][$ - 1]);
      totalcost += toremove * (n - size);
      k -= toremove;
    }
  if (k > 0)
    {
      writeln(-1);
    }
  else
    {
      writeln(totalcost);
    }
}

// INPUT

enum InputStyle
  {
    byChunk, byLine
  };
enum inputStyle = InputStyle.byLine;

File inputFile;
string popWord();
static if (inputStyle == InputStyle.byChunk)
  {
    const chunkSize = 1024 * 1024 * 8;
    const wordSize = 4096;
    char[chunkSize] chunkBuff;
    char[] currChunk;
    void renewChunk()
    {
      if (inputFile.eof)
        currChunk = null;
      else
        currChunk = inputFile.rawRead(chunkBuff);
    }
    char[wordSize] wordBuff;
    char[] word;
    string popWord()
    {
      if (currChunk.length == 0)
        renewChunk;
      assert(currChunk.length > 0);
      while (currChunk[0].isWhite)
        {

          currChunk = currChunk[1 .. $];
          if (currChunk.length == 0)
            renewChunk;
        }
      word = wordBuff[0 .. 0];
      while (!currChunk[0].isWhite)
        {
          word.length++;
          word[$ - 1] = currChunk[0];
          currChunk = currChunk[1 .. $];
          if (currChunk.length == 0)
            {
              renewChunk;
              if (currChunk.length == 0)
                return cast(string) word;
            }
        }
      return cast(string) word;
    }
  }
 else
   {
     DList!string _words;
     string popWord()
     {
       while (_words.empty)
         {
           foreach(w; inputFile.readln.split)
             {
               _words.insertBack(w);
             }
         }
       auto word = _words.front;
       _words.removeFront;
       return word;
     }
   }
T next(T)()
{
  return to!T(popWord);
}
auto next(T, S...)(S s)
{
  static if (S.length == 0)
    {
      return to!T(popWord);
    }
  else
    {
      auto res = new typeof(next!T(s[1 .. $]))[](cast(size_t)s[0]);
      foreach(ref elem; res)
        elem = next!T(s[1 .. $]);
      return res;
    }
}


import std.stdio, std.string, core.stdc.stdio, std.math, std.range, std.algorithm;

int main(string[] argv)
{
    int n;
    scanf("%d", &n);

    foreach (int i; 1000..10000)
    {
        int d1 = (i / 1000) % 10;
        int d2 = (i / 100) % 10;
        int d3 = (i / 10) % 10;
        int d4 = (i % 10);
        if (!(d1 != d2 && d1 != d3 && d1 != d4 && d2 != d3 && d2 != d4 && d3 != d4))
            continue;

        if (i > n)
        {
            writeln(i);
            break;
        }
    }
    return 0;
}


import core.bitop, std.bitmanip;
import std.algorithm, std.functional;
import std.array, std.container;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.typecons;

immutable int INF = 10L ^^ 9 + 23;

void main()
{
    int le, r, x, y;
    readf("%s %s %s %s", &le, &r, &x, &y);
    readln;

    if (y % x != 0) {
        writeln(0);
        return;
    }

    int g = y / x;

    int[] dvs;
    int k = 2;
    while (g > 1 && k <= g / k) {
        while (g % k == 0) {
            dvs ~= k;
            g /= k;
        }
        k += 1;
    }
    if (g > 1) dvs ~= g;

    int mx = 1 << dvs.length;
    bool[int] chckd;
    int ans = 0;
    for (int i = 0; i < mx; ++i) {
        int a = x, b = x;
        for (int j = 0; j < dvs.length; ++j) {
            if (i & (1 << j)) {
                a *= dvs[j];
            } else {
                b *= dvs[j];
            }
        }

        if (chckd.get(a, false)) continue;
        if (a < le || a > r) continue;
        if (b < le || b > r) continue;
        if (gcd(a, b) != x) continue;

        ++ans;
        chckd[a] = true;
        debug { writeln(a, ' ', b); }
    }

    ans.writeln;
}


import std.stdio;
import std.range;
import std.array;
import std.string;
import std.conv;
import std.typecons;
import std.algorithm;
import std.container;
import std.typecons;
import std.random;
import std.csv;
import std.regex;
import std.math;
import core.time;
import std.ascii;
import std.digest.sha;
import std.outbuffer;

void main() {
	int n = readln.chomp.to!int;
	writeln = (n + 2) / 2;
}


import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0;
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	int n = rint;

	bool[int] ans;
	int i = 1;
	while(i < n * 2 + 10){
		ans[i] = 1, ans[i + 1] = 1;
		if(i % 2) i = (i + 1) * 2;
		else i = i * 2 + 1;
	}
	log("ans:", ans.keys);

	if(n in ans) 1.writeln;
	else 0.writeln;

}


import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main(){
    auto s = readln.split.map!(to!int);
    auto N = s[0];
    auto M = s[1];

    if (M == 0) {
        writeln(1);
        return;
    } else if (M == N) {
        writeln(0);
        return;
    }

    auto used = new bool[](N);
    used[] = true;

    for (int i = 0; M > 0 && i < N; i += 2, M -= 1) {
        used[i] = false;
    }
     for (int i = 1; M > 0 && i < N; i += 2, M -= 1) {
        used[i] = false;
    }

    int ans = 0;
    foreach (i; 0..N) if (used[i] && !used[(i+1)%N]) ans += 1;
    ans.writeln;
}


import core.thread;
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.container, std.math, std.range, std.regex;

//	Input
class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { tokens = readln.split; if (stdin.eof) throw new EOFException; } auto token = tokens[0]; tokens.popFront; return token; }
int readInt() { return to!int(readToken); }
long readLong() { return to!long(readToken); }
real readReal() { return to!real(readToken); }

//	chmin/chmax
void chmin(T)(ref T t, in T f) { if (t > f) t = f; }
void chmax(T)(ref T t, in T f) { if (t < f) t = f; }

//	Pair
struct Pair(S, T) {
	S x; T y;
	int opCmp(    const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }
	int opCmp(ref const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }
	string toString() const { return "(" ~ to!string(x) ~ ", " ~ to!string(y) ~ ")"; }
}
auto pair(S, T)(inout(S) x, inout(T) y) { return Pair!(S, T)(x, y); }

//	Array
int binarySearch(T)(in T[] as, in bool delegate(T) test) { int low = -1, upp = as.length; for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <  val); }); }
int upperBound(T)(in T[] as, in T val) { return as.binarySearch((T a) { return (a <= val); }); }
T[] unique(T)(in T[] as) { T[] bs; foreach (a; as) if (bs.empty || bs[$ - 1] != a) bs ~= a; return bs; }

int N;
string A;

void main(string[] args) {
	try {
	for (; ; ) {
		N = readInt;
		A = readToken;

		int ans = N;
		foreach (i, c; A) {
			if (c == '0') {
				ans = i + 1;
				break;
			}
		}
		writeln(ans);
	}
	} catch (EOFException) {}
}


import std.conv, std.functional, std.range, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.bitmanip, std.complex, std.container, std.math, std.mathspecial, std.numeric, std.regex, std.typecons;
import core.bitop;

class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { if (stdin.eof) { throw new EOFException; } tokens = readln.split; } auto token = tokens.front; tokens.popFront; return token; }
int readInt() { return readToken.to!int; }
long readLong() { return readToken.to!long; }
real readReal() { return readToken.to!real; }

bool chmin(T)(ref T t, in T f) { if (t > f) { t = f; return true; } else { return false; } }
bool chmax(T)(ref T t, in T f) { if (t < f) { t = f; return true; } else { return false; } }

int binarySearch(alias pred, T)(in T[] as) { int lo = -1, hi = cast(int)(as.length); for (; lo + 1 < hi; ) { const mid = (lo + hi) >> 1; (unaryFun!pred(as[mid]) ? hi : lo) = mid; } return hi; }
int lowerBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a >= val)); }
int upperBound(T)(in T[] as, T val) { return as.binarySearch!(a => (a > val)); }

void main() {
  try {
    for (; ; ) {
      auto X = new long[3];
      auto Y = new long[3];
      foreach (i; 0 .. 3) {
        X[i] = readLong();
        Y[i] = readLong();
      }

      bool ans = true;
      ans = ans && ((X[1] - X[0])^^2 + (Y[1] - Y[0])^^2 == (X[2] - X[1])^^2 + (Y[2] - Y[1])^^2);
      ans = ans && !(X[0] + X[2] == 2 * X[1] && Y[0] + Y[2] == 2 * Y[1]);
      writeln(ans ? "Yes" : "No");
    }
  } catch (EOFException e) {
  }
}


module _template;
import std.stdio;
import std.string;
import std.algorithm;
import std.container;
import std.range;
import std.math;
import std.numeric;
import std.conv;
import std.typecons;
import std.format;

struct IO {
        string[] tk;
        string readString() {
                while (tk.empty)
                        tk = readln.split;
                auto tkt = tk.front;
                tk.popFront;
                return tkt;
        }
        int readInt() {
                return readString.to!int;
        }
        double readDouble() {
                return readString.to!double;
        }
}

void main() {
        IO cin;
        int t = 1;
        // t = cin.readInt;
        while (t--) {
                auto s = readln();
                int n = s.parse!int;
                string s1 = s.strip;
                if (s1 == "of week") {
                        if (n == 5 || n == 6) writeln(53);
                        else writeln(52);
                        return;
                }
                if (s1 == "of month") {
                        if (n >= 1 && n <= 29) writeln(12);
                        else if (n == 30) writeln(11);
                        else writeln(7);
                }
        }
}


import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.string;

void main() {
    auto N = readln.chomp.to!int;
    auto S = readln.chomp;

    int calc(int x, int y) {
        return min(abs(x - y), 26 - abs(x - y));
    }

    string ACTG = "ACTG";
    int ans = 1 << 29;

    foreach (i; 0..N-3) {
        ans = min(ans, 4.iota.map!(j => calc(S[i+j].to!int, ACTG[j].to!int)).sum);
    }

    ans.writeln;
}


//ahmat
import core.stdc.stdio:scanf,printf,puts;
import core.bitop;
import std.stdio;
import std.string;
import std.algorithm;
import std.functional;
import std.array;
import std.container;
import std.conv;
import std.container;
import std.typecons;
import std.math;
import std.numeric;
pragma(inline,true);

enum x=1234567,y=123456,z=1234;
void main(){
    int n=readln.chomp.to!int;
    for(int a=0;a<=n;a+=x){
        for(int b=0;b<=n-a;b+=y){
            if((n-a-b)%z==0){
                writeln("YES");
                return;
            }
        }
    }
    writeln("NO");
}


import std.stdio, std.string;
import std.regex;

immutable pat = "^(14{0,2})+$";

void main() {
    string s = stdin.readln.chomp;
    writeln(s.match(pat).empty ? "NO" : "YES");
}


import core.thread;
import std.conv, std.stdio, std.string;
import std.algorithm, std.array, std.bigint, std.math, std.range;

//	Input
class EOFException : Throwable { this() { super("EOF"); } }
string[] tokens;
string readToken() { for (; tokens.empty; ) { tokens = readln.split; if (stdin.eof) throw new EOFException; } auto token = tokens[0]; tokens.popFront; return token; }
int readInt() { return to!int(readToken); }
long readLong() { return to!long(readToken); }
real readReal() { return to!real(readToken); }

//	chmin/chmax
void chmin(T)(ref T t, const T f) { if (t > f) t = f; }
void chmax(T)(ref T t, const T f) { if (t < f) t = f; }

//	Pair
struct Pair(S, T) {
	S x; T y;
	int opCmp(ref const Pair p) const { return (x < p.x) ? -1 : (x > p.x) ? +1 : (y < p.y) ? -1 : (y > p.y) ? +1 : 0; }
	string toString() const { return "(" ~ to!string(x) ~ ", " ~ to!string(y) ~ ")"; }
}
auto pair(S, T)(S x, T y) { return Pair!(S, T)(x, y); }

//	Array
int binarySearch(T)(T[] as, bool delegate(T) test) { int low = -1, upp = as.length; for (; low + 1 < upp; ) { int mid = (low + upp) >> 1; (test(as[mid]) ? low : upp) = mid; } return upp; }
int lowerBound(T)(T[] as, T val) { return as.binarySearch((T a) { return (a <  val); }); }
int upperBound(T)(T[] as, T val) { return as.binarySearch((T a) { return (a <= val); }); }
T[] unique(T)(T[] as) { T[] bs; foreach (a; as) if (bs.empty || bs[$ - 1] != a) bs ~= a; return bs; }

immutable long MO = 1_000_000_007;

struct Mint {
	long v;
	this(long v = 0) {
		if ((this.v = v % MO) < 0) this.v += MO;
	}
	Mint opUnary(string op)() {
		static if (op == "-" || op == "+") {
			return mixin(op ~ "v");
		} else static if (op == "++" || op == "--") {
			return this = mixin(op ~ "v");
		}
	}
	Mint opBinary(string op)(const Mint a) const {
		static if (op == "+" || op == "-" || op == "*") {
			return Mint(mixin("v" ~ op ~ "a.v"));
		} else static if (op == "/") {
			assert(a.v != 0);
			return this * a ^^ (MO - 2);
		}
	}
	Mint opBinary(string op)(long a) const {
		static if (op == "^^") {
			Mint ret = 1, x = this;
			for (; a; a >>= 1, x *= x) if (a & 1) ret *= x;
			return ret;
		} else {
			return mixin("this" ~ op ~ "Mint(a)");
		}
	}
	Mint opAssign(long v) {
		return this = Mint(v);
	}
	Mint opOpAssign(string op)(const Mint a) {
		static if (op == "+" || op == "-" || op == "*" || op == "/") {
			return this = mixin("this" ~ op ~ "a");
		}
	}
	Mint opOpAssign(string op)(long a) {
		return this = mixin("this" ~ op ~ "a");
	}
	string toString() const {
		return v.to!string;
	}
	unittest {
		Mint a = -1;
		assert(a.v == MO - 1);
		++a;
		assert(a.v == 0);
		--a;
		assert(a.v == MO - 1);
		Mint b = 1_000_000_000;
		b += 1_000_000_000;
		assert(b.v == 2_000_000_000 % MO);
		b = 2;
		b -= 4;
		assert(b.v == MO - 2);
		b = 1_000_000_000;
		b *= 1_000_000_000;
		assert(b.v == 1_000_000_000_000_000_000 % MO);
		Mint c = -10;
		c /= 14;
		c *= 7;
		assert(c.v == MO - 5);
	}
}

immutable LIM = 25;
long[] inv;

int N;
long S;
long[] F;

void main(string[] args) {
	inv = new long[LIM];
	inv[1] = 1;
	foreach (i; 2 .. LIM) {
		inv[i] = MO - MO / i * inv[MO % i] % MO;
	}

	try {
	for (; ; ) {
		N = readInt;
		S = readLong;
		F = new long[N];
		foreach (i; 0 .. N) {
			F[i] = readLong;
		}
		Mint ans;
		foreach (h; 0 .. 1 << N) {
			Mint sig = +1;
			foreach (i; 0 .. N) if (h & 1 << i) {
				sig *= -1;
			}
			long s = S;
			foreach (i; 0 .. N) if (h & 1 << i) {
				s -= (F[i] + 1);
			}
			if (s >= 0) {
				//	H(N, s) = C(N + s - 1, s) = C(N + s - 1, N - 1)
				Mint tmp = 1;
				foreach (k; 0 .. N - 1) {
					tmp *= (N + s - 1 - k);
					// tmp /= (1 + k);
					tmp *= inv[1 + k];
				}
// writeln(s," : ",tmp);
				ans += sig * tmp;
			}
		}
		writeln(ans);
	}
	} catch (EOFException) {}
}


import std.stdio;
void main () {
	long p, k, d = 0, y = 1, r = 1;
	readf (" %s %s", &p, &k);
	long res = 1;
	if (k == 0) d = p - 1;
	else {
		do y = (y * 1L * k) % p, d++; while (y > 1);
		d = p / d;
	}
	foreach (i; 0..d) r = (r * p) % 1_000_000_007;
	r.writeln;
}


import std.stdio, std.conv, std.string, std.array, std.range, std.algorithm, std.container;
import std.math, std.random, std.bigint, std.datetime, std.format;
void main(string[] args){ if(args.length > 1) if(args[1] == "-debug") DEBUG = 1; solve(); }
void log()(){ writeln(""); } void log(T, A ...)(T t, lazy A a){ if(DEBUG) write(t, " "), log(a); } bool DEBUG = 0;
string rstring(){ static string[] ss; while(!ss.length) ss = readln.chomp.split; string res = ss[0]; ss.popFront; return res; }
T rtype(T)(){ return rstring.to!T; } alias rint = rtype!int, rlong = rtype!long, rreal = rtype!real;
T[] rtypes(T)(int n){ return n.iota.map!(i => rtype!T()).array; } alias rint = rtypes!int, rlong = rtypes!long, rreal = rtypes!real;
T[][] rtypess(T)(int n, int m){ return n.iota.map!(i => rtypes!T(m)).array; } alias rint = rtypess!int, rlong = rtypess!long, rreal = rtypess!real;
T chmin(T)(ref T x, T y){ if(x > y) x = y; return x; } T chmax(T)(ref T x, T y){ if(x < y) x = y; return x; }

// ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- //

void solve(){
	long x = rlong;
	long a, b;
	for(long d = 1; d * d <= x; d ++){
		if(x % d) continue;
		if(gcd(d, x / d) > 1) continue;
		a = d, b = x / d;
	}
	writeln(a, " ", b);
}

long gcd(long a, long b){
	if(a < 0) a = -a;
	if(b == 0) return a;
	if(b < 0) return gcd(a, -b);
	if(a % b == 0) return b;
	if(a < b) return gcd(b, a);
	else return gcd(b, a % b);
}


//ahmat
import core.stdc.stdio:scanf,printf,puts;
import core.bitop;
import std.stdio;
import std.string;
import std.algorithm;
import std.functional;
import std.array;
import std.container;
import std.conv;
import std.container;
import std.typecons;
import std.math;
import std.numeric;
pragma(inline,true);

void main(){
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    writeln(7*min(a,b/2,c/4));
}


import std.stdio;

class Input
{
static:
  import std.container: DList, make;
  DList!string words;
  T next(alias T)()
  {
    import std.conv: to;
    import std.string: split;
    while (words.empty)
      {
        string line = stdin.readln;
        foreach(word; line.split)
          words.insertFront(word);
      }
    string nextWord = words.back;
    words.removeBack;
    return to!T(nextWord);
  }
  void read(Args...)(ref Args args)
  {
    static foreach(i, arg; args)
      arg = next!(Args[i])();
  }
}

struct Interval(string type)
{
  long lowerBound, higherBound;
  bool empty()
  {
    static if (type == "[]")
      return !(lowerBound <= higherBound);
    else
      static assert(false);
  }
}

Interval!type intersect(string type)(Interval!type a, Interval!type b)
{
  import std.algorithm: min, max;
  return Interval!type(max(a.lowerBound, b.lowerBound),
                       min(a.higherBound, b.higherBound));
}

auto intersect(IntervalRange1, IntervalRange2)(IntervalRange1 a, IntervalRange2 b)
  if (isInputRange!IntervalRange1 && isInputRange!IntervalRange2)
{
  import std.algorithm.setops: cartesianProduct;
  import std.algorithm: map, filter;

  return cartesianProduct(a.filter!(i=>!i.empty), b.filter!(i=>!i.empty))
    .map!(t => intersect(t[0], t[1]))
    .filter!(i => !i.empty)();
}

import std.range.primitives: isInputRange;
auto simplifyIntervals(IntervalRange)(IntervalRange range)
  if (isInputRange!IntervalRange)
    {
      struct Event
      {
        long position;
        int type;
      }
      auto less = (Event e1, Event e2)
        {
         if (e1.position < e2.position)
           return true;
         if (e1.position > e2.position)
           return false;
         return e1.type > e2.type;
        };
      import std.algorithm: sort;
      import std.array: appender;

      long[long] events;
      foreach(interval; range)
        {
          events[interval.lowerBound]++;
          events[interval.higherBound + 1]--;
        }
      long start = int.min;
      long cnt = 0;
      auto result = appender!(Interval!"[]"[])();
      result.reserve(range.length);
      foreach(position; sort(events.keys()))
        {
          auto delta = events[position];
          import std.conv;
          assert(cnt >= 0, text("Failed with range ", range, " with events ", events));
          if (cnt == 0)
            {
              cnt += delta;
              start = position;
            }
          else
            {
              cnt += delta;
              if (cnt == 0)
                result.put(Interval!"[]"(start, position - 1));
            }
        }
      return result[];
    }
int main()
{
  long t;
  Input.read(t);
 testCase:while(t--)
    {
      import std.algorithm: min;
      long n, k, l;
      Input.read(n, k, l);
      long mod = 2 * k;
      auto d = new long[cast(size_t)n];
      foreach(ref di; d)
        Input.read(di);
      auto sealimit = new long[cast(size_t)n];
      foreach(i, di; d)
        {
          long maxsea = l - di;
          if (maxsea < 0)
            {
              writeln("No");
              continue testCase;
            }
          if (maxsea < k)
            sealimit[i] = maxsea;
          else
            sealimit[i] = -1;
        }

      Interval!"[]"[] activeIntervals = [Interval!"[]"(0, 2 * k - 1)];
      foreach(i, limit; sealimit)
        {
          import std.array: appender;
          auto newActive = appender!(Interval!"[]"[])();
          foreach(ref interval; activeIntervals) with(interval)
            {
              assert(!interval.empty);
              lowerBound++;
              lowerBound %= 2 * k;
              higherBound++;
              higherBound %= 2 * k;
              if (lowerBound > higherBound)
                {
                  newActive.put(Interval!"[]"(lowerBound, 2 * k - 1));
                  newActive.put(Interval!"[]"(0, higherBound));
                }
              else
                {
                  newActive.put(interval);
                }
            }
          activeIntervals = simplifyIntervals(newActive[]);
          if (limit == -1)
            {
              activeIntervals = [Interval!"[]"(0, 2 * k - 1)];
              continue;
            }
          import std.array: array;
          activeIntervals = intersect([Interval!"[]"(0, limit), Interval!"[]"(2 * k - limit, 2 * k - 1)], activeIntervals).array;
          if (activeIntervals.length == 0)
            {
              writeln("No");
              continue testCase;
            }
        }
      long totalLength = 0;
      import std.algorithm: max;
      foreach(interval; activeIntervals)
        totalLength += max(0, interval.higherBound - interval.lowerBound + 1);
      if (totalLength > 0)
        writeln("Yes");
      else
        writeln("No");
    }
  return 0;
}


import core.bitop, std.bitmanip;
import core.checkedint;
import std.algorithm, std.functional, std.meta;
import std.array, std.container;
import std.bigint;
import std.conv;
import std.math, std.numeric;
import std.range, std.range.interfaces;
import std.stdio, std.string;
import std.ascii, std.typecons;

void main()
{
    immutable int MD = 10 ^^ 9 + 7;

    auto s = readln.chomp;

    auto t = readln.chomp;

    auto ps = new int[] (t.length + 2);
    ps[0] = 0;
    ps[t.length + 1] = s.length.to!int + 1;
    int j = 0;
    foreach (i, e; s) {
        if (j >= t.length) { break; }

        if (e == t[j]) {
            ps[j+1] = i.to!int + 1;
            ++j;
        }
    }

    auto sf = new int[] (t.length + 2);
    sf[0] = 0;
    sf[t.length+1] = s.length.to!int + 1;
    j = t.length.to!int - 1;
    foreach_reverse (i, e; s) {
        if (j < 0) { break; }

        if (e == t[j]) {
            sf[j+1] = i.to!int + 1;
            --j;
        }
    }

    debug { ps.writeln; sf.writeln; }

    int ans = 0;
    foreach (i; 0 .. t.length + 1) {
        ans = max(ans, sf[i+1] - ps[i] - 1);
    }

    ans.writeln;
}


module _template;
import std.stdio;
import std.string;
import std.algorithm;
import std.container;
import std.range;
import std.math;
import std.numeric;
import std.conv;
import std.typecons;
import std.format;

struct IO {
        string[] tk;
        string readString() {
                while (tk.empty)
                        tk = readln.split;
                auto tkt = tk.front;
                tk.popFront;
                return tkt;
        }
        int readInt() {
                return readString.to!int;
        }
        double readDouble() {
                return readString.to!double;
        }
}

void main() {
        IO cin;
        int t = 1;
        // t = cin.readInt;
        while (t--) {
                int scoreW = 0;
                int scoreB = 0;
                for (int i = 0; i < 8; i++) {
                        string s = cin.readString;
                        for (int j = 0; j < 8; j++) {
                                if (s[j] == 'Q') scoreW += 9;
                                if (s[j] == 'q') scoreB += 9;
                                if (s[j] == 'R') scoreW += 5;
                                if (s[j] == 'r') scoreB += 5;
                                if (s[j] == 'B') scoreW += 3;
                                if (s[j] == 'b') scoreB += 3;
                                if (s[j] == 'N') scoreW += 3;
                                if (s[j] == 'n') scoreB += 3;
                                if (s[j] == 'P') scoreW += 1;
                                if (s[j] == 'p') scoreB += 1;
                        }
                }
                if (scoreW > scoreB) writeln("White");
                else if (scoreB > scoreW) writeln("Black");
                else writeln("Draw");

        }
}


import core.stdc.stdio;
import core.stdc.stdlib;
import std.algorithm.comparison;
import std.algorithm.sorting;
import std.algorithm.mutation;
import std.stdio;

int[200010] b;
int[200010] b1;
int[200010] b2;
int[200010] b3;

extern(C) int comp(scope const void* a, scope const void* b) {
  return *cast(const int*)a - *cast(const int*)b;
}

int main()
{

  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 0; i < n; i++) {
    scanf("%d", &b[i]);
  }
  readln();
  string c = readln();

  int n1 = 0, n2 = 0, n3 = 0;
  for (int i = 0; i < n; i++) {
	  if (c[i] == 'W') {
		  b1[n1++] = b[i];
	  }
	  if (c[i] == 'R') {
		  b2[n2++] = b[i];
	  }
	  if (c[i] == 'O') {
		  b3[n3++] = b[i];
	  }
  }
  qsort(b1.ptr, n1, b1[0].sizeof, &comp);
  qsort(b2.ptr, n2, b2[0].sizeof, &comp);
  qsort(b3.ptr, n3, b3[0].sizeof, &comp);
  for (int i = 0; i < n1 / 2; i++) {
    int t = b1[i];
    b1[i] = b1[n1 - i - 1];
    b1[n1 - i - 1] = t;
  }
  for (int i = 0; i < n2 / 2; i++) {
    int t = b2[i];
    b2[i] = b2[n2 - i - 1];
    b2[n2 - i - 1] = t;
  }
  for (int i = 0; i < n3 / 2; i++) {
    int t = b3[i];
    b3[i] = b3[n3 - i - 1];
    b3[n3 - i - 1] = t;
  }
  for (int i = 1; i < n1; i++) {
	  b1[i] += b1[i - 1];
  }
  for (int i = 1; i < n2; i++) {
	  b2[i] += b2[i - 1];
  }
  for (int i = 1; i < n3; i++) {
	  b3[i] += b3[i - 1];
  }
  int maxc = -1;
  for (int i = 1; i <= min(n3, k - 1); i++) {
    if (k - i <= n1) {
      maxc = max(maxc, b3[i - 1] + b1[k - i - 1]);
    }
    if (k - i <= n2) {
      maxc = max(maxc, b3[i - 1] + b2[k - i - 1]);
    }
  }
  printf("%d\n", maxc);
  return 0;
}


import std.stdio;
import std.algorithm;
import std.ascii;
import std.conv;
import std.string : strip;

auto swapCase(dchar chr)
{
    return isUpper(chr) ? toLower(chr) : toUpper(chr);
}

void main()
{
    string str = readln.strip;

    if (str[1..$].all!(a => isUpper(a)))
    {
        str.map!(a => swapCase(a)).writeln;
    }
    else
        str.writeln;
}


import std.math;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;
import std.container;
import std.algorithm;

void main()
{
    long a, b;
    readf("%d %d\n", &a, &b);
    long sol(long x, long y) {
        long ans = (x + y + 1) * 2;
        int[] f;
        for (long i = 1; i * i <= x; ++i) {
            if (!(x % i))
                f ~= cast(int) i;
        }
        auto r = assumeSorted(f);
        for (long i = 2; i * i <= x + y; ++i) {
            if ((x + y) % i)
                continue;
            auto pos = r.length - r.upperBound(i).length - 1;
            if (pos >= 0 && (x + y) / i >= x / r[pos])
                ans = min(ans, 2 * ((x + y) / i + i));
        }
        return ans;
    }
    writeln(min(sol(a, b), sol(b, a)));
}


//ahmat
import core.stdc.stdio:scanf,printf,puts;
import core.bitop;
import std.stdio;
import std.string;
import std.algorithm;
import std.functional;
import std.array;
import std.container;
import std.conv;
import std.container;
import std.typecons;
import std.math;
import std.numeric;
pragma(inline,true);

enum f=["Danil","Olya","Slava","Ann","Nikita"];
void main(){
    string s=readln.strip;
    int r=0;
    foreach(ref x;f){
        if(s.indexOf(x)>=0) r++;
        if(s.indexOf(x)!=s.lastIndexOf(x)||r>1){
            if(r<=1) r++;
            break;
        }
    }
    if(r==1)
        writeln("YES");
    else writeln("NO");
}


import std.stdio, std.string, std.container, std.conv, std.numeric, std.range;
import std.array, std.bigint, std.algorithm, std.math, std.typecons, std.random;

char[] ans;

void main() {

	string s = readln.strip;
	string t = readln.strip;

	ans ~= t;

	int k = 1;

x:
	if (ans[$ - k] != 'a') {
		ans[$ - k] = cast(char) (cast(int) (ans[$ - k]) - 1);
		goto y;
	}
	else
		if (k < ans.length) {
			ans[$ - k] = cast(char) (cast(int) (ans[$ - k]) + 1);
			++k;
			goto x;
		}

y:
	writeln((ans > s && ans < t) ? ans : "No such string");
}


import std.algorithm;
import std.array;
import std.bitmanip;
import std.container;
import std.conv;
import std.functional;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main()
{
    struct pt { int x, y; }
    struct sq { pt[4] pts; }

    sq[2] sqs;

    foreach (i; 0..2) {
        foreach (j; 0..4) {
            readf(" %s %s", &sqs[i].pts[j].x, &sqs[i].pts[j].y);
        }
        readln;
    }

    debug { sqs.writeln; }

    foreach (ref s; sqs) s.pts = s.pts.array.multiSort!(q{ a.x < b.x }, q{ a.y < b.y }).array;

    debug { sqs.writeln; }

    auto xmax = sqs[0].pts[3].x;
    auto ymax = sqs[0].pts[3].y;
    auto xmin = sqs[0].pts[0].x;
    auto ymin = sqs[0].pts[0].y;
    auto x1center = cast(double) (xmin + xmax) / 2.0;
    auto y1center = cast(double) (ymin + ymax) / 2.0;
    auto sideLen = xmax - xmin;

    auto x2center = sqs[1].pts[1].x;
    auto y2center = sqs[1].pts[0].y;
    auto diag2 = abs(sqs[1].pts[0].x - sqs[1].pts[1].x);

    bool checkParallel(double center1, int len1, int center2, int len2) {
        return cast(double) len1 / 2.0 + len2 >= abs(center2 - center1);
    }

    bool ok = false;
    if (xmin <= x2center && x2center <= xmax) {
        ok = checkParallel(y1center, sideLen, y2center, diag2);
    } else if (ymin <= y2center && y2center <= ymax) {
        ok = checkParallel(x1center, sideLen, x2center, diag2);
    } else {
        ok = abs(x1center - x2center) + abs(y1center - y2center) <= sideLen + diag2;
    }

    writeln(ok ? "YES" : "NO");
}


// tested by Hightail - https://github.com/dj3500/hightail
import std.stdio, std.string, std.conv, std.algorithm;
import std.range, std.array, std.math, std.typecons, std.container, core.bitop;

immutable long mod = 10^^9 + 7;
immutable lim = 5 * 10^^6 + 10;
int t, l, r;

void main() {
    scan(t, l, r);

    auto p = iota(r + 1).array;

    for (int i = 2; i*i < r + 1; i++) {
        if (p[i] == i) {
            for (int j = i*i; j < r + 1; j += i) {
                p[j] = min(p[j], i);
            }
        }
    }

    auto f = new long[](r + 1);

    for (int i = 2; i < r + 1; i++) {
        f[i] = 1L * i * (i - 1) / 2L;

        for (int x = i; x > 1; x /= p[x]) {
            f[i] = min(f[i], f[i / p[x]] + 1L * i * (p[x] - 1) / 2L);
        }
    }

    debug {
        writeln("f:", f);
    }

    long ans;
    long tp = 1L;

    foreach (i ; 0 .. r - l + 1) {
        (ans += tp * (f[l + i] % mod) % mod) %= mod;
        (tp *= t) %= mod;
    }

    writeln(ans);
}

void scan(T...)(ref T args) {
    string[] line = readln.split;
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}


import core.bitop, std.algorithm, std.bigint, std.compiler, std.container,
	std.conv, std.math;
import std.numeric : Fft, fft, gcd, inverseFft;
import std.random, std.range, std.stdio, std.string, std.traits, std.typecons,
	std.uni;

alias pair(X, Y) = Tuple!(X, "fi", Y, "se");
alias mp = make_pair;
alias pii = pair!(int, int);
alias pll = pair!(long, long);
// alias gcd = std.numeric.gcd;
alias lint = long;
alias rbt = RedBlackTree;
/// struct vector as c++ vector
struct Vec(T)
{
	private Array!T buf;
	alias buf this;
	this(this)
	{
		buf = buf.dup;
	}
	/// construct from length
	this(U)(U length)
			if (is(U == int) || is(U == size_t) || is(U == long) || is(U == ulong) || is(U == uint))
	{
		buf.length = length;
	}
	/// construct from length and default value
	this(U, X)(U length, X val)
			if (isImplicitlyConvertible!(X, T) || (is(U == int)
				|| is(U == size_t) || is(U == long) || is(U == ulong) || is(U == uint)))
	{
		buf.length = length;
		foreach (ref x; buf[])
		{
			x = val;
		}
	}
	/// construct from other array
	this(U)(U[] values...) if (isImplicitlyConvertible!(U, T))
	{
		buf = Array!(T)(values);
	}
	/// construct from other range
	this(Range)(Range r)
			if (isInputRange!Range && isImplicitlyConvertible!(ElementType!Range,
				T) && !is(Range == T[]))
	{
		buf = Array!(T)(r);
	}
	/// integer length
	int size() @property const
	{
		return cast(int) buf.length;
	}
}
///modulo
const int mod = 10 ^^ 9 + 7, mod2 = mod + 2;
public
{
	pure nothrow
	{
		///lcm
		T lcm(T)(auto ref T a, auto ref T b)
		{
			return a / gcd(a, b) * b;
		}
		///make_pair
		pair!(X, Y) make_pair(X, Y)(in X x_, in Y y_)
		{
			return tuple!(X, "fi", Y, "se")(x_, y_);
		}
		///BigInt greatest common divizor
		BigInt biggcd(BigInt a, BigInt b)
		{
			BigInt res = 1;
			while (b)
			{
				if ((a & 1) && (b & 1))
				{
					a -= b;
					a >>= 1;
				}
				else if (a & 1)
				{
					b >>= 1;
				}
				else if (b & 1)
				{
					a >>= 1;
				}
				else
				{
					res <<= 1;
					a >>= 1;
					b >>= 1;
				}
				if (a < b)
					swap(a, b);
			}
			return res * a;
		}
		///square
		@property X sqr(X)(in X a_)
		{
			return a_ * a_;
		}
		///cube
		@property X cub(X)(in X a_)
		{
			return a_ * a_ * a_;
		}
		///posicion lower bound
		size_t lowb(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			return assumeSorted(a).lowerBound(g).length;
		}
		///posicion upper bound
		size_t upb(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			return a.length - assumeSorted(a).upperBound(g).length;
		}
		///posicion binary search
		size_t binf(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			auto pos = lowb(a, g);
			return (g == a[pos]) ? pos : a.length;
		}
		///binary search
		bool binary_search(T, X)(T a, auto ref X g)
				if (isRandomAccessRange!T && hasLength!T && is(typeof(g < a[0]) == bool))
		{
			return assumeSorted(a).contains(g);
		}
	}
	///write an array
	void putarr(X)(in X a, in char ch = ' ') if (isInputRange!X)
	{
		writefln("%(%s" ~ ch ~ "%)", a);
	}
	///write a matrix
	void putarr(X)(in X a)
			if (isInputRange!X && isInputRange!(ElementType!X) && !isSomeString!(ElementType!X))
	{
		writefln("%(%(%s %)\n%)", a);
	}
	///get an array
	bool getarr(X)(X a, in size_t n)
	{
		bool b = 1;
		foreach (ref i; a[0 .. n])
			b = input(&i);
		return b;
	}

	static if (version_minor >= 74)
	{
		///read without format
		bool input(T...)(auto ref T ptrs) if (ptrs.length > 0)
		{
			return readf!(replicate(" %s", ptrs.length))(ptrs) == ptrs.length;
		}
		///readln without format
		bool read(T...)(auto ref T ptrs) if (ptrs.length > 0)
		{
			const bool fl = readf!(replicate(" %s", ptrs.length))(ptrs) == ptrs.length;
			readln;
			return fl;
		}
	}
	else
	{
		///read without format
		bool input(T...)(ref T ptrs) if (ptrs.length > 0)
		{
			size_t s;
			foreach (ref e; ptrs)
			{
				if (isSomeChar!(Unqual!(typeof(e))))
					s += readf(" %c", &e);
				else
					s += readf(" %s", &e);
			}
			return s == ptrs.length;
		}
		///readln without format
		bool read(T...)(ref T ptrs) if (ptrs.length > 0)
		{
			size_t s;
			foreach (ref e; ptrs)
			{
				if (isSomeChar!(Unqual!(typeof(e))))
					s += readf(" %c", &e);
				else
					s += readf(" %s", &e);
			}
			readln;
			return s == ptrs.length;
		}
	}
	///opening file
	nothrow auto inf(in char* name)
	{
		return freopen(name, "r", core.stdc.stdio.stdin);
	}
	///closing file
	nothrow auto ouf(in char* name)
	{
		return freopen(name, "w", core.stdc.stdio.stdout);
	}
	///parsing array from line
	@property auto arread(T)()
	{
		return readln.splitter.map!(to!(T)).array;
	}
	///outbuffer
	void enter(T...)(T args)
	{
		writeln(args);
		stdout.flush;
	}
}
//foreach_reverse isAlpha isNumber isWhite isLower isUpper toLower toUpper mixin
//cumulativeFold return static heapify join filter foreach
//------------------------------------------program beginning--------------------------

void main()
{
	string s = readln.strip;
	auto a = s.split('/').filter!(t => !t.empty()).array;
	write('/');
	foreach (i; 0 .. a.length)
	{
		write(a[i]);
		if (i + 1 < a.length)
			write('/');
	}
}


import std.stdio;
void main()
{write(25);}


import std.stdio;
import std.math;

void main(){
  uint n;
  readf("%s\n",&n);

  solve1(n);
  //solve2(n+1);
}

void solve2(uint size){
  ulong mod = 1000000007;
  ulong[] m = new ulong[size];

  m[0] = 0;
  m[1] = 0;
  m[2] = 3;
  m[3] = 6;
  for(uint i = 4; i < m.length; i++){
    auto sum = 0;
    //writefln("<%s>",i);
    for(uint n = 0; n < i-2; n++){
      sum += pow(2,n)*m[i-n-2];
      //writefln("%s,%s = %s",n,i-n-2,pow(2,n)*m[i-n-2]);
    }
    m[i] = (3*(sum + pow(2,i-2))) % mod;
  }

  writeln(m[size-1]);
}

void solve1(uint n){
  uint k = n;
  if(n < 10){
    n = 10;
  }

  ulong mod = 1000000007;
  //ulong size = 1000000;
  //ulong size = 10;
  ulong[] m = new ulong[n+1];

  m[0] = 0;
  m[1] = 0;
  m[2] = 3;
  m[3] = 6;
  for(uint i = 4; i < m.length; i++){
    auto x1 = (2*m[i-1] % mod);
    m[i] = ((x1 + m[i-2]*3) % mod);
  }

  writeln(m[k]);
}
//192336614


import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.bigint, std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static File _f;
void file_io(string fn) { _f = File(fn, "r"); }
static string[] s_rd;
T _RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T _RD(T = long)(File f) { while(!s_rd.length) s_rd = f.readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
T[] _RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[] _RDA(T = long)(File f, T fix = 0) { auto r = f.readln.chomp.split.to!(T[]); r[] += fix; return r; }
T RD(T = long)() { if (_f.isOpen) return _RD!T(_f); else return _RD!T; }
T[] RDA(T = long)(T fix = 0) { if (_f.isOpen)  return _RDA!T(_f, fix); else return _RDA!T(fix); }

size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

void chmin(T)(ref T x, T y) { x = min(x, y); } void chmax(T)(ref T x, T y) { x = max(x, y); }
bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
T lcm(T)(T x, T y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(T)(ref T x, T y) { x = (x + y) % mod; }
void mods(T)(ref T x, T y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(T)(ref T x, T y) { x = (x * y) % mod; }
void modpow(T)(ref T x, T y) { if (!y) { x = 1; return; } auto t = x; x.modpow(y>>1); x.modm(x); if (y&1) x.modm(t); }
void modd(T)(ref T x, T y) { y.modpow(mod - 2); x.modm(y); }

void main()
{
	auto t = RD!int;
	auto ans = new long[][](t);
	foreach (ti; 0..t)
	{
		auto n = RD;
		for (long i = 2; i*i <= n; ++i)
		{
			if (n % i) continue;
			ans[ti] = [n / i, n / i * (i-1)];
			break;
		}
		if (ans[ti].empty)
		{
			ans[ti] = [1, n-1];
		}
	}

	foreach (e; ans)
		writeln(e[0], " ", e[1]);

	stdout.flush;
	debug readln;
}


import std.stdio, std.conv, std.functional, std.string;
import std.algorithm, std.array, std.container, std.range, std.typecons;
import std.numeric, std.math, std.random;
import core.bitop;

string FMT_F = "%.10f";

static string[] s_rd;
T RD(T = long)() { while(!s_rd.length) s_rd = readln.chomp.split; string res = s_rd[0]; s_rd.popFront; return res.to!T; }
string RDR()() { return readln.chomp; }
T[] ARR(T = long)(in string str, T fix = 0) { auto r = str.split.to!(T[]); r[] += fix; return r; }
T[] RDA(T = long)(T fix = 0) { auto r = readln.chomp.split.to!(T[]); r[] += fix; return r; }
T[][] RDA2(T = long)(size_t n, T[] fix = []) { auto r = new T[][](n); foreach (i; 0..n) { r[i] = readln.chomp.split.to!(T[]); foreach (j, e; fix) r[i][j] += e; } return r; }
size_t[] MAKE_IDX(alias less = "a < b", Range)(Range range) { auto idx = new size_t[](range.length); makeIndex!(less)(range, idx); return idx;}
size_t MIN_POS(alias less = "a < b", Range)(Range range) { auto r = minPos!(less)(range); return range.length - r.length; }

bool inside(T)(T x, T b, T e) { return x >= b && x < e; }
long lcm(long x, long y) { return x * (y / gcd(x, y)); }

long mod = 10^^9 + 7;
//long mod = 998_244_353;
//long mod = 1_000_003;
void moda(ref long x, long y) { x = (x + y) % mod; }
void mods(ref long x, long y) { x = ((x + mod) - (y % mod)) % mod; }
void modm(ref long x, long y) { x = (x * y) % mod; }

void main()
{
	auto t = RD!int;
	auto ans = new long[](t);
	ans[] = long.max;
	foreach (i; 0..t)
	{
		auto n = RD!int;
		auto k = RD!int;
		auto d = RD!int;
		auto a = RDA!int;
		int[int] cnt;
		foreach (j; 0..d)
		{
			++cnt[a[j]];
		}
		ans[i] = min(ans[i], cnt.keys.length);

		foreach (j; d..n)
		{
			++cnt[a[j]];
			if (cnt[a[j-d]] == 1)
			{
				cnt.remove(a[j-d]);
			}
			else
			{
				--cnt[a[j-d]];
			}
			ans[i] = min(ans[i], cnt.keys.length);
			debug writeln(ans[i]);
		}
	}

	foreach (e; ans)
		writeln(e);
	stdout.flush();
	debug readln();
}


void main() {
  import std.stdio, std.string, std.conv, std.algorithm;

  int y, b, r;
  rd(y, b, r);

  int mx = 0;
  for (int i = 1; i <= y; i++) {
    for (int j = 1; j <= b; j++) {
      for (int k = 1; k <= r; k++) {
        if (i + 1 == j && j + 1 == k) {
          mx = max(mx, i + j + k);
        }
      }
    }
  }
  writeln(mx);
}

void rd(T...)(ref T x) {
  import std.stdio : readln;
  import std.string : split;
  import std.conv : to;

  auto l = readln.split;
  assert(l.length == x.length);
  foreach (i, ref e; x)
    e = l[i].to!(typeof(e));
}


import std.stdio, std.getopt, std.random, std.range, std.string, std.conv;
import std.algorithm, std.container, std.datetime;
import core.bitop;

class Primes {
    immutable bool[] isPrime;
    immutable int[] primes;
    this(int n) {
        auto used = new bool[n];
        int[] p;
        used[0] = used[1] = true;
        for (int i = 2; i < n; i++) {
            if (used[i]) continue;
            p ~= i;
            for (int j = i*2; j < n; j+= i) {
                used[j] = true;
            }
        }
        isPrime = used.idup.map!(i => !i).array;
        primes = p.idup;
    }

    int[] primeDecomp(long i) {
    	assert(n*n >= i);
    	int[] res;
    	foreach (d; primes) {
    		if (d*d > i) break;
    		while (!(i % d)) {
    			res ~= d;
    			i /= d;
    		}
    	}
    	if (i > 1) res ~= cast(int)i;
    	return res;
    }
};

int n;
long[] a;
int[] ps;

bool ok(int p, int d) {
	long aa = a[p];
	foreach (j; 0..n) {
		if (!(d & (1<<j))) continue;
		if (aa % a[j]) return false;
		aa /= a[j];
	}
	return true;
}

int count(int p, int d) {
	int res = ps[p];
	foreach (j; 0..n) {
		if (!(d & (1<<j))) continue;
		res -= ps[j];
	}
	return res;
}

int[][] dpcalc;
int calc(int p, int d) {
	if (p == n) {
		if (popcnt(d) == 1) return 0;
		return 1;
	}
	if (dpcalc[p][d] != -1) return dpcalc[p][d];
	int res = ((ps[p] == 1) ? 1 : ps[p]+1) + calc(p+1, d | (1<<p));
	foreach (i; 1..(1<<p)) {
		if ((i & d) != i) continue;
		if (!ok(p, i)) continue;
		res = min(res, count(p, i)+1+calc(p+1, (d & (~i)) | (1<<p)));
	}
	return res;
}

int solve() {
	auto p = new Primes(10^^6+100);
	readf("%d\n", &n);
	a = readln().split().map!(to!long).array.sort;
	ps.length = n;
	foreach (i; 0..n) {
		ps[i] = cast(int)p.primeDecomp(a[i]).length;
	}
	dpcalc = new int[][](n, 1<<n);
	foreach (dp; dpcalc) {
		dp[] = -1;
	}
	return calc(0, 0);
}

int main() {
	writeln(solve());
    return 0;
}