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

  int n, k; rd(n, k);
  auto as=readln.split.to!(int[]);

  int cur=0;
  bool[int] set;
  int[] idx;
  foreach(int i, a; as){
    if(a in set) continue;
    set[a]=true;
    idx~=(i+1);
    if(set.length==k){
      writeln("YES");
      writefln("%(%s %)", idx);
      return;
    }
  }

  writeln("NO");
}

void rd(T...)(ref T x){
  import std.stdio, std.string, std.conv;
  auto l=readln.split;
  assert(l.length==x.length);
  foreach(i, ref e; x) e=l[i].to!(typeof(e));
}

import std.stdio ;

void main() {
	int n,k,x,r,i = 1;
	bool[105] arr ;

	readf("%s %s",&n,&k);
	int[105] arr2 ;

	while(i <= n) {
		readf(" %s",&x);
		if(arr[x] == false && r <k) {
			arr[x] = true ;
			arr2[r] = i ;
			r += 1 ;
		}
		i += 1 ;
	}
	i = 0 ;
	if(r < k) {
		writeln("NO");
	}
	else {
		writeln("YES");
		while(i < k) {
			write(arr2[i]," ");
			i += 1 ;
		}
	}
}

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()
{
    int n, k;
    readf("%s %s", &n, &k);
    readln;

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

    int [int] v;
    foreach (i, e; a.enumerate(1)) v[e] = i;

    auto gr = v.values.take(k);
    if (gr.length < k) {
        writeln("NO");
        return;
    }

    writeln("YES");
    gr.writefln!("%(%s %)");
}

import std.stdio ;

void main() {
	int n,k,x,r,i = 1;
	bool[100] arr ;

	readf("%s %s",&n,&k);
	int[100] arr2 ;

	while(i <= n) {
		readf(" %s",&x);
		if(arr[x] == false && r <k) {
			arr[x] = true ;
			arr2[r] = i ;
			r += 1 ;
		}
		i += 1 ;
	}
	i = 0 ;
	if(r < k) {
		writeln("NO");
	}
	else {
		writeln("YES");
		while(i < k) {
			write(arr2[i]," ");
			i += 1 ;
		}
	}
}


import std.stdio;

void main() {
	int a, b;
	readf("%d %d", &a, &b);
	int result = 0;
	while(a <= b) {
		a *= 3;
		b *= 2;
		result++;
	}
	writeln(result);
}

import std.stdio;

void main() {
    int a, b;
    readf("%d %d\n", &a, &b);
    int year = 0;
    while (a <= b) {
        year++;
        a *= 3;
        b *= 2;
    }
    writefln("%d", year);
}

import std.stdio;
import std.string;
import std.conv;
import std.regex;
import std.algorithm.iteration;
import std.array;

void main()
{
  auto ab = stdin.readln.strip.split(regex(` +`)).map!(to!int);
  int a = ab[0], b = ab[1], y = 0;
  for (;a<=b; a*=3, b*=2, y++) {}
  write(y);
}

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

void main() {
    int a, b;
    scan(a, b);

    int cnt;

    while (a <= b) {
        a *= 3;
        b *= 2;
        cnt++;
    }

    writeln(cnt);
}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    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 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 (; ; ) {
      const A = readInt();
      const B = readInt();

      int ans;
      int a = A, b = B;
      for (; !(a > b); ) {
        ++ans;
        a *= 3;
        b *= 2;
      }
      writeln(ans);
    }
  } catch (EOFException e) {
  }
}

import std.stdio;

int main()
{
	int a=0;
	int b=0;
	readf(" %d", &a);
	readf(" %d", &b);
	int i=0;
	while(a<=b)
	{
		a=a*3;
		b=b*2;
		i=i+1;
	}
	writeln(i);
	return 0;
}

import std.stdio, std.string, std.conv;
void main()
{
  byte[] arr = readln.chomp.split(' ').to!(byte[]);
  byte ret = 0;
  while(3^^ret * arr[0] <= 2^^ret * arr[1]) ret ++;
  writeln(ret);
}


import std.stdio;
import core.stdc.stdio;
import std.algorithm;
import std.math;

int main(string[] argv)
{
	int n;
	scanf("%d", &n);
	int sum = 0;
	foreach (int i; 1..n)
	{
		sum += i * (n-i);
	}
	write(sum + n);
	return 0;
}

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

void main() {
    int n = readln.chomp.to!int;

    int ans = 0;
    for (int i = 1; i <= n - 1; i++) {
        ans += i * (n - i);
    }

    writeln(ans + n);
}

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

void main() {
    long n;
    scan(n);
    long ans = n * (n*n + 5) / 6;
    writeln(ans);
}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    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 std.array : split;
import std.conv : to;
import std.stdio;
import std.string : strip;

private {
	string[] temp;
}

void main() {
	read();

	int n = get!int(0);

	int count = 0;

	foreach (i; 1 .. n + 1) {
		count += (n - (i - 1)) * i - i + 1;
	}

	stdout.write(count);
}

void read() {
	temp = split(strip(stdin.readln()));
}

T get(T)(int p) {
	return to!(T)(temp[p]);
}

import std.stdio;
import core.stdc.stdio;
import std.algorithm;
import std.math;

int main(string[] argv)
{
	int n;
	scanf("%d", &n);
	int sum = 0;
	foreach (int i; 0..n)
	{
		sum += (sum + 1);
	}
	write(sum);
	return 0;
}

import std.array : split;
import std.conv : to;
import std.stdio;
import std.string : strip;

private {
	string[] temp;
}

void main() {
	read();

	int n = get!int(0);

	int count = n;

	foreach (i; 1 .. n) {
		count += 2 * (n - i) - 1;
	}

	stdout.write(count);
}

void read() {
	temp = split(strip(stdin.readln()));
}

T get(T)(int p) {
	return to!(T)(temp[p]);
}


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.range;
import std.stdio;
import std.string;
import std.typecons;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		readln;
		auto a = readln.split.map !(to !(int)).array;
		auto f = new int [3] [n + 1];
		foreach (i; 0..n)
		{
			auto prev = f[i].reduce !(max);
			f[i + 1][] = prev;
			foreach (j; [1, 2])
			{
				if (a[i] & j)
				{
					f[i + 1][j] = max (f[i + 1][j],
					    max (f[i][0], f[i][j ^ 3]) + 1);
				}
			}
		}
		auto res = f[n].reduce !(max);
		writeln (n - res);
	}
}

import core.bitop;
import core.checkedint;
import core.simd;
import core.stdc.string;
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.bitmanip;
import std.complex;
import std.container;
import std.conv;
import std.datetime;
import std.functional;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.regex;
import std.stdio;
import std.string;
import std.typecons;
import std.variant;

bool read(T...)(T ptrs) if (ptrs.length > 0) {
    return readf(' ' ~ replicate("%s ", ptrs.length), ptrs) == ptrs.length;
}

int n;
int[100] _a;
int[ ] a;

int[3][100] dp;

int dyn(int day, int prevMask) {
    if (day == n)
        return 0;
    if (~dp[day][prevMask])
        return dp[day][prevMask];
    int result = dyn(day + 1, 0x0) + 1;
    foreach (mask; 0x1 .. 0x3)
        if ((a[day] & mask) && !(prevMask & mask))
            result = min(result, dyn(day + 1, mask));
    return (dp[day][prevMask] = result);
}

void main() {
    while (read(&n)) {
        a = _a[0 .. n];
        foreach (ref x; a)
            read(&x);
        memset(dp.ptr, 0xFF, dp.sizeof);
        writeln(dyn(0, 0x0));
    }
}

import std.stdio;
import std.conv;
import std.algorithm;
void main() {
    int d0 = 0, d1 = 0, d2 = 0;
    int n;
    readf("%d", &n);
    foreach (i; 0 .. n) {
    	//write(i);
        int c;
        readf(" %d", &c);
        int n0 = max(d0, max(d1, d2));
        int n1 = -1;
        int n2 = -1;
        if (c & 1) {
            n1 = max(n1, max(d0, d2) + 1);
        }
        if (c & 2) {
            n2 = max(n2, max(d0, d1) + 1);
        }
        d0 = n0, d1 = n1, d2 = n2;
        //writef("%d, %d, %d\n", d0, d1, d2);
    }
    write(n - max(d0, max(d1, d2)));
}

import std.stdio;
import std.algorithm;
void main() {
    int d0 = 0, d1 = 0, d2 = 0;
    int n;
    readf("%d", &n);
    foreach (i; 1 .. n) {
        int c;
        readf(" %d", &c);
        int n0 = max(d0, max(d1, d2));
        int n1 = d1;
        int n2 = d2;
        if (c & 1) {
            n1 = max(n1, max(d0, d2) + 1);
        }
        if (c & 2) {
            n2 = max(n2, max(d0, d1) + 1);
        }
        d0 = n0, d1 = n1, d2 = n2;
    }
    write(n - max(d0, max(d1, d2)));
}


import std.stdio, std.algorithm, std.string, std.conv, std.array, std.range, std.math;
int readint() { return readln.chomp.to!int; }
int[] readints() { return readln.split.to!(int[]); }

void main() {
    string s = readln.chomp;
    string t = readln.chomp;

    int cur = 0;
    foreach (c ; t) {
        if (c == s[cur]) cur++;
    }

    writeln(cur + 1);

    string _ = readln;
}

module main;

import std.stdio : readln, writeln, write, writefln, writef;
import std.conv : to;
import std.array : split, replace;
import std.string : strip;
import std.algorithm : max, min, map, reduce, sort, reverse;
import std.functional : memoize;

version = A;

version (A)
{
    void main()
    {
        auto sequence = read_one!string();
        auto instructions = read_one!string();
        size_t position = 0;
        foreach (instruction; instructions)
        {
            if (sequence[position] == instruction)
            {
                position += 1;
            }
        }
        writeln(position + 1);
    }
}
version (B)
{
    void main()
    {
        auto n = read_one!int();
    }
}
version (C)
{
    void main()
    {
        auto n = read_one!int();
    }
}
version (D)
{
    void main()
    {
        auto n = read_one!int();
    }
}
version (E)
{
    void main()
    {
    }
}

T read_one(T)()
{
    return readln().strip().to!T();
}

T[] read_some(T)()
{
    T[] ret;
    foreach (e; readln().strip().split())
    {
        ret ~= e.to!T();
    }
    return ret;
}

T[m] read_fixed(int m, T)()
{
    T[m] ret;
    foreach (i, e; readln().strip().split())
    {
        ret[i] = e.to!T();
    }
    return ret;
}

import std.stdio;

void main() {
	string land = stdin.readln();

	size_t position = 1;

	foreach (char command; stdin.readln()) {
		if (command == land[position - 1]) {
			++position;
		}
	}

	stdout.write(position);
}


import std.stdio;

void main() {
	long n;
	readf!"%s\n"(n);

	long product=0;
	long count=1;
	for (int i=0; i<n; i++){
		int piece;
		readf!"%s "(piece);

		/* writeln(piece); */

		if (piece == 0){
			count++;
		} else if (piece == 1 && product == 0) {
			product = 1;
			count=1;
		} else if (piece == 1) {
			product = product * count;
			count=1;
		}
	}

	writeln(product);
}

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

void main()
{
	 auto s1 = split(strip(readln));
	 long[] b;
	 auto s2 = split(strip(readln));
	 foreach(idx, num; s2)
	 {
	 	if (num == "1")
	 		b ~= idx;
	 }
	 long prod = 1; long dif;
	 if (b.length == 0)
	 {
	 	write(0);
	 	return;
	 }
	 else if (b.length == 1)
	 {
	 	write(1);
	 	return;
	 }
	 foreach(idx, num; b[1 .. $])
	 {
	 	dif = num - b[idx];
		prod *= dif;
	 }
	 writeln(prod);
}

import std.stdio;

void main() {
	int n;
	readf!"%s\n"(n);

	int product=1;
	int count=1;
	for (int i=0; i<n; i++){
		int piece;
		readf!"%s "(piece);

		/* writeln(piece); */

		if (piece == 0){
			count++;
		} else if (piece == 1) {
			product = product * count;
			count=1;
		}
	}

	writeln(product);
}

import std.stdio;

void main() {
	int n;
	readf!"%s\n"(n);

	int product=0;
	int count=1;
	for (int i=0; i<n; i++){
		int piece;
		readf!"%s "(piece);

		/* writeln(piece); */

		if (piece == 0){
			count++;
		} else if (piece == 1 && product == 0) {
			product = 1;
			count=1;
		} else if (piece == 1) {
			product = product * count;
			count=1;
		}
	}

	writeln(product);
}


import std.stdio: writeln, readf;

void main() {
    int coordinate = 0;
    int steps = 0;
    int moves = 5;

    readf(" %s", coordinate);

    for(int i = moves; i > 0; i--) {
    	if(coordinate >= i) {
    	steps += coordinate/i;
    	coordinate = coordinate % i;
    	}
    }

    writeln(steps);
}

import std.stdio;
import std.uni;
import std.string;
import core.stdc.stdio;
import std.array;
import std.algorithm;
import std.string;
import std.math;

int main(string[] argv)
{
	int x;
	scanf("%d", &x);
	int r = 0;
	int s = 5;
	while (x > 0)
	{
		r += x / s;
		x = x % s;
		s--;
	}
	printf("%d", r);
	return 0;
}

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

void main()
{
	 auto s1 = split(strip(readln));
	 long n = to!long(s1[0], 10);
	 if (n % 5 == 0)
	    writeln(n / 5 );
	 else
	    writeln(n / 5 + 1);
}

import std.stdio;

int main( ) {
    int n ;
	readf("%d",n);
	int[] ar = [5, 4 ,3 ,2 ,1];
	int c = 0;
	for (int i = 0 ; i < 5 ; i++ ) {
		int _c = n / ar[i];
		n -=  ar[i] * _c;
		c += _c;
		if (n == 0)
			break;
	}
	write(c , '\n');

	return 0;
}

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

void main() {
    int x = readln.chomp.to!int;
    writeln((x + 4)/ 5);
}

import std.stdio;

int main()
{
	int a=0;
	readf(" %d", &a);
	if (a%5==0)
	{
		writeln(a/5);
	}
	else
	{
		writeln((a/5)+1);
	}
	return 0;
}

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

void main()
{
	 auto s1 = split(strip(readln));
	 long n = to!long(s1[0], 10);
	 writeln(n / 5 + 1);
}


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

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		auto a = new int [n];
		foreach (ref x; a)
		{
			readf (" %s", &x);
		}

		bool ok = false;
		foreach (s; 0..1 << n)
		{
			int cur = 0;
			foreach (i; 0..n)
			{
				if (s & (1 << i))
				{
					cur += a[i];
				}
				else
				{
					cur -= a[i];
				}
			}
			if (cur % 360 == 0)
			{
				ok = true;
			}
		}
		writeln (ok ? "YES" : "NO");
	}
}

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

void main() {
    int n;
    scan(n);
    auto a = iota(n).map!(i => readln.chomp.to!int).array;

    foreach (s ; 0 .. 1<<n) {
        int deg;

        foreach (i ; 0 .. n) {
            if (s & (1 << i)) {
                deg += a[i];
                deg %= 360;
            }
            else {
                deg -= a[i];
                deg %= 360;
            }
        }

        if (deg == 0) {
            writeln("YES");
            return;
        }
    }

    writeln("NO");
}

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    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 std.algorithm;
import std.conv;
import std.range;
import std.stdio;
import std.string;

void main ()
{
	int n;
	while (readf (" %s", &n) > 0)
	{
		auto a = new int [n];
		foreach (ref x; a)
		{
			readf (" %s", &x);
		}

		bool ok = false;
		foreach (s; 0..1 << n)
		{
			int cur = 0;
			foreach (i; 0..n)
			{
				if (s & (1 << i))
				{
					cur += a[i];
				}
				else
				{
					cur -= a[i];
				}
			}
			if (cur % 180 == 0)
			{
				ok = true;
			}
		}
		writeln (ok ? "YES" : "NO");
	}
}


module main;
import std.bigint,std.container,std.array,std.algorithm,std.conv,
	std.functional,std.math,std.numeric,std.string,std.range,std.complex,
	std.typecons,std.regex,std.random,std.uni,std.traits,std.variant;
import core.stdc.stdio : freopen;
import core.stdc.stdlib : system;
import std.stdio;
//import core.stdc.stdio;
alias RedBlackTree Rbt;
alias redBlackTree rbt;
alias BigInt big;
alias pair!(int,int) pii;
alias pair!(long,long) pll;
alias BoyerMooreFinder strfind;
alias mp=make_pair;
alias bins=binary_search;
alias orsq=orient_square;
immutable int mod=1000000007;
pure nothrow
{
	T lcm (T)(auto ref T a,auto ref T b)
	{
		return a/gcd(a,b)*b;
	}
	X binpow(X,Y)(X base,Y exp)
		if(is(typeof(exp&1)))
	{
		if(exp<0)return X(0);
		X res=X(1);
		while(exp>0)
		{
			if(exp&1)res*=base;
			base*=base;
			exp>>=1;
		}
		return res;
	}
	auto binpow(X,Y,Z)(X base,Y exp,in Z mm)
		if(is(typeof(exp&1)))
	{
		if(mm==0) return binpow(base,exp);
		if(exp<0)return X(0);
		auto res=X(1)%mm;
		while(exp>0)
		{
			if(exp&1)res=(res*base)%mm;
			base*=base;
			base%=mm;
			exp>>=1;
		}
		return res;
	}
	@property X sqr(X)(in X a_) {return a_*a_;}
	@property X cub(X)(in X a_) {return a_*a_*a_;}
	size_t lowb(T,X)(in 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;
	}
	size_t upb(T,X)(in 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;
	}
	size_t binf(T,X)(in 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 (g==a[l])?l:a.length;
	}
	bool binary_search(T,X)(in T a,auto ref X g)
		if(isRandomAccessRange!T && hasLength!T && is(typeof(g<a[0])==bool))
	{
		return binf(a,g)!=a.length;
	}
	V foldr(R,V,T)(R range,T arg,V nach)
		if(isFunction!T && isInputRange!R && is(typeof(arg(nach,R.front))==V))
	{
		for(;!range.empty;range.popFront()) nach=arg(nach,range.front);
		return nach;
	}
	size_t countr(R,T)(R range,T fun)
		if(isFunction!T && isInputRange!R && is(typeof(fun(R.front))==bool))
	{
		size_t nach;
		for(;!range.empty;range.popFront()) nach+=fun(range.front);
		return nach;
	}
	T orient_square(T)(pair!(T,T)[] figure...)
		if(is(typeof(figure.front*figure.front)==T))
	{
		auto n=figure.front,t=figure.front;
		figure.popFront();
		T ans=0;
		for(;!figure.empty;figure.popFront())
		{
			ans+=(figure.front.fi-t.fi)*(figure.front.se+t.se);
			t=figure.front;
		}
		return ans+(n.fi-t.fi)*(n.se+t.se);
	}
	real square(T)(pair!(T,T)[] figure...)
		if(is(typeof(figure.front*figure.front)==T))
	{
		return abs(orient_square(figure))/2.000000000000000;
	}
}
void putarr(X)(in X a,in char ch=' '){foreach(const ref i;a)write(i,ch);}
void putarr(X)(in X a,in size_t n=a.length,in size_t m=a.front.length)
{
	foreach(i;0..n)
	{
		foreach(j;0..m)write(a[i][j],' ');
		writeln;
	}
}
bool getarr(X)(X a,in size_t n)
{bool b=1; foreach(ref i;a[0..n])b=input(&i);return b;}
bool input(T...)(T ptrs) if (ptrs.length > 0)
{return readf(replicate(" %s", ptrs.length), ptrs)==ptrs.length;}
struct pair(X,Y)
{
	X first;
	Y second;
	alias first fi;
	alias second se;
	this(X a_,Y b_){
		fi=a_;
		se=b_;
	}
	this(this){fi=fi;se=se;}
	this(A,B)(auto ref pair!(A,B) p) if(is(A:X) && is(B:Y))
	{
		fi=p.fi;
		se=p.se;
	}
	pair!(X,Y) opAssign(A,B)(pair!(A,B) val)
	{
		return this=pair!(X,Y)(val);
	}
	int opCmp(A,B)(in pair!(A,B) s_) const pure nothrow @safe
		if(is(typeof(s_.fi<fi)==bool) && is(typeof(s_.se<se)==bool))
	{
		int cmp=0-(fi<s_.fi)+(fi>s_.fi);
		if(cmp!=0)return cmp;
		else return (0-(se<s_.se)+(se>s_.se));
	}
};
pair!(X,Y) make_pair(X,Y)(in X x_,in Y y_) pure nothrow @safe
{
	pair!(X,Y) pp;
	pp.fi=x_;
	pp.se=y_;
	return pp;
}
nothrow void inf(in char* name) {freopen(name,"r",core.stdc.stdio.stdin);}
nothrow void ouf(in char* name) {freopen(name,"w",core.stdc.stdio.stdout);}
@property auto arread(T)(){return readln.split.map!(to!(T)).array;}
struct Tree(T,alias arg="a+b")
{
	private alias fun=binaryFun!arg;
	private static const size_t n=size_t.max>>1;
	private T[size_t] t;
	this(this){t=t.dup;}
	this(R)(R range) if(isInputRange!R && is(ElementType!(R) : T))
	{
		foreach(pos,i;range) upd(pos,i);
	}
	this(R,alias f)(Tree!(R,f) q) if(is(R:T))
	{
		foreach(i,j;q.t)
		{
			t[i]=j;
		}
	}
	Tree!(T,arg) opAssign(R)(R val)
	{
		return this=Tree!(T,arg)(val);
	}
	private void upd(in size_t v,in size_t vl,in size_t vr,in size_t i,in T x)
	{
		if (vr - vl == 1){t[v] = x;return;}
		size_t vm = (vl + vr) >> 1;
		if(i < vm) upd(2*v, vl, vm, i, x);
		else upd(2*v+1, vm, vr, i, x);
		if(v*2+1 !in t)t[v]=t[v*2];
		else if (v*2 !in t)t[v]=t[v*2+1];
		else t[v]=fun(t[v*2],t[v*2+1]);
	}
	void upd(in size_t i,in T x)
	{
		upd(1,0,n,i,x);
	}
	private T cel(in size_t v,in size_t vl,in size_t vr,in size_t l,in size_t r)
	{
		if(vl==l && r==vr) return t[v];
		size_t vm=(vl+vr) >> 1;
		if(r<=vm) return cel(2*v,vl,vm,l,r);
		else if(l>=vm) return cel(2*v+1,vm,vr,l,r);
		else return fun(cel(2*v,vl,vm,l,vm),cel(2*v+1,vm,vr,vm,r));
	}
	T cel(in size_t l,in size_t r){return cel(1,0,n,l,r);}
};
//split strip isAlpha isNumber isWhite isLower isUpper toLower toUpper mixin
//cumulativeFold schwartzSort multiSort partialSort heapify join filter countUntil
//---------------------------------------------------------------program beginning-----------------------------------------------------------------

void main()
{
	int n;
	loop:while(input(&n))
	{
		readln;
		auto a=arread!int;
		if(a.sum!=0)
		{
			writeln("YES");
			writeln(1);
			writeln(1,' ',n);
			continue loop;
		}
		else
		{
			foreach(i;1..n)
			{
				if(sum(a[0..i])!=0 && sum(a[i..n])!=0)
				{
					writeln("YES");
					writeln(2);
					writeln(1,' ',i);
					writeln(i+1,' ',n);
					continue loop;
				}
			}
		}
		writeln("NO");
	}
}

import std.bigint,std.container,std.array,std.algorithm,std.conv,
std.functional,std.math,std.numeric,std.string,std.range,std.complex,
std.typecons,std.regex,std.random,std.uni,std.traits,std.variant;
import core.stdc.stdio : freopen;
import core.stdc.stdlib : system;
import std.stdio;
//import core.stdc.stdio;
alias RedBlackTree Rbt;
alias redBlackTree rbt;
alias BigInt big;
alias pair!(int,int) pii;
alias pair!(long,long) pll;
alias BoyerMooreFinder strfind;
alias make_pair mp;
alias binary_search bins;
alias orient_square orsq;
immutable int mod=1000000007;
pure nothrow
{
	T lcm (T)(auto ref T a,auto ref T b)
	{
		return a/gcd(a,b)*b;
	}
	X binpow(X,Y)(X base,Y exp)
		if(is(typeof(exp&1)))
		{
			if(exp<0)return X(0);
			X res=X(1);
			while(exp>0)
			{
				if(exp&1)res*=base;
				base*=base;
				exp>>=1;
			}
			return res;
		}
	auto binpow(X,Y,Z)(X base,Y exp,in Z mm)
		if(is(typeof(exp&1)))
		{
			if(mm==0) return binpow(base,exp);
			if(exp<0)return X(0);
			auto res=X(1)%mm;
			while(exp>0)
			{
				if(exp&1)res=(res*base)%mm;
				base*=base;
				base%=mm;
				exp>>=1;
			}
			return res;
		}
	@property X sqr(X)(in X a_) {return a_*a_;}
	@property X cub(X)(in X a_) {return a_*a_*a_;}
	size_t lowb(T,X)(in 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;
		}
	size_t upb(T,X)(in 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;
		}
	size_t binf(T,X)(in 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 (g==a[l])?l:a.length;
		}
	bool binary_search(T,X)(in T a,auto ref X g)
		if(isRandomAccessRange!T && hasLength!T && is(typeof(g<a[0])==bool))
		{
			return binf(a,g)!=a.length;
		}
	V foldr(R,V,T)(R range,T arg,V nach)
		if(isFunction!T && isInputRange!R && is(typeof(arg(nach,R.front))==V))
		{
			for(;!range.empty;range.popFront()) nach=arg(nach,range.front);
			return nach;
		}
	size_t countr(R,T)(R range,T fun)
		if(isFunction!T && isInputRange!R && is(typeof(fun(R.front))==bool))
		{
			size_t nach;
			for(;!range.empty;range.popFront()) nach+=fun(range.front);
			return nach;
		}
	T orient_square(T)(pair!(T,T)[] figure...)
		if(is(typeof(figure.front*figure.front)==T))
		{
			auto n=figure.front,t=figure.front;
			figure.popFront();
			T ans=0;
			for(;!figure.empty;figure.popFront())
			{
				ans+=(figure.front.fi-t.fi)*(figure.front.se+t.se);
				t=figure.front;
			}
			return ans+(n.fi-t.fi)*(n.se+t.se);
		}
	real square(T)(pair!(T,T)[] figure...)
		if(is(typeof(figure.front*figure.front)==T))
		{
			return abs(orient_square(figure))/2.000000000000000;
		}
}
void putarr(X)(in X a,in char ch=' '){foreach(const ref i;a)write(i,ch);}
void putarr(X)(in X a,in int n,in int m)
{
	foreach(i;0..n)
	{
		foreach(j;0..m)write(a[i][j],' ');
		writeln;
	}
}
bool getarr(X)(X a,in int n)
{bool b=1; foreach(ref i;a[0..n])b=input(&i);return b;}
bool input(T...)(T ptrs) if (ptrs.length > 0)
{return readf(replicate(" %s", ptrs.length), ptrs)==ptrs.length;}
struct pair(X,Y)
{
	X first;
	Y second;
	alias first fi;
	alias second se;
	this(X a_,Y b_){
		fi=a_;
		se=b_;
	}
	this(this){fi=fi;se=se;}
	this(A,B)(auto ref pair!(A,B) p) if(is(A:X) && is(B:Y))
	{
		fi=p.fi;
		se=p.se;
	}
	pair!(X,Y) opAssign(A,B)(pair!(A,B) val)
	{
		return this=pair!(X,Y)(val);
	}
	int opCmp(A,B)(in pair!(A,B) s_) const pure nothrow @safe
		if(is(typeof(s_.fi<fi)==bool) && is(typeof(s_.se<se)==bool))
		{
			int cmp=0-(fi<s_.fi)+(fi>s_.fi);
			if(cmp!=0)return cmp;
			else return (0-(se<s_.se)+(se>s_.se));
		}
};
pair!(X,Y) make_pair(X,Y)(in X x_,in Y y_) pure nothrow @safe
{
	pair!(X,Y) pp;
	pp.fi=x_;
	pp.se=y_;
	return pp;
}
nothrow void inf(in char* name) {freopen(name,"r",core.stdc.stdio.stdin);}
nothrow void ouf(in char* name) {freopen(name,"w",core.stdc.stdio.stdout);}
@property auto arread(T)(){return readln.split.map!(to!(T)).array;}
struct Tree(T,alias arg="a+b")
{
	private alias fun=binaryFun!arg;
	private static const uint n=int.max;
	private T[uint] t;
	this(this){t=t.dup;}
	this(R)(R range) if(isInputRange!R && is(ElementType!(R) : T))
	{
		foreach(pos,i;range) upd(pos,i);
	}
	this(R,alias f)(Tree!(R,f) q) if(is(R:T))
	{
		foreach(i,j;q.t)
		{
			t[i]=j;
		}
	}
	Tree!(T,arg) opAssign(R)(R val)
	{
		return this=Tree!(T,arg)(val);
	}
	private void upd(in uint v,in uint vl,in uint vr,in uint i,in T x)
	{
		if (vr - vl == 1){t[v] = x;return;}
		uint vm = (vl + vr) >> 1;
		if(i < vm) upd(2*v, vl, vm, i, x);
		else upd(2*v+1, vm, vr, i, x);
		if(v*2+1 !in t)t[v]=t[v*2];
		else if (v*2 !in t)t[v]=t[v*2+1];
		else t[v]=fun(t[v*2],t[v*2+1]);
	}
	void upd(in uint i,in T x)
	{
		upd(1,0,n,i,x);
	}
	private T cel(in uint v,in uint vl,in uint vr,in uint l,in uint r)
	{
		if(vl==l && r==vr) return t[v];
		uint vm=(vl+vr) >> 1;
		if(r<=vm) return cel(2*v,vl,vm,l,r);
		else if(l>=vm) return cel(2*v+1,vm,vr,l,r);
		else return fun(cel(2*v,vl,vm,l,vm),cel(2*v+1,vm,vr,vm,r));
	}
	T cel(in uint l,in uint r){return cel(1,0,n,l,r);}
};
//split strip isAlpha isNumber isWhite isLower isUpper toLower toUpper mixin
//cumulativeFold schwartzSort multiSort partialSort heapify join filter
//---------------------------------------------------------------program beginning-----------------------------------------------------------------

void main()
{
	int n;
	while(input(&n))
	{
		readln;
		auto a=arread!int;
		if(a.sum!=0)
		{
			writeln("YES");
			writeln(1);
			writeln(1,' ',n);
			return;
		}
		else
		{
			foreach(i;1..n)
			{
				if(sum(a[0..i])!=0 && sum(a[i..n])!=0)
				{
					writeln("YES");
					writeln(2);
					writeln(1,' ',i);
					writeln(i+1,' ',n);
					return;
				}
			}
		}
		writeln("NO");
	}
	debug system("pause");
}

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 A = readln.split.map!(to!int).array;

    if (A.map!(a => a == 0).all) {
        writeln("NO");
        return;
    }

    writeln("YES");

    if (A.sum == 0) {
        foreach (i; 0..N) if (A[i] != 0) {
            writeln(2);
            writeln(1, " ", i+1);
            writeln(i+2, " ", N);
            break;
        }
    } else {
        writeln(1);
        writeln(1, " ", N);
    }
}

import std.bigint,std.container,std.array,std.algorithm,std.conv,
std.functional,std.math,std.numeric,std.string,std.range,std.complex,
std.typecons,std.regex,std.random,std.uni,std.traits,std.variant;
import core.stdc.stdio : freopen;
import core.stdc.stdlib : system;
import std.stdio;
//import core.stdc.stdio;
alias RedBlackTree Rbt;
alias redBlackTree rbt;
alias BigInt big;
alias pair!(int,int) pii;
alias pair!(long,long) pll;
alias BoyerMooreFinder strfind;
alias make_pair mp;
alias binary_search bins;
alias orient_square orsq;
immutable int mod=1000000007;
pure nothrow
{
	T lcm (T)(auto ref T a,auto ref T b)
	{
		return a/gcd(a,b)*b;
	}
	X binpow(X,Y)(X base,Y exp)
		if(is(typeof(exp&1)))
		{
			if(exp<0)return X(0);
			X res=X(1);
			while(exp>0)
			{
				if(exp&1)res*=base;
				base*=base;
				exp>>=1;
			}
			return res;
		}
	auto binpow(X,Y,Z)(X base,Y exp,in Z mm)
		if(is(typeof(exp&1)))
		{
			if(mm==0) return binpow(base,exp);
			if(exp<0)return X(0);
			auto res=X(1)%mm;
			while(exp>0)
			{
				if(exp&1)res=(res*base)%mm;
				base*=base;
				base%=mm;
				exp>>=1;
			}
			return res;
		}
	@property X sqr(X)(in X a_) {return a_*a_;}
	@property X cub(X)(in X a_) {return a_*a_*a_;}
	size_t lowb(T,X)(in 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;
		}
	size_t upb(T,X)(in 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;
		}
	size_t binf(T,X)(in 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 (g==a[l])?l:a.length;
		}
	bool binary_search(T,X)(in T a,auto ref X g)
		if(isRandomAccessRange!T && hasLength!T && is(typeof(g<a[0])==bool))
		{
			return binf(a,g)!=a.length;
		}
	V foldr(R,V,T)(R range,T arg,V nach)
		if(isFunction!T && isInputRange!R && is(typeof(arg(nach,R.front))==V))
		{
			for(;!range.empty;range.popFront()) nach=arg(nach,range.front);
			return nach;
		}
	size_t countr(R,T)(R range,T fun)
		if(isFunction!T && isInputRange!R && is(typeof(fun(R.front))==bool))
		{
			size_t nach;
			for(;!range.empty;range.popFront()) nach+=fun(range.front);
			return nach;
		}
	T orient_square(T)(pair!(T,T)[] figure...)
		if(is(typeof(figure.front*figure.front)==T))
		{
			auto n=figure.front,t=figure.front;
			figure.popFront();
			T ans=0;
			for(;!figure.empty;figure.popFront())
			{
				ans+=(figure.front.fi-t.fi)*(figure.front.se+t.se);
				t=figure.front;
			}
			return ans+(n.fi-t.fi)*(n.se+t.se);
		}
	real square(T)(pair!(T,T)[] figure...)
		if(is(typeof(figure.front*figure.front)==T))
		{
			return abs(orient_square(figure))/2.000000000000000;
		}
}
void putarr(X)(in X a,in char ch=' '){foreach(const ref i;a)write(i,ch);}
void putarr(X)(in X a,in int n,in int m)
{
	foreach(i;0..n)
	{
		foreach(j;0..m)write(a[i][j],' ');
		writeln;
	}
}
bool getarr(X)(X a,in int n)
{bool b=1; foreach(ref i;a[0..n])b=input(&i);return b;}
bool input(T...)(T ptrs) if (ptrs.length > 0)
{return readf(replicate(" %s", ptrs.length), ptrs)==ptrs.length;}
struct pair(X,Y)
{
	X first;
	Y second;
	alias first fi;
	alias second se;
	this(X a_,Y b_){
		fi=a_;
		se=b_;
	}
	this(this){fi=fi;se=se;}
	this(A,B)(auto ref pair!(A,B) p) if(is(A:X) && is(B:Y))
	{
		fi=p.fi;
		se=p.se;
	}
	pair!(X,Y) opAssign(A,B)(pair!(A,B) val)
	{
		return this=pair!(X,Y)(val);
	}
	int opCmp(A,B)(in pair!(A,B) s_) const pure nothrow @safe
		if(is(typeof(s_.fi<fi)==bool) && is(typeof(s_.se<se)==bool))
		{
			int cmp=0-(fi<s_.fi)+(fi>s_.fi);
			if(cmp!=0)return cmp;
			else return (0-(se<s_.se)+(se>s_.se));
		}
};
pair!(X,Y) make_pair(X,Y)(in X x_,in Y y_) pure nothrow @safe
{
	pair!(X,Y) pp;
	pp.fi=x_;
	pp.se=y_;
	return pp;
}
nothrow void inf(in char* name) {freopen(name,"r",core.stdc.stdio.stdin);}
nothrow void ouf(in char* name) {freopen(name,"w",core.stdc.stdio.stdout);}
@property auto arread(T)(){return readln.split.map!(to!(T)).array;}
struct Tree(T,alias arg="a+b")
{
	private alias fun=binaryFun!arg;
	private static const uint n=int.max;
	private T[uint] t;
	this(this){t=t.dup;}
	this(R)(R range) if(isInputRange!R && is(ElementType!(R) : T))
	{
		foreach(pos,i;range) upd(pos,i);
	}
	this(R,alias f)(Tree!(R,f) q) if(is(R:T))
	{
		foreach(i,j;q.t)
		{
			t[i]=j;
		}
	}
	Tree!(T,arg) opAssign(R)(R val)
	{
		return this=Tree!(T,arg)(val);
	}
	private void upd(in uint v,in uint vl,in uint vr,in uint i,in T x)
	{
		if (vr - vl == 1){t[v] = x;return;}
		uint vm = (vl + vr) >> 1;
		if(i < vm) upd(2*v, vl, vm, i, x);
		else upd(2*v+1, vm, vr, i, x);
		if(v*2+1 !in t)t[v]=t[v*2];
		else if (v*2 !in t)t[v]=t[v*2+1];
		else t[v]=fun(t[v*2],t[v*2+1]);
	}
	void upd(in uint i,in T x)
	{
		upd(1,0,n,i,x);
	}
	private T cel(in uint v,in uint vl,in uint vr,in uint l,in uint r)
	{
		if(vl==l && r==vr) return t[v];
		uint vm=(vl+vr) >> 1;
		if(r<=vm) return cel(2*v,vl,vm,l,r);
		else if(l>=vm) return cel(2*v+1,vm,vr,l,r);
		else return fun(cel(2*v,vl,vm,l,vm),cel(2*v+1,vm,vr,vm,r));
	}
	T cel(in uint l,in uint r){return cel(1,0,n,l,r);}
};
//split strip isAlpha isNumber isWhite isLower isUpper toLower toUpper mixin
//cumulativeFold schwartzSort multiSort partialSort heapify join filter
//---------------------------------------------------------------program beginning-----------------------------------------------------------------

void main()
{
	int n;
	while(input(&n))
	{
		readln;
		auto a=arread!int;
		if(a.sum!=0)
		{
			writeln("YES");
			writeln(1);
			writeln(1,' ',n);
			return;
		}
		else
		{
			foreach(i;1..n-1)
			{
				if(sum(a[0..i])!=0 && sum(a[i..n])!=0)
				{
					writeln("YES");
					writeln(2);
					writeln(1,' ',i);
					writeln(i+1,' ',n);
					return;
				}
			}
		}
		writeln("NO");
	}
	debug system("pause");
}


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

void main ()
{
	int n;
	while (readf !(" %s") (n) > 0)
	{
		for (int i = 2; i * i <= n; i++)
		{
			if (n % i == 0)
			{
				writeln (i, n / i);
				break;
			}
		}
	}
}

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 (; ; ) {
      const A = readInt();
      int a = A;
      for (int p = 2; p <= a; ++p) {
        for (; a % p == 0; ) {
          write(p);
          a /= p;
        }
      }
      writeln();
    }
  } catch (EOFException e) {
  }
}


module cf_216A;

import std.stdio;

void main() {
    int a, b, c;

    readf("%d %d %d", &a, &b, &c);

    int count = c * (a + b - 1) + (a - 1) * (b - 1);
    writeln(count);
}

import std.stdio;

int main() {
    debug stdin = File("in.txt", "r");

    int a, b, c;
    readf(" %s %s %s\n", &a, &b, &c);
    int answer = 7;
    answer += (a - 2) * (2 + 2 - 1);
    answer += (b - 2) * (a + 2 - 1);
    answer += (c - 2) * (a + b - 1);
    writeln(answer);

    return 0;
}

module cf_216A;

import std.stdio;

void main() {
    int a, b, c;

    readf("%d %d %d", &a, &b, &c);
    writeln(2 * (a + b + c));
}


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

void main() {
    string[] p = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"];
    int n = readln.chomp.to!int;
    n--;
    while (n >= 5) {
        n -= 5;
        n /= 2;
    }
    writeln(p[n]);
}

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

/// solve ==========================
string solve(int n){

  string[] persons = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"];
  int times;
  int start;
  string res;
  int personNum;

  auto xs = recurrence!("(a[n-1] + (a[n-1] - a[n-2])*2)")(1, 6);
  foreach(x; xs){
    if(x > n) break;
    start = x;
    times += 1;
  }
  personNum = (n - start) / (2^^(times-1));
  res = persons[personNum].to!string;
  return res;
}

/// main ====================
void main(){
  auto n = readln.strip.to!int;
  solve(n).writeln;
}

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

string solve(int n){

  string[] names = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"];
  int times;
  int start;
  string res;
  int modN;

  /// solve ==========================
  auto xs = recurrence!("(a[n-1] + (a[n-1] - a[n-2])*2)")(1, 6);
  foreach(x; xs){
    if(x > n) break;
    start = x;
    times += 1;
  }
  modN = (n - start) / (2^^(times-1));
  res = names[modN].to!string;
  return res;
}

/// unittest -------------------
unittest{
  assert( solve(1) == "S" );
  assert( solve(6) == "S" );
  assert( solve(1802) == "P" );
  writeln("---pass ---");
}

/// main ====================
void main(){
  auto n = readln.strip.to!int;
  solve(n).writeln;
}

import std.stdio;
import std.conv : to;

immutable names = ["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"];

void main()
{
    ulong num;
    readf("%s", &num);

    ulong groupSize = 5;

    while(true)
    {
        if (num <= groupSize)
        {
            names[cast(uint)((num-1)/(groupSize/5))].writeln;
            break;
        }

        num -= groupSize;
        groupSize *= 2;
    }
}

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

void main()
{
  auto n = stdin.readln.strip.to!int;
  int m=0, j=0;
  for(int i=1; i<=n; i+=5*(2^^j),j++) m=i;
  write(["Sheldon", "Leonard", "Penny", "Rajesh", "Howard"][(n-m)/(2^^(--j))]);
}

import std.stdio;
import std.string;
import std.algorithm;
import core.stdc.stdio;
import std.bigint;
import std.format;
import std.math;

string readline()
{
	string result = readln();
	if (result[result.length - 1] == '\n') result.length--;
	return result;
}

int main(string[] argv)
{
	long n;
	scanf("%d", &n); n--;
	long pm = 0;
	long m = 1;
	while ((pm + m * 5) <= n)
	{
		pm += m * 5;
		m = m * 2;
	}

	long l = (n - pm) / m;

	string[long] names;
	names[0] = "Sheldon";
	names[1] = "Leonard";
	names[2] = "Penny";
	names[3] = "Rajesh";
	names[4] = "Howard";
	write(names[l]);
	return 0;
}

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

string solve(int n){

  string names = "SLPRH";
  int times;
  int start;
  string res;
  int modN;

  /// solve ==========================
  auto xs = recurrence!("(a[n-1] + (a[n-1] - a[n-2])*2)")(1, 6);
  foreach(x; xs){
    if(x > n) break;
    start = x;
    times += 1;
  }
  modN = (n - start) / (2^^(times-1));
  res = names[modN].to!string;
  return res;
}

/// unittest -------------------
unittest{
  assert( solve(1) == "S" );
  assert( solve(6) == "S" );
  assert( solve(1802) == "P" );
  writeln("---pass ---");
}

/// main ====================
void main(){
  foreach(i; 1..25){
    writeln(i, " ", solve(i));
  }
}

import std.stdio;
import std.string;
import std.algorithm;
import core.stdc.stdio;
import std.bigint;
import std.format;
import std.math;

string readline()
{
	string result = readln();
	if (result[result.length - 1] == '\n') result.length--;
	return result;
}

int main(string[] argv)
{
	long n;
	scanf("%d", &n); n--;
	long pm = 0;
	long m = 1;
	while (pm + m * 5 <= n)
	{
		pm = pm + m * 5;
		m++;
	}
	double l = cast(double)(n - pm) / cast(double)(m);

	string[long] names;
	names[0] = "Sheldon";
	names[1] = "Leonard";
	names[2] = "Penny";
	names[3] = "Rajesh";
	names[4] = "Howard";
	write(names[cast(long)round(l)]);
	return 0;
}


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 n = cin.readInt;
                int[] arr = new int[n];
                foreach (ref i; arr) i = cin.readInt;
                int count = 0;
                for (int i = 0; i < n; i++) {
                        if (arr[i] == 1) count++;
                        if (arr[i] == 0) if (i - 1 >= 0 && i + 1 < n && arr[i - 1] == 1 && arr[i + 1] == 1)
                                count++;
                }
                writeln(count);
        }
}

import std.stdio;
import std.conv;
import std.array;
import std.algorithm;
void main()
{
	int num;
	readf("%d\n",&num);
	string[]s=split(readln());
	int[]a;
	for(int i=0;i<s.length;i++)a~=to!int(s[i]);
	int ans=0;
	for(int i=1;i<a.length-1;i++)if(a[i-1]==1&&a[i+1]==1)a[i]=1;
	for(int i=0;i<a.length;i++)ans+=a[i];
	writeln(ans);
	readln();
}


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

void main ()
{
	long a, b, c, d;
	while (readf !(" %s %s %s %s") (a, b, c, d) > 0)
	{
		auto z = [a, b, c];
		sort (z);
		a = z[0];
		b = z[1];
		c = z[2];
		long res = 0;
		res += d - min (b - a, d);
		res += d - min (c - b, d);
		writeln (res);
	}
}

module main;

import std.stdio;
import std.container.array;
import std.algorithm.sorting;

void main(string[] args){
    int[] arr = [2:0];
    for (int i = 0; i < 3; i++) {
        scanf("%d", &arr[i]);
    }
    arr.sort();
    int d;
    scanf("%d", &d);
    int ans;
    int inc = d - (arr[1] - arr[0]);
    if (inc > 0) {
        ans += inc;
    }
    inc = d - (arr[2] - arr[1]);
    if (inc > 0) {
        ans += inc;
    }
    printf("%d", ans);
}

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; }
long lcm(long x, long y) { return x * y / gcd(x, y); }

long mod = 10^^9 + 7;
//long mod = 998244353;
//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 abc = new long[](3);
	foreach (i; 0..3)
	{
		abc[i] = RD;
	}
	auto d = RD;

	abc.sort();
	long ans = max(0, d - (abc[1] - abc[0])) + max(0, d - (abc[2] - abc[1]));

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


import std.stdio;
import std.algorithm;

void main()
{
	long x1, x2, y1, y2;

	scanf("%lld%lld%lld%lld", &x1, &y1, &x2, &y2);

	long dx = (x2 - x1) / 2;
	long dy = (y2 - y1) / 2;
	printf("%lld\n", (dx + 1) * (dy + 1) + dx * dy);
}


//DMD64 D Compiler 2.072.2
import std.stdio;
void main(){
    int a,b,c,d;
    readf("%d %d",&a,&b);
    if(a<1&&b>0){write("Impossible");return;}
    c=a;
    if(b-a>0){c+=b-a;}
    d=a;
    if(b>0){d+=b-1;}
    write(c,' ',d);
}

import std.stdio;void main(){int a,b;readf("%d %d",&a,&b);if(a<1&&b>0){write("Impossible");return;}write(a>b?a:b,' ',b!=0?a+b-1:a);}

//rextester.com:dmd64 2.072.2--codeforces.com:dmd32 2.071.2
import std.stdio;
void main(){
    int a,b;readf("%d %d",&a,&b);
    if(a<1&&b>0){write("Impossible");return;}
    write(a>b?a:b,' ',b!=0?a+b-1:a);
}

//DMD64 2.072.2 | RexTester.Com & DMD32 2.079.0 | CodeForces.Com
import std.stdio;
void main() {
    int grown_ups, children;
    readf("%d %d", &grown_ups, &children);

    if (grown_ups < 1 && children > 0) {
        write("Impossible");
        return;
    }

    write(grown_ups > children ? grown_ups : children, ' ', children != 0 ? grown_ups + children - 1 : grown_ups);
}


import std.stdio, std.bigint, std.string;

BigInt gcd(BigInt a, BigInt b) {
	return b ? gcd(b, a % b) : a;
}

void main() {

	auto l = BigInt (readln(' ').strip);
	auto r = BigInt (readln.strip);

	foreach (i; l .. r + 1)
		foreach (j; i + 1 .. r + 1)
			foreach (k; j + 1 .. r + 1)
			if (gcd(i, j) == 1 && gcd(j, k) == 1 && gcd(i, k) != 1) {
				writefln("%d %d %d", i, j, k);
				return;
			}

	writeln("-1");
}

//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(){
    ulong l,r;
    readf!"%d %d"(l,r);
    r++;
    readln;
    foreach(a;l..r)
        foreach(b;a+1..r)
            foreach(c;b+1..r)
                if(gcd(a,b)==1 && gcd(b,c)==1 && gcd(a,c)!=1){
                    writefln!"%d %d %d"(a,b,c);
                    return;
                }
    puts("-1");
}

import std.stdio;

long GCD(long a, long b) {
	return b ? GCD(b, a % b) : a;
}

void main() {

	long l, r;

	readf(" %s %s", &l, &r);

	foreach (i; l .. r + 1)
		foreach (j; i + 1 .. r + 1)
			foreach (k; j + 1 .. r + 1)
			if (GCD(i, j) == 1 && GCD(j, k) == 1 && GCD(i, k) != 1) {
				writefln("%d %d %d", i, j, k);
				return;
			}

	writeln("-1");
}

import std.stdio;
import std.numeric;

void main() {

	long l, r;

	readf(" %s %s", &l, &r);

	foreach (i; l .. r + 1)
		foreach (j; i + 1 .. r + 1)
			foreach (k; j + 1 .. r + 1)
			if (gcd(i, j) == 1 && gcd(j, k) == 1 && gcd(i, k) != 1) {
				writefln("%d %d %d", i, j, k);
				return;
			}

	writeln("-1");
}

import std.stdio;

void main() {

	long l, r;

	readf(" %s %s", &l, &r);

	if (r - l < 2) {
		writeln(-1);
		return;
	}

	if (!(l % 2)) {
		writefln("%s %s %s", l, l + 1, l + 2);
		return;
	}

	if (r - l > 2){
		writefln("%s %s %s", l + 1, l + 2, l + 3);
		return;
	}

	writeln(-1);
}

import std.stdio;

long GCD(long a, long b) {
	return b ? GCD(b, a % b) : a;
}

void main() {

	long l, r;

	readf(" %s %s", &l, &r);

	foreach (i; l .. r + 1) {
		foreach (j; i .. r + 1)
			foreach (k; j .. r + 1)
			if (GCD(i, j) == 1 && GCD(j, k) == 1 && GCD(i, k) != 1) {
					writefln("%d %d %d", i, j, k);
					return;
				}
	}

	writeln("-1");
}

import std.stdio;

void main() {

	long l, r;

	readf(" %s %s", &l, &r);

	if (r - l + 1 < 3) {
		writeln(-1);
		return;
	}

	if (l % 2 == 0) {
		writefln("%s %s %s", l, l + 1, l + 2);
		return;
	}

	if (r - l + 1 > 3){
		writefln("%s %s %s", l + 1, l + 2, l + 3);
		return;
	}

	writeln(-1);
}

import std.stdio;

long GCD(long a, long b) {
	return b ? GCD(b, a % b) : a;
}

void main() {

	long l, r;

	readf(" %s %s", &l, &r);

	foreach (i; l .. r + 1) {
		foreach (j; i .. r + 1)
			foreach (k; j .. r + 1)
				if (j % i != 0 && k % j != 0 && GCD(i, k) != 1) {
					writefln("%d %d %d", i, j, k);
					return;
				}
	}

	writeln("-1");
}

import std.stdio;

void main() {

	long l, r;

	readf(" %s %s", &l, &r);

	foreach (i; l .. r + 1) {
		foreach (j; i .. r + 1)
			foreach (k; j .. r + 1)
				if (j % i != 0 && k % j != 0) {
					writefln("%d %d %d", i, j, k);
					return;
				}
	}

	writeln("-1");
}


import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;

void main()
{
    int n;
    readf( "%s\n", &n );
    auto a = readln.splitter.map!( to!int ).array;
    a.sort;
    auto ans = n*n;
    foreach ( int shift; 1..3 ) {
        int cur = 0;
        foreach ( int idx, int e; a ) {
            cur += abs( e - ( 2*idx + shift ) );
        }
        ans = min( ans, cur );
    }
    writeln( ans );
}

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;
import std.numeric;
import std.bigint;

void main()
{
	int n = readln.chomp.to!int;
	int[] p = readln.chomp.split.map!(to!int).array;
	std.algorithm.sort(p);
	int ans = int.max;
	for (int i = 1; i <= 2; ++i) {
		int sum = 0;
		foreach (int j, int t; p) {
			sum += abs(j * 2 + i - t);
		}
		ans = min(ans, sum);
	}
	ans.writeln;
}

void tie(R, Args...)(R arr, ref Args args)
		if (isRandomAccessRange!R || isArray!R)
in
{
	assert (arr.length == args.length);
}
body
{
	foreach (i, ref v; args) {
		alias T = typeof(v);
		v = arr[i].to!T;
	}
}

void verbose(Args...)(in Args args)
{
	stderr.write("[");
	foreach (i, ref v; args) {
		if (i) stderr.write(", ");
		stderr.write(v);
	}
	stderr.writeln("]");
}

import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;

void main()
{
    int n;
    readf( "%s\n", &n );
    auto a = readln.splitter.map!( to!int ).array;
    a.sort;
    auto ans = n*n;
    foreach ( int shift; 1..3 ) {
        int cur = 0;
        foreach ( int idx, int e; a) {
            cur += abs( e - ( 2*idx + shift ) );
        }
        ans = min( ans, cur );
    }
    writeln(ans);
}

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;
import std.numeric;
import std.bigint;

void main()
{
	int n = readln.chomp.to!int;
	int[] p = readln.chomp.split.map!(to!int).array;
	int ans = int.max;
	for (int i = 1; i <= 2; ++i) {
		int sum = 0;
		foreach (int j, int t; p) {
			sum += abs(j * 2 + i - t);
		}
		ans = min(ans, sum);
	}
	ans.writeln;
}

void tie(R, Args...)(R arr, ref Args args)
		if (isRandomAccessRange!R || isArray!R)
in
{
	assert (arr.length == args.length);
}
body
{
	foreach (i, ref v; args) {
		alias T = typeof(v);
		v = arr[i].to!T;
	}
}

void verbose(Args...)(in Args args)
{
	stderr.write("[");
	foreach (i, ref v; args) {
		if (i) stderr.write(", ");
		stderr.write(v);
	}
	stderr.writeln("]");
}

import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;

void main()
{
    int n;
    readf( "%s\n", &n );
    auto a = readln.splitter.map!( to!int ).array;
    auto ans = n*n;
    foreach ( int shift; 1..3 ) {
        int cur = 0;
        foreach ( int idx, int e; a) {
            cur += abs( e - ( 2*idx + shift ) );
        }
        ans = min( ans, cur );
    }
    writeln(ans);
}


#!/usr/bin/env dub
/+ dub.sdl:
    name "B"
+/

import std.array;
import std.algorithm;
import std.algorithm.iteration;
import std.conv;
import std.math;
import std.stdio;
import std.string;

void main()
{
    long[] beauty;
    foreach (i; 1..15) {
        beauty ~= (2^^i - 1) * (2 ^^ (i-1));
    }
    beauty.reverse();

    debug {
        writeln(beauty);
    }

    long N = to!long(readln().strip());

    foreach (b; beauty) {
        if (N % b == 0) {
            writeln(b);
            return;
        }
    }

}

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

immutable inf = 10^^9 + 7;

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

    long ans = 1;

    foreach (k ; 1 .. 30) {
        long bn = 1L * (2L^^k - 1) * (2L^^(k - 1));
        if (k > bn) break;
        if (n % bn == 0) {
            ans = max(ans, bn);
        }
    }

    writeln(ans);
}

struct UnionFind {
    private {
        int N;
        int[] p;
        int[] rank;
    }

    this (int n) {
        N = n;
        p = iota(N).array;
        rank = new int[](N);
    }

    int find_root(int x) {
        if (p[x] != x) {
            p[x] = find_root(p[x]);
        }

        return p[x];
    }

    bool same(int x, int y) {
        return find_root(x) == find_root(y);
    }

    void unite(int x, int y) {
        int u = find_root(x), v = find_root(y);

        if (u == v) return;

        if (rank[u] < rank[v]) {
            p[u] = v;
        }
        else {
            p[v] = u;

            if (rank[u] == rank[v]) {
                rank[u]++;
            }
        }
    }
}

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);
        }
    }
}

struct Queue(T) {
    private {
        int N, head, tail;
        T[] data;
    }

    this(int n) {
        N = n + 1;
        data = new T[](N);
    }

    bool empty() {
        return head == tail;
    }

    bool full() {
        return (tail + 1) % N == head;
    }

    T front() {
        return data[head];
    }

    void push(T x) {
        assert(!full);
        data[tail++] = x;
        tail %= N;
    }

    void pop() {
        assert(!empty);
        head = (head + 1) % N;
    }

    void clear() {
        head = tail = 0;
    }
}


import std.stdio, std.string, std.algorithm;
import std.conv, std.array;
import std.container;
import std.typecons;

alias sum = reduce!"a + b";

void main() {
    int n, d; readf("%d %d\n", &n, &d);
    int[] a = stdin.readln.split.map!(to!int).array;
    int m; readf("%d\n", &m);
    int ans = a.sort[0 .. min(m, $)].sum - d * max(m - n, 0);
    ans.writeln;
}

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

void main() {
  auto input = new int[][2];
  foreach (ref elem; input) {
    elem = readln.chomp.split.map!(to!int).array;
  }
  int n = input[0][0];
  int d = input[0][1];
  int[] a = input[1].sort!("a < b").array;
  int m = readln.chomp.to!int;

  int profit = 0;

  if (a.length >= m) {
    profit += reduce!("a + b")(0, a[0 .. m]);
  } else {
    profit += reduce!("a + b")(0, a);
    profit -= (m - a.length) * d;
  }

  profit.writeln;
}


module main;
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,core.stdc.stdio : freopen;
import std.numeric: fft,Fft,gcd,inverseFft;alias big=BigInt;alias pair(X,Y)=Tuple!(X,"fi",Y,"se");
alias lint=long;private const int mod=1_000_000_007;
alias pii=pair!(int,int);alias pll=pair!(long,long);alias mp=make_pair;alias gcd=std.numeric.gcd;
private
{
	pure nothrow
	{
		T lcm (T)(auto ref T a,auto ref T b){return a/gcd(a,b)*b;}
		pair!(X,Y) make_pair(X,Y)(in X x_,in Y y_){return tuple!(X,"fi",Y,"se")(x_,y_);}
		big gcd(big a,big b){while(b){a%=b;swap(a,b);}return a;}
		@property X sqr(X)(in X a_) {return a_*a_;}
		@property X cub(X)(in X a_) {return a_*a_*a_;}
		int sz(T)(T a) if(hasLength!T){return cast(int)a.length;}
		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;
		}
		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;
		}
		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;
		}
		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;
		}
	}
	void putarr(X)(in X a,in char ch=' ') if(isInputRange!X && !isInputRange!(ElementEncodingType!X))
	{foreach(const ref i;a)write(i,ch);}
	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;
		}
	}
	bool getarr(X)(X a,in size_t n)
	{bool b=1; foreach(ref i;a[0..n])b=input(&i);return b;}
	bool input(T...)(auto 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;
	}
	bool read(T...)(auto 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;
	}
	nothrow auto inf(in char* name) {return freopen(name,"r",core.stdc.stdio.stdin);}
	nothrow auto ouf(in char* name) {return freopen(name,"w",core.stdc.stdio.stdout);}
	@property auto arread(T)(){return readln.splitter.map!(to!(T)).array;}
	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--------------------------
private
{

}
void main()
{
	version(home)
	{
		assert(freopen("input.txt","r",core.stdc.stdio.stdin));
		assert(freopen("output.txt","w",core.stdc.stdio.stdout));
	}
	int n,x,y,w,h;
loop:while(read(h,w,x,y,n))
	{
		auto a=arread!int;
		sort(a);
		a=a[max(0,sz(a)-34)..$];
		reverse(a);
		auto dp=new int[10^^5+1],d=new int[10^^5+1];
		dp[x]=d[x]=y;
		foreach(i;0..a.length)
		{
			foreach(j;0..dp.length)
			{
				if((j>=w && dp[j]>=h) || (j>=h && dp[j]>=w))
				{
					writeln(i);
					continue loop;
				}
			}
			//d[]=dp[];
			foreach(j;0..dp.length)
			{
				if(dp[j]!=0)
				{
					if(1L*j*a[i]<=10^^5)d[j*a[i]]=max(d[j*a[i]],dp[j]);
					else d[10^^5]=max(d[10^^5],dp[j]);
					if(1L*dp[j]*a[i]<=10^^5)d[j]=max(dp[j]*a[i],d[j]);
					else d[j]=10^^5;
				}
			}
			dp[]=d[];
		}
		foreach(j;0..dp.length)
		{
			if((j>=w && dp[j]>=h) || (j>=h && dp[j]>=w))
			{
				writeln(a.length);
				continue loop;
			}
		}
		writeln(-1);
	}
}

import core.bitop;
import core.checkedint;
import core.simd;
import core.stdc.stdlib;
import core.stdc.string;
import std.algorithm;
import std.array;
import std.ascii;
import std.bigint;
import std.bitmanip;
import std.complex;
import std.container;
import std.conv;
import std.datetime;
import std.format;
import std.functional;
import std.math;
import std.meta;
import std.numeric;
import std.random;
import std.range;
import std.regex;
import std.stdio;
import std.string;
import std.typecons;
import std.variant;

__gshared:

alias BitSet(size_t n) = size_t[(n + size_t.sizeof * 8 - 1) / (size_t.sizeof * 8)];

auto getAddrTuple() {
    return tuple();
}

auto getAddrTuple(T, U...)(ref T head, ref U tail) {
    return tuple(&head, getAddrTuple(tail).expand);
}

bool read(T...)(ref T vars) if (vars.length > 0) {
    return readf(' ' ~ replicate("%s ", vars.length), getAddrTuple(vars).expand) == vars.length;
}

T[ ] allocate(T)(size_t n) {
    return (cast(T*)malloc(n * T.sizeof))[0 .. n];
}

auto pairwise(R)(R range) if (isForwardRange!R) {
    return lockstep(range, dropOne(range));
}

int ih, iw, n;
int[10^^5] _exts;
int[ ] exts;
uint[Tuple!(int, int, int)] dp;

uint dyn(int pos, int curh, int curw) {
    if (curh >= ih && curw >= iw)
        return pos;
    if (pos == n)
        return uint.max;
    if (auto p = tuple(pos, curh, curw) in dp)
        return *p;
    uint result = uint.max;
    bool overflow;
    if (curh < ih) {
        int nexth = muls(curh, exts[pos], overflow);
        if (overflow) {
            nexth = int.max;
            overflow = false;
        }
        result = dyn(pos + 1, nexth, curw);
    }
    if (curw < iw) {
        int nextw = muls(curw, exts[pos], overflow);
        if (overflow)
            nextw = int.max;
        result = min(result, dyn(pos + 1, curh, nextw));
    }
    dp[tuple(pos, curh, curw)] = result;
    return result;
}

uint solve(int oh, int ow) {
    dp = null;
    return dyn(0, oh, ow);
}

void main() {
    int oh, ow;
    while (read(ih, iw, oh, ow, n)) {
        exts = _exts[0 .. n];
        foreach (ref x; exts)
            read(x);
        exts.sort!`a > b`;
        writeln(cast(int)min(solve(oh, ow), solve(ow, oh)));
    }
}

module main;
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,core.stdc.stdio : freopen;
import std.numeric: fft,Fft,gcd,inverseFft;alias big=BigInt;alias pair(X,Y)=Tuple!(X,"fi",Y,"se");
alias lint=long;private const int mod=1_000_000_007;
alias pii=pair!(int,int);alias pll=pair!(long,long);alias mp=make_pair;alias gcd=std.numeric.gcd;
private
{
	pure nothrow
	{
		T lcm (T)(auto ref T a,auto ref T b){return a/gcd(a,b)*b;}
		pair!(X,Y) make_pair(X,Y)(in X x_,in Y y_){return tuple!(X,"fi",Y,"se")(x_,y_);}
		big gcd(big a,big b){while(b){a%=b;swap(a,b);}return a;}
		@property X sqr(X)(in X a_) {return a_*a_;}
		@property X cub(X)(in X a_) {return a_*a_*a_;}
		int sz(T)(T a) if(hasLength!T){return cast(int)a.length;}
		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;
		}
		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;
		}
		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;
		}
		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;
		}
	}
	void putarr(X)(in X a,in char ch=' ') if(isInputRange!X && !isInputRange!(ElementEncodingType!X))
	{foreach(const ref i;a)write(i,ch);}
	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;
		}
	}
	bool getarr(X)(X a,in size_t n)
	{bool b=1; foreach(ref i;a[0..n])b=input(&i);return b;}
	bool input(T...)(auto 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;
	}
	bool read(T...)(auto 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;
	}
	nothrow auto inf(in char* name) {return freopen(name,"r",core.stdc.stdio.stdin);}
	nothrow auto ouf(in char* name) {return freopen(name,"w",core.stdc.stdio.stdout);}
	@property auto arread(T)(){return readln.splitter.map!(to!(T)).array;}
	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--------------------------
private
{

}
void main()
{
	version(home)
	{
		assert(freopen("input.txt","r",core.stdc.stdio.stdin));
		assert(freopen("output.txt","w",core.stdc.stdio.stdout));
	}
	int n,x,y,w,h;
loop:while(read(h,w,x,y,n))
	{
		auto a=arread!int;
		sort(a);
		a=a[max(0,sz(a)-34)..$];
		reverse(a);
		auto dp=new lint[10^^5+1],d=new long[10^^5+1];
		dp[x]=d[x]=y;
		foreach(i;0..a.length)
		{
			foreach(j;0..dp.length)
			{
				if((j>=w && dp[j]>=h) || (j>=h && dp[j]>=w))
				{
					writeln(i);
					continue loop;
				}
			}
			//d[]=dp[];
			foreach(j;0..dp.length)
			{
				if(dp[j]!=0)
				{
					if(1L*j*a[i]<=10^^5)d[j*a[i]]=max(d[j*a[i]],dp[j]);
					if(1L*dp[j]*a[i]<=10^^5)d[j]=max(dp[j]*a[i],d[j]);
				}
			}
			dp[]=d[];
		}
		foreach(j;0..dp.length)
		{
			if((j>=w && dp[j]>=h) || (j>=h && dp[j]>=w))
			{
				writeln(a.length);
				continue loop;
			}
		}
		writeln(-1);
	}
}


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

void main() {
    int n = readln.chomp.to!int;
    int[][] diploma;
    for (int i = 0; i < 3; i++) {
        diploma ~= readln.chomp.split.map!(to!int).array;
    }

    int dip_1 = min(diploma[0][1], n - (diploma[1][0] + diploma[2][0]));
    n -= dip_1;
    int dip_2 = min(diploma[1][1], n - diploma[2][0]);
    int dip_3 = n - dip_2;
    writeln(dip_1, " ", dip_2, " ", dip_3);
}

import std.stdio;
import std.c.stdio;
import std.math;
import std.algorithm;
import std.conv;
import std.string;
import std.array;

void main() {
  int n = readln().strip.to!int;
  int x, y, z, u, v, w;
  scanf("%d%d%d%d%d%d", &x, &u, &y, &v, &z, &w);
  n -= x + y + z;
  int d, e, f;
  d = min(n, u - x);
  n -= d;
  x += d;

  e = min(n, v - y);
  n -= e;
  y += e;

  f = min(n, w - z);
  n -= f;
  z += f;

  writeln(x, ' ', y, ' ', z);
}


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--) {
                int n = cin.read_int;
                int[] arr = new int[n];

                int ans = 0;
                for (int i = 0; i < n; i++) {
                        arr[i] = cin.read_int;
                        if (arr[0] > 15) {
                                writeln(15);
                                return;
                        }
                        if (i != 0) {
                                if (arr[i] - arr[i - 1] > 15) {
                                        writeln(arr[i - 1] + 15);
                                        return;
                                }
                        }
                }
                if (arr[n - 1] + 15 >= 90) {
                        writeln(90);
                } else writeln(arr[n - 1] + 15);
        }
}

import std.stdio;
import std.algorithm;

const int BORING = 15;
const int MATCH = 90;

void main()
{
	int n;
	int last = 0;

	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		int x;

		scanf("%d", &x);

		if ((x - 1) - last >= BORING) {
			printf("%d\n", last + BORING);
			return;
		}

		last = x;
	}

	printf("%d\n", min(last + BORING, MATCH));
}

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--) {
                int n = cin.read_int;
                int[] arr = new int[n];

                int ans = 0;
                for (int i = 0; i < n; i++) {
                        arr[i] = cin.read_int;
                        if (arr[0] > 15) {
                                writeln(15);
                                return;
                        }
                        if (i != 0) {
                                if (arr[i] - arr[i - 1] > 15) {
                                        writeln(arr[i - 1] + 15);
                                        return;
                                }
                        }
                }
                writeln(90);
        }
}


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

void main() {

	int n = readln.strip.to!int;
	string s = readln.strip;

	foreach (from; 0 .. n)
		foreach (jump; 1 .. n) {
			bool ok;
			foreach (i; 0 .. 5) {
				int pos = from + i * jump;
				if (pos >= n || s[pos] != '*') {
					ok = true;
					break;
				}
			}
			if (!ok)
				return `yes`.write;
		}

	`no`.write;
}

import std.stdio;
import std.range;
import std.array;

T read(T)()
{
    T t;
    readf(" %s", &t);
    return t;
}

int main(string[] args)
{
    auto T = read!int;
    readln;
    auto arr = readln;
    arr = arr[0..T];
    arr ~= repeat('.', T).array;

    for (int i = 0; i < T; i++)
    {
        for (int j = 1; j < T; j++)
        {
            if (
                arr[i + j*0] == '*' &&
                arr[i + j*1] == '*' &&
                arr[i + j*2] == '*' &&
                arr[i + j*3] == '*' &&
                arr[i + j*4] == '*')
            {
                writeln("yes");
                return 0;
            }
        }
    }

    writeln("no");

    return 0;
}

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

void main() {

	int n = readln.strip.to!int;
	string s = readln.strip;

	foreach (from; 0 .. n) {
		if (s[from] != '.')
		foreach (jump; 1 .. n) {
			bool ok;
			foreach (i; 1 .. 5) {
				int pos = from + i * jump;
				if (pos >= n || s[pos] != '*') {
					ok = true;
					break;
				}
			}
			if (!ok)
				return write("yes");
		}
	}

	write("no");
}

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

void main() {

	int n = readln.strip.to!int;
	string s = readln.strip;

	foreach (from; 0 .. n)
	foreach (jump; 1 .. n) {
		bool ok;
		foreach (i; 0 .. 5) {
			int pos = from + i * jump;
			if (pos >= n || s[pos] != '*') {
				ok = true;
				break;
			}
		}
		if (!ok)
			return "yes".write;
	}

	"no".write;
}

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

void main() {

	int n = readln.strip.to!int;
	string s = readln.strip;

	int[] idx;
	foreach (i, e; s)
		if (e == '*')
			idx ~= i;

	foreach (from; idx) {
		foreach (jump; 1 .. n) {
			bool ok;
			foreach (i; 1 .. 5) {
				int pos = from + i * jump;
				if (pos >= n || s[pos] != '*') {
					ok = true;
					break;
				}
			}
			if (!ok)
				return write("yes");
		}
	}

	write("no");
}

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

void main() {

	int n = readln.strip.to!int;
	string s = readln.strip;

	foreach (from; 0 .. n) {
		if (s[from] != '.')
		foreach (jump; 1 .. n) {
			bool ok;
			foreach (i; 0 .. 5) {
				int pos = from + i * jump;
				if (pos >= n || s[pos] != '*') {
					ok = true;
					break;
				}
			}
			if (!ok)
				return write("yes");
		}
	}

	write("no");
}

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

void main() {

	int n = readln.strip.to!int;
	string s = readln.strip;

	foreach (from; 0 .. n)
	foreach (jump; 1 .. n) {
		bool ok;
		foreach (i; 0 .. 5) {
			int pos = from + i * jump;
			if (pos >= n || s[pos] != '*') {
				ok = true;
				break;
			}
		}
		if (!ok)
			return write("yes");
	}

	write("no");
}

import std.algorithm, std.conv, std.range, std.stdio, std.string;
void main() {
	auto n = readln.strip.to!int, s = readln.strip;
	writeln (iota (1, n).any !(d => iota (d).any !(p =>
		s.drop (p).stride (d).canFind ("*****"))) ? "yes" : "no");
}

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 ()
{
	int n;
	while (readf (" %s ", &n) > 0)
	{
		auto s = readln ().strip ();
		bool ok = false;
		foreach (d; 1..n)
		{
			foreach (p; 0..n)
			{
				if (p + d * 4 < n)
				{
					if (s.drop (p)
					    .stride (d)
					    .takeExactly (5)
					    .all !(q{a == '*'}))
					{
						ok = true;
					}
				}
			}
		}
		writeln (ok ? "yes" : "no");
	}
}

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

void main() {
	readln;
	auto s = readln.strip;

	if(s.count('*') >= 5) {
		while(true) {
			auto idx = cast(int)s.countUntil('*');
			if(idx < 0) break;

			foreach(k; 1..26) {
				ubyte c;

				for(uint i = idx; i < s.length && s[i] == '*'; c++, i += k) {}

				if(c >= 5) return `yes`.write;
			}

			s = s[idx + 1..$];
		}
	}

	`no`.write;
}

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

void main() {
	readln;
	auto s = readln.strip;

	if(s.count('*') >= 5) {
		while(true) {
			auto idx = cast(int)s.countUntil('*');
			if(idx < 0) break;

			foreach(k; 1..21) {
				ubyte c;

				for(uint i = idx; i < s.length && s[i] == '*'; c++, i += k) {}

				if(c >= 5) return `yes`.write;
			}

			s = s[idx + 1..$];
		}
	}

	`no`.write;
}

import std.stdio;

void main() {

	writeln(__VERSION__);
}

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

void main() {

	int n = readln.strip.to!int;
	string s = readln.strip;

	foreach (from; 0 .. n) {
		if (s[from] != '.')
		foreach (jump; 1 .. n) {
			bool ok;
			foreach (i; 0 .. 5) {
				int pos = from + i * jump;
				if (pos >= n || s[pos] != '*') {
					writeln("break");
					ok = true;
					break;
				}
			}
			if (!ok)
				return write("yes");
		}
	}

	write("no");
}


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

void main()
{
    auto s = readln.chomp;
    auto d = s.length.iota.retro.dropOne.map!(
         a => {
            string[] d = s.slide(a+1).map!"a.text".array;
            d.sort;
            return d.group.maxElement!"a[1]"; }()
    ).find!"a[1]>b[1]"(tuple(1,1));
    writeln(d.length>0?d[0][0].length:0);
}

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 read_string() {
                while (tk.empty)
                        tk = readln.split;
                auto tkt = tk.front;
                tk.popFront;
                return tkt;
        }
        int read_int() {
                return read_string.to!int;
        }
        double read_double() {
                return read_string.to!double;
        }
}

int count_substr(char[] s, char[] sample) {
        int count = 0;
        for (int i = 0; i < s.length - sample.length + 1; i++) {
                if (s[i..i + sample.length] == sample) {
                        count++;
                }
        }
        return count;
}

void main() {
        IO cin;
        int t = 1;
        // t = cin.read_int;
        while (t--) {
                char[] s = cin.read_string.dup;

                int l = s.length;
                int maxx = -999;
                for (int i = l - 1; i >= 1; i--) {
                        for (int j = 0; j < l - i + 1; j++) {
                                int c = count_substr(s, s[j..j + i]);
                                if (c >= 2) {
                                        writeln(s[j..j + i].length);
                                        return;
                                }
                        }
                }
                writeln(0);
        }
}

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 read_string() {
                while (tk.empty)
                        tk = readln.split;
                auto tkt = tk.front;
                tk.popFront;
                return tkt;
        }
        int read_int() {
                return read_string.to!int;
        }
        double read_double() {
                return read_string.to!double;
        }
}

int count_substr(char[] s, char[] sample) {
        int count = 0;
        for (int i = 0; i < s.length - sample.length + 1; i++) {
                if (s[i..i + sample.length] == sample) {
                        count++;
                }
        }
        return count;
}

void main() {
        IO cin;
        int t = 1;
        // t = cin.read_int;
        while (t--) {
                char[] s = cin.read_string.dup;

                int l = s.length;
                int maxx = -999;
                for (int i = l - 1; i >= 1; i--) {
                        for (int j = 0; j < l - i + 1; j++) {
                                int c = count_substr(s, s[j..j + i]);
                                if (c >= 2) {
                                        writeln(i);
                                        return;
                                }
                        }
                }
                writeln(0);
        }
}


import std.stdio
    , std.typecons
    , std.traits
    , std.algorithm;

T modulus(T)(auto ref T val) {
    import std.conv: to;
    return (val > 0.to!T
            ? val
            : -val);
}

void main() {

    long n;

    readf("%s\n", &n);
    //uint count;
    while(true) {
        //count.writeln;
        if(n >= 0) {
            writeln(n);
            return;
        }

        auto n2 = n.modulus % 100;

        if(n2 % 10 < n2 / 10) {
            const t = n.modulus / 100 * 10 + n2 % 10;
            writeln((t != 0 ? "-" : ""), t);
        }
        else
        {

            const t = n.modulus / 100 * 10 + n2 / 10;
            writeln((t != 0 ? "-" : ""), t);
       }

        //readf("%s\n", &n);
        //++count;
        break;
    }

}

import std.stdio: readln, writeln;
import std.string: strip;
import std.conv: to;
import std.algorithm: max;

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

void main(string[] args) {
    char[] buffer = strip(readln()).dup;
    int account = to!int(buffer);

    if (account < 0 && buffer.length > 2) {
        int var1 = to!int(buffer[0..$-1]);
        int var2 = to!int(buffer[0..$-2] ~ buffer[$-1..$]);

        if(var1 > account || var2 > account)
            writeln(max(var1, var2));
    } else {
        writeln(account);
    }
}

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

void main() {
    //stdin.open("input.txt", "r");
    //stdout.open("output.txt", "w");
    string num = strip(readln());
    if (num[0] == '-') {
        int a = to!int(num[0..$-1]);
        int b = to!int(num[0..$-2] ~ num[$-1..$]);
        writeln(a > b ? a : b);
    } else {
        writeln(num);
    }
}

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

// main================
void main(){
  auto moneyStr = readln.chomp.dup;
  if(moneyStr.to!int >= 0){ writeln(moneyStr.to!int); }
  else{
    auto a = moneyStr[0..$-1].to!int;
    auto b = (moneyStr[0..$-2] ~ moneyStr[$-1]).to!int;
    max(a, b).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;
        }
}

int solve(string s) {
        if (s.to!int > 0) return s.to!int;
        else {
                if (s.to!int > -10) return s.to!int;
                else {
                        char[] s1 = s.dup;
                        int n = s1.length;
                        if (s1[n - 1] < s[n - 2]) {
                                s1 = s1.remove(n - 2);
                        } else s1 = s1.remove(n - 1);
                        return s1.to!int;
                }
        }
}
void main() {
        IO cin;
        int t = 1;
        // t = cin.readInt;
        while (t--) {
                string s = cin.readString;
                writeln(solve(s));
        }
}

import std.stdio
    , std.typecons
    , std.traits
    , std.algorithm;

T mod(T)(auto ref T val) {
    import std.conv: to;
    return (val > 0.to!T
            ? val
            : -val);
}

void main() {

    long n;

    readf("%s\n", &n);

    while(true) {
        if(n >= 0) {
            writeln(n);
            return;
        }

        auto n2 = n.mod % 100;

        if(n2 % 10 < n2 / 10) {
            const t = n.mod / 100 * 10 + n2 % 10;
            writeln((t != 0 ? "-" : ""), t);
        }
        else
        {

            const t = n.mod / 100 * 10 + n2 / 10;
            writeln((t != 0 ? "-" : ""), t);
       }
        break;
    }

}

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

int main(string[] argv)
{
	long n;
	scanf("%lld", &n);
	long a = n % 100;
	long b = (n / 100) * 10;
	long n1 = b + (a % 10);
	long n2 = b + ((a / 10) % 10);
	write(n > n1 ? n : n1 > n2 ? n1 : n2);
	return 0;
}

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

string[] tokens;
int tokenId = 0;
string readToken() { for (; tokenId == tokens.length; ) tokens = readln.split, tokenId = 0; return tokens[tokenId++]; }
int readInt() { return to!int(readToken); }
long readLong() { return to!long(readToken); }
real readReal() { return to!real(readToken); }

int del(int a) {
	int temp = abs(a);
	int first = temp / 10;
	int second = (temp / 100) * 10 + temp % 10;
	first *= -1;
	second *= -1;
	if(first < second) return second;
	return first;
}

void main () {
	int a = readInt();

	if(a >= 0) writeln(a);
	else writeln(del(a));
}

//ahmat
import core.stdc.stdio:printf,scanf;
import std.stdio;
import std.string;
import std.container;
import std.array;
import std.range;
import std.algorithm;
import std.math;
import std.numeric;
import std.conv;
import std.bitmanip;
import core.bitop;
int sz(Range)(in Range r){return cast(int)r.length;}
alias rbt=RedBlackTree!int;

void main(){
	int n=readln.chomp.to!int;
	if(n<0){
		writeln(max(n/10,10*(n/100)+n%10));
	}else writeln(n);
}

import std.algorithm;
import std.conv;
import std.stdio;

void main ()
{
    foreach (s; stdin.byLine ())
    {
        writeln (max (to!int (s), to!int (s[0..$ - 1]),
                  to!int (s[0..$ - 2] ~ s[$ - 1])));
    }
}

import std.algorithm, std.stdio;

void main ()
{
	int n;
	readf (" %s", &n);
	writeln (max (n, n / 10, n / 100 * 10 + n % 10));
}

import std.algorithm;
import std.stdio;

void main ()
{
	int n;
	while (readf (" %s", &n) != 0)
	{
		writeln (max (n, n / 10, n / 100 * 10 + n % 10));
	}
}

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

void main ()
{
	string s;
	while ((s = readln ().strip ()) != null)
	{
		if (s[0] == '-')
		{
			writeln (max (to!int (s[0..$ - 1]),
			              to!int (s[0..$ - 2] ~ s[$ - 1])));
		}
		else
		{
			writeln (s);
		}
	}
}

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

void main() {
    string n = readln.chomp;
    if (n.to!long > 0) {
        writeln(n);
    } else {
        if (n[$-2].to!int < n[$-1].to!int) {
            writeln(n[0..$-1].to!long);
        } else {
            writeln((n[0..$-2] ~ n[$-1]).to!long);
        }
    }
}

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

// main================
void main(){
  auto moneyStr = readln.chomp.dup;
  auto a = moneyStr[0..$-1].to!int;
  auto b = (moneyStr[0..$-2] ~ moneyStr[$-1]).to!int;
  max(a, b).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;
        }
}

int solve(string s) {
        if (s.to!int > 0) return s.to!int;
        else {
                if (s.to!int > -10) return s.to!int;
                else {
                        char[] s1 = s.dup;
                        s1 = s1.remove(s1.indexOf(max(s1[s1.length - 1], s1[s1.length - 2])));
                        return s1.to!int;
                }
        }
}
void main() {
        IO cin;
        int t = 1;
        // t = cin.readInt;
        while (t--) {
                string s = cin.readString;
                writeln(solve(s));
        }
}

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;
        }
}

int solve(string s) {
        if (s.to!int > 0) return s.to!int;
        else {
                if (s.to!int > -10) return s.to!int;
                else {
                        char[] s1 = s.dup;
                        reverse(s1);
                        s1 = s1.remove(s1.indexOf(max(s1[s1.length - 1], s1[s1.length - 2])));
                        reverse(s1);
                        return s1.to!int;
                }
        }
}
void main() {
        IO cin;
        int t = 1;
        // t = cin.readInt;
        while (t--) {
                string s = cin.readString;
                writeln(solve(s));
        }
}

import std.stdio
    , std.typecons
    , std.traits
    , std.algorithm;

T modulus(T)(auto ref T val) {
    import std.conv: to;
    return (val > 0.to!T
            ? val
            : -val);
}

void main() {

    long n;

    readf("%s\n", &n);
    //uint count;
    while(true) {
        //count.writeln;
        if(n >= 0) {
            writeln(n);
            return;
        }

        auto n2 = n.modulus % 100;

        if(n2 % 10 < n2 / 10) {
            writeln("-", n.modulus / 100 * 10 + n2 % 10);
        }
        else
        {

            const t = n.modulus / 100 * 10 + n2 / 10;
            writeln((t != 0 ? "-" : ""), n.modulus / 100 * 10 + n2 / 10);
       }

        //readf("%s\n", &n);
        //++count;
        break;
    }

}

import std.stdio
    , std.typecons
    , std.traits
    , std.algorithm;

T modulus(T)(auto ref T val) {
    import std.conv: to;
    return (val > 0.to!T
            ? val
            : -val);
}

void main() {

    long n;

    readf("%s\n", &n);
    //uint count;
    while(true) {
        //count.writeln;
        if(n >= 0) {
            writeln(n);
            return;
        }

        auto n2 = n.modulus % 100;

        if(n2 % 10 < n2 / 10) {
            writeln("-", n.modulus / 100 * 10 + n2 % 10);
        }
        else
        {
            writeln("-", n.modulus / 100 * 10 + n2 / 10);
        }

        //readf("%s\n", &n);
        //++count;
        break;
    }

}

import std.stdio
    , std.typecons
    , std.traits
    , std.algorithm;

T modulus(T)(auto ref T val) {
    import std.conv: to;
    return (val > 0.to!T
            ? val
            : -val);
}

void main() {

    long n;

    readf("%s\n", &n);
    //uint count;
    while(true) {
        //count.writeln;
        if(n >= 0) {
            writeln(n);
            return;
        }

        auto n2 = n.modulus % 100;

        if(n2 % 10 > n2 / 10) {
            writeln("-", n.modulus / 100 * 10 + n2 % 10);
        }
        else
        {
            writeln("-", n.modulus / 100 * 10 + n2 / 10);
        }

        //readf("%s\n", &n);
        //++count;
        break;
    }

}

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

void main() {
    string n = readln.chomp;
    if (n.to!long > 0) {
        writeln(n);
    } else {
        if (n[$-2].to!int < n[$-1].to!int) {
            writeln(n[0..$-1]);
        } else {
            writeln(n[0..$-2], n[$-1]);
        }
    }
}

import std.stdio: readln, writeln;
import std.string: strip;
import std.conv: to;
import std.algorithm: max;

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

void main(string[] args) {
    char[] buffer = strip(readln()).dup;
    int account = to!int(buffer);

    if (account < 0 && buffer.length > 2) {
        int var1 = to!int(buffer[0..$-1]);
        int var2 = to!int(buffer[0..$-2] ~ buffer[$-1..$]);

        if(var1 > account || var2 > account)
            writeln(max(var1, var2));
    }
}


import std.stdio;
import std.array;
import std.algorithm.iteration;

int solve(int n , int m) {
    if (m == n) return 0;
    if (m % n != 0) return -1;
    auto d = m/n;
    auto count = 0;
    if (d%2 != 0 && d%3!=0) return -1;
    while (d%6 == 0) {count+=2; d/=6;}
    while (d%3 == 0) {count++; d/=3;}
    while (d%2 == 0) {count++; d/=2;}
    if (d!=1) return -1;
    return count;
}

void main()
{
    assert(solve(120,51840) == 7);
    assert(solve(42,42)==0);
    assert(solve(48,72)==-1);

    auto nm = readln.split.map!"a.to!int";
    auto n = nm[0], m =nm[1];
    writeln(solve(n,m));
}

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

    auto x = readln().split;
    const long start = x[0].to!long;
    long desti = x[1].to!long;

    if(desti == start) {
        "0".writeln;
    } else if(desti % start != 0) {
        "-1".writeln;
    } else if(desti % 2 != 0 && desti % 3 != 0) {
        "-1".writeln;
    } else {
        int cnt = 0;
        desti /= start;
        while(desti > 1) {
            if(desti % 3 == 0) {
                desti /= 3;
            } else if(desti % 2 == 0) {
                desti /= 2;
            } else {
                cnt = -1;
                break;
            }
            cnt++;
        }
        cnt.writeln;
    }
}

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

    auto x = readln().split;
    const long start = x[0].to!long;
    long desti = x[1].to!long;
    if(desti == start) {
        "0".writeln;
    } else if(desti % start != 0) {
        "-1".writeln;
    } else if(desti % 2 != 0 && desti % 3 != 0) {
        "-1".writeln;
    } else {
        int cnt = 0;
        while(desti > start) {
            if(desti % 3 != 0) {
                desti /= 2;
            } else {
                desti /= 3;
            }
            cnt++;
        }
        cnt.writeln;
    }
}

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

    auto x = readln().split;
    const long start = x[0].to!long;
    long desti = x[1].to!long;

    if(desti == start) {
        "0".writeln;
    } else if(desti % start != 0) {
        "-1".writeln;
    } else if(desti % 2 != 0 && desti % 3 != 0) {
        "-1".writeln;
    } else {
        int cnt = 0;
        desti /= start;
        while(desti > 1) {
            if(desti % 3 != 0) {
                desti /= 2;
            } else {
                desti /= 3;
            }
            cnt++;
        }
        cnt.writeln;
    }
}

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

    auto x = readln().split;
    const int start = x[0].to!int;
    int desti = x[1].to!int;
    if(desti == start) {
        "0".writeln;
    } else if(desti % start != 0) {
        "-1".writeln;
    } else if(desti % 2 != 0 && desti % 3 != 0) {
        "-1".writeln;
    } else {
        int cnt = 0;
        while(desti > start) {
            if(desti % 3 != 0) {
                desti /= 2;
            } else {
                desti /= 3;
            }
            cnt++;
        }
        cnt.writeln;
    }
}

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

    auto x = readln().split;
    const long start = x[0].to!long;
    long desti = x[1].to!long;

    if(desti == start) {
        "0".writeln;
    } else if(desti % start != 0) {
        "-1".writeln;
    } else if(desti % 2 != 0 && desti % 3 != 0) {
        "-1".writeln;
    } else {
        int cnt = 0;
        desti /= start;
        while(desti > 1) {
            if(desti % 3 != 0) {
                desti /= 2;
            } else if(desti % 2 != 0) {
                desti /= 3;
            } else {
                cnt = -1;
                break;
            }
            cnt++;
        }
        cnt.writeln;
    }
}

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

    auto x = readln().split;
    const int start = x[0].to!int;
    int desti = x[1].to!int;

    if(desti % start != 0) {
        "-1".writeln;
    } else if(desti % 2 != 0 && desti % 3 != 0) {
        "-1".writeln;
    } else {
        int cnt = 0;
        while(desti > start) {
            if(desti % 3 != 0) {
                desti /= 2;
            } else {
                desti /= 3;
            }
            cnt++;
        }
        cnt.writeln;
    }
}