/*Hugo David Franco Avila*/
#include <iostream>
#include <bits/stdc++.h>

/*int getY(int n, int n1);
int getZ(int n, int n1, int n2);
bool win(int num, int x, int y, int z);

int getY(int n, int n1){
	int y = n1+1;
	float num = 2.0/n, equis = 1.0/n1;//, check = 1.0/y;
	while(num <= ((1.0/y) + equis)){
		//check = 1.0/y;
		/*if(num <= (check + equis)){
			break;
		}//
		y++;
	}
	return y+1;
}

int getZ(int n, int n1, int n2){
	//bool rompe = true;
	int z = n2+1;
	float num = 2.0/n, equis = 1.0/n1, ye = 1.0/n2, check, dm;
	dm = equis + ye;
	while(!win(n, n1, n2, z)){
		//check = 1.0/z;
		if((dm + (1.0/z)) <= num){
			break;
		}
		z++;
	}
	return z;
}

bool win(int num, int x, int y, int z){
	float numero = 2.0/num, cx = 1.0/x, cy = 1.0/y, cz = 1.0/z, res;
	res = cx + cy + cz;
	if(numero == res) return true;
	return false;
}
*/
int main(){
	//bool rep = false;
	int input, x, y, z;
	//int *px = &x, *py = &y, *pz = &z;
	float left, comp;
	scanf("%d", &input);
	left = 2.0/input;
	if(input < 2){
		std::cout << -1;
	} else{
		//while(!win(input, *px, *py, *pz)){
		/*while(!win(input, x, y, z)){
			//comp = 1.0/ *px;
			comp = 1.0/ x;
			while(comp >= left){
				x++;
				comp = 1.0/x;
			}
			//*py = getY(input, *px);
			y = getY(input, x);
			//*pz = getZ(input, *px, *py);
			z = getZ(input, x, y);
			//if(win(input, *px, *py, *pz)){
			if(win(input, x, y, z)){
				rep = true;
				break;
			} else{
				x++;
			}
			//if(((1.0/ *px) + (1.0/( *px+1)) + (1.0/( *px+2))) < 2.0/input){
			if(((1.0/ x) + (1.0/( x+1)) + (1.0/( x+2))) < left){
				break;
			}

		}
		if(rep){
			//std::cout << *px << " " << *py << " " << *pz;
			std::cout << x << " " << y << " " << z;
		} else{
			std::cout << -1;
		*/
		//std::cout << "Dont fail \n";
		x = input;
		y = x + 1;
		z = x*y;
		std::cout << x << " " << y << " " << z;
	}
	return 0;
}


/*Hugo David Franco Avila*/
#include <iostream>
#include <bits/stdc++.h>

int getY(int n, int n1);
int getZ(int n, int n1, int n2);
bool win(int num, int x, int y, int z);

int getY(int n, int n1){
	int y = n1+1;
	float num = 2.0/n, equis = 1.0/n1, check = 1.0/y;
	while(num <= (check + equis)){
		y++;
		check = 1.0/y;
	}
	return y + 1;
}

int getZ(int n, int n1, int n2){
	//bool rompe = true;
	int z = n2+1;
	float num = 2.0/n, equis = 1.0/n1, ye = 1.0/n2, check;
	while(!win(n, n1, n2, z)){
		check = 1.0/z;
		if((equis + ye + check) <= num){
			break;
		}
		z++;
	}
	return z;
}

bool win(int num, int x, int y, int z){
	float numero = 2.0/num, cx = 1.0/x, cy = 1.0/y, cz = 1.0/z, res;
	res = cx + cy + cz;
	if(numero == res) return true;
	return false;
}

int main(){
	bool rep = false;
	int input, x = 2, y, z;
	int *px = &x, *py = &y, *pz = &z;
	float left, comp;
	std::cin >> input;
	left = 2.0/input;
	if(input < 3){
		std::cout << -1;
	} else{
		while(!win(input, *px, *py, *pz)){
			comp = 1.0/ *px;
			while(comp >= left){
				x++;
				comp = 1.0/x;
			}
			*py = getY(input, *px);
			*pz = getZ(input, *px, *py);
			if(win(input, *px, *py, *pz)){
				rep = true;
				break;
			} else{
				x++;
			}
			if(((1.0/ *px) + (1.0/( *px+1)) + (1.0/( *px+2))) < 2.0/input){
				break;
			}

		}
		if(rep){
			std::cout << *px << " " << *py << " " << *pz;
		} else{
			std::cout << -1;
		}
	}
	return 0;
}


/*Hugo David Franco Avila*/
#include <iostream>
#include <bits/stdc++.h>

int getY(int n, int n1);
int getZ(int n, int n1, int n2);
bool win(int num, int x, int y, int z);

int getY(int n, int n1){
	int y = n1+1;
	float num = 2.0/n, equis = 1.0/n1, check = 1.0/y;
	while(num <= (check + equis)){
		y++;
		check = 1.0/y;
	}
	return y + 1;
}

int getZ(int n, int n1, int n2){
	//bool rompe = true;
	int z = n2+1;
	float num = 2.0/n, equis = 1.0/n1, ye = 1.0/n2, check;
	while(!win(n, n1, n2, z)){
		check = 1.0/z;
		if((equis + ye + check) <= num){
			break;
		}
		z++;
	}
	return z;
}

bool win(int num, int x, int y, int z){
	float numero = 2.0/num, cx = 1.0/x, cy = 1.0/y, cz = 1.0/z, res;
	res = cx + cy + cz;
	if(numero == res) return true;
	return false;
}

int main(){
	bool rep = false;
	int input, x = 2, y, z;
	//int *px = &x, *py = &y, *pz = &z;
	float left, comp;
	std::cin >> input;
	left = 2.0/input;
	if(input < 3){
		std::cout << -1;
	} else{
		//while(!win(input, *px, *py, *pz)){
		while(!win(input, x, y, z)){
			//comp = 1.0/ *px;
			comp = 1.0/ x;
			while(comp >= left){
				x++;
				comp = 1.0/x;
			}
			//*py = getY(input, *px);
			y = getY(input, x);
			//*pz = getZ(input, *px, *py);
			z = getZ(input, x, y);
			//if(win(input, *px, *py, *pz)){
			if(win(input, x, y, z)){
				rep = true;
				break;
			} else{
				x++;
			}
			//if(((1.0/ *px) + (1.0/( *px+1)) + (1.0/( *px+2))) < 2.0/input){
			if(((1.0/ x) + (1.0/( x+1)) + (1.0/( x+2))) < left){
				break;
			}

		}
		if(rep){
			//std::cout << *px << " " << *py << " " << *pz;
			std::cout << x << " " << y << " " << z;
		} else{
			std::cout << -1;
		}
	}
	return 0;
}


/*Hugo David Franco Avila*/
#include <iostream>
#include <bits/stdc++.h>

int getY(int n, int n1);
int getZ(int n, int n1, int n2);
bool win(int num, int x, int y, int z);

int getY(int n, int n1){
	int y = n1+1, r;
	float num = 2.0/n, equis = 1.0/n1, check = 1.0/y;
	while(num <= (check + equis)){
		r = y;
		check = 1.0/r;
		y++;
	}
	return r;
}

int getZ(int n, int n1, int n2){
	//bool rompe = true;
	int z = n2+1, r = z;
	float num = 2.0/n, equis = 1.0/n1, ye = 1.0/n2, check;
	while(!win(n, n1, n2, r)){
		r = z;
		check = 1.0/r;
		if((equis + ye + check) <= num){
			break;
		}
		z++;
	}
	return z;
}

bool win(int num, int x, int y, int z){
	float numero = 2.0/num, cx = 1.0/x, cy = 1.0/y, cz = 1.0/z, res;
	res = cx + cy + cz;
	if(numero == res) return true;
	return false;
}

int main(){
	bool rep = false;
	int input, x = 2, y, z;
	//int *px = &x, *py = &y, *pz = &z;
	float left, comp;
	std::cin >> input;
	left = 2.0/input;
	if(input < 3){
		std::cout << -1;
	} else{
		//while(!win(input, *px, *py, *pz)){
		while(!win(input, x, y, z)){
			//comp = 1.0/ *px;
			comp = 1.0/ x;
			while(comp >= left){
				x++;
				comp = 1.0/x;
			}
			//*py = getY(input, *px);
			y = getY(input, x);
			//*pz = getZ(input, *px, *py);
			z = getZ(input, x, y);
			//if(win(input, *px, *py, *pz)){
			if(win(input, x, y, z)){
				rep = true;
				break;
			} else{
				x++;
			}
			//if(((1.0/ *px) + (1.0/( *px+1)) + (1.0/( *px+2))) < 2.0/input){
			if(((1.0/ x) + (1.0/( x+1)) + (1.0/( x+2))) < left){
				break;
			}

		}
		if(rep){
			//std::cout << *px << " " << *py << " " << *pz;
			std::cout << x << " " << y << " " << z;
		} else{
			std::cout << -1;
		}
	}
	return 0;
}


/*Hugo David Franco Avila*/
#include <iostream>
#include <bits/stdc++.h>

int getY(int n, int n1);
int getZ(int n, int n1, int n2);
bool win(int num, int x, int y, int z);

int getY(int n, int n1){
	int y = n1+1;
	float num = 2.0/n, equis = 1.0/n1;//, check = 1.0/y;
	while(num <= ((1.0/y) + equis)){
		//check = 1.0/y;
		/*if(num <= (check + equis)){
			break;
		}*/
		y++;
	}
	return y+1;
}

int getZ(int n, int n1, int n2){
	//bool rompe = true;
	int z = n2+1;
	float num = 2.0/n, equis = 1.0/n1, ye = 1.0/n2, check, dm;
	dm = equis + ye;
	while(!win(n, n1, n2, z)){
		//check = 1.0/z;
		if((dm + (1.0/z)) <= num){
			break;
		}
		z++;
	}
	return z;
}

bool win(int num, int x, int y, int z){
	float numero = 2.0/num, cx = 1.0/x, cy = 1.0/y, cz = 1.0/z, res;
	res = cx + cy + cz;
	if(numero == res) return true;
	return false;
}

int main(){
	bool rep = false;
	int input, x = 2, y, z;
	//int *px = &x, *py = &y, *pz = &z;
	float left, comp;
	std::cin >> input;
	left = 2.0/input;
	if(input < 3){
		std::cout << -1;
	} else{
		//while(!win(input, *px, *py, *pz)){
		while(!win(input, x, y, z)){
			//comp = 1.0/ *px;
			comp = 1.0/ x;
			while(comp >= left){
				x++;
				comp = 1.0/x;
			}
			//*py = getY(input, *px);
			y = getY(input, x);
			//*pz = getZ(input, *px, *py);
			z = getZ(input, x, y);
			//if(win(input, *px, *py, *pz)){
			if(win(input, x, y, z)){
				rep = true;
				break;
			} else{
				x++;
			}
			//if(((1.0/ *px) + (1.0/( *px+1)) + (1.0/( *px+2))) < 2.0/input){
			if(((1.0/ x) + (1.0/( x+1)) + (1.0/( x+2))) < left){
				break;
			}

		}
		if(rep){
			//std::cout << *px << " " << *py << " " << *pz;
			std::cout << x << " " << y << " " << z;
		} else{
			std::cout << -1;
		}
	}
	return 0;
}


/*Hugo David Franco Avila*/
#include <iostream>
#include <bits/stdc++.h>

int getY(int n, int n1);
int getZ(int n, int n1, int n2);
bool win(int num, int x, int y, int z);

int getY(int n, int n1){
	int y = n1+1;
	float num = 2.0/n, equis = 1.0/n1;//, check = 1.0/y;
	while(num <= ((1.0/y) + equis)){
		//check = 1.0/y;
		/*if(num <= (check + equis)){
			break;
		}*/
		y++;
	}
	return y+1;
}

int getZ(int n, int n1, int n2){
	//bool rompe = true;
	int z = n2+1;
	float num = 2.0/n, equis = 1.0/n1, ye = 1.0/n2, check;
	while(!win(n, n1, n2, z)){
		check = 1.0/z;
		if((equis + ye + check) <= num){
			break;
		}
		z++;
	}
	return z;
}

bool win(int num, int x, int y, int z){
	float numero = 2.0/num, cx = 1.0/x, cy = 1.0/y, cz = 1.0/z, res;
	res = cx + cy + cz;
	if(numero == res) return true;
	return false;
}

int main(){
	bool rep = false;
	int input, x = 2, y, z;
	//int *px = &x, *py = &y, *pz = &z;
	float left, comp;
	std::cin >> input;
	left = 2.0/input;
	if(input < 3){
		std::cout << -1;
	} else{
		//while(!win(input, *px, *py, *pz)){
		while(!win(input, x, y, z)){
			//comp = 1.0/ *px;
			comp = 1.0/ x;
			while(comp >= left){
				x++;
				comp = 1.0/x;
			}
			//*py = getY(input, *px);
			y = getY(input, x);
			//*pz = getZ(input, *px, *py);
			z = getZ(input, x, y);
			//if(win(input, *px, *py, *pz)){
			if(win(input, x, y, z)){
				rep = true;
				break;
			} else{
				x++;
			}
			//if(((1.0/ *px) + (1.0/( *px+1)) + (1.0/( *px+2))) < 2.0/input){
			if(((1.0/ x) + (1.0/( x+1)) + (1.0/( x+2))) < left){
				break;
			}

		}
		if(rep){
			//std::cout << *px << " " << *py << " " << *pz;
			std::cout << x << " " << y << " " << z;
		} else{
			std::cout << -1;
		}
	}
	return 0;
}


/*Hugo David Franco Avila*/
#include <iostream>
#include <bits/stdc++.h>

/*int getY(int n, int n1);
int getZ(int n, int n1, int n2);
bool win(int num, int x, int y, int z);

int getY(int n, int n1){
	int y = n1+1;
	float num = 2.0/n, equis = 1.0/n1;//, check = 1.0/y;
	while(num <= ((1.0/y) + equis)){
		//check = 1.0/y;
		/*if(num <= (check + equis)){
			break;
		}//
		y++;
	}
	return y+1;
}

int getZ(int n, int n1, int n2){
	//bool rompe = true;
	int z = n2+1;
	float num = 2.0/n, equis = 1.0/n1, ye = 1.0/n2, check, dm;
	dm = equis + ye;
	while(!win(n, n1, n2, z)){
		//check = 1.0/z;
		if((dm + (1.0/z)) <= num){
			break;
		}
		z++;
	}
	return z;
}

bool win(int num, int x, int y, int z){
	float numero = 2.0/num, cx = 1.0/x, cy = 1.0/y, cz = 1.0/z, res;
	res = cx + cy + cz;
	if(numero == res) return true;
	return false;
}
*/
int main(){
	//bool rep = false;
	int input, x, y, z;
	//int *px = &x, *py = &y, *pz = &z;
	float left, comp;
	scanf("%d", &input);
	left = 2.0/input;
	if(input < 3){
		std::cout << -1;
	} else{
		//while(!win(input, *px, *py, *pz)){
		/*while(!win(input, x, y, z)){
			//comp = 1.0/ *px;
			comp = 1.0/ x;
			while(comp >= left){
				x++;
				comp = 1.0/x;
			}
			//*py = getY(input, *px);
			y = getY(input, x);
			//*pz = getZ(input, *px, *py);
			z = getZ(input, x, y);
			//if(win(input, *px, *py, *pz)){
			if(win(input, x, y, z)){
				rep = true;
				break;
			} else{
				x++;
			}
			//if(((1.0/ *px) + (1.0/( *px+1)) + (1.0/( *px+2))) < 2.0/input){
			if(((1.0/ x) + (1.0/( x+1)) + (1.0/( x+2))) < left){
				break;
			}

		}
		if(rep){
			//std::cout << *px << " " << *py << " " << *pz;
			std::cout << x << " " << y << " " << z;
		} else{
			std::cout << -1;
		*/
		//std::cout << "Dont fail \n";
		x = input;
		y = x + 1;
		z = x*y;
		std::cout << x << " " << y << " " << z;
	}
	return 0;
}


/*input
7

*/
#include <chrono>
#include <random>
#include <cmath>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

#define Fi              first
#define Se              second
#define S(n)            cin >> n
#define P(n)            cout << n
#define pb              push_back
#define pp              pop_back
#define pf              pop_front
#define sp              cout << " "
#define nl              cout << "\n"
#define MIN(con)        (*min_element(ALL(con)))
#define MAX(con)        (*max_element(ALL(con)))
#define mem(n, a)       memset((n), (a), sizeof(n))
#define ALL(cont)       (cont).begin(),(cont).end()
#define NX(cont)        next_permutation(ALL(cont))
#define PX(cont)        prev_permutation(ALL(cont))
#define F(i, n, r)      for(int i = (n); i < (r); i ++)
#define prec(n)         cout << fixed << setprecision(n)
#define PI              3.14159265358979323846264338327951
#define fast            ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FH(it,c)        for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)

using ll = long long;
using ld = long double;
using ss = stringstream;
using ul = unsigned long long;

template < typename T > inline T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline T _max(T a, T b, T c)      { return max( max( a, b ), c ); }
template < typename T > inline T _min(T a, T b, T c)      { return min( min( a, b ), c ); }
template < typename T > inline string toString(T a)       {return to_string(a); }  // Convert int to string
template < typename T > inline void toInt(string s, T &x) { ss str(s); str >> x;}  // Convert string to int

inline void lower(string &s) {
  FH(it,s)
    *it = tolower(*it);
}

inline void upper(string &s) {
  FH(it,s)
    *it = toupper(*it);
}

const int mod = 1e9 + 7;

inline ll add(ll x, ll y) { x += y; if(x >= mod) x -= mod; return x; }
inline ll sub(ll x, ll y) { x -= y; if(x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }

inline ll powr(ll a, ll b){
    ll x = 1LL;
    while(b) {
        if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}

inline ll inv(ll a) { return powr(a, mod - 2);}

const int inv2 = (mod + 1) >> 1;
const ll inf    =  999999999999999999;

bool palin(string s)
{
    string s1 = s;
    reverse(s.begin(), s.end());
    return (s == s1);
}

ll triangle(ll n)
{
    return (n * (n + 1)) / 2;
}

bool check(ll n)
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;

    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}

int main ()
{
    fast;
    int n;
    cin >> n;
    ll nn = 2 * inv(n);
    for(int i = 1; i <= 1005; i ++) {
        for(int j = 1; j <= 1005; j ++) {
            if(i != j) {
                ll a = inv(i);
                ll b = inv(j);
                ll c = nn - (a + b);
                c = inv(c);
                double d = 2 * 1.0 / n;
                double dd = 1.0 / i + 1.0 / j + 1.0 / c;
                if(abs(d - dd) <= 1e-6 and c > 0 and i != c and j != c) {
                    cout << i << " " << j << " " << c, nl;
                    return 0;
                }
            }
        }
    }
    cout << "-1";
    nl;
    return 0;
}


/*input
4116

*/
#include <chrono>
#include <random>
#include <cmath>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

#define Fi              first
#define Se              second
#define S(n)            cin >> n
#define P(n)            cout << n
#define pb              push_back
#define pp              pop_back
#define pf              pop_front
#define sp              cout << " "
#define nl              cout << "\n"
#define MIN(con)        (*min_element(ALL(con)))
#define MAX(con)        (*max_element(ALL(con)))
#define mem(n, a)       memset((n), (a), sizeof(n))
#define ALL(cont)       (cont).begin(),(cont).end()
#define NX(cont)        next_permutation(ALL(cont))
#define PX(cont)        prev_permutation(ALL(cont))
#define F(i, n, r)      for(int i = (n); i < (r); i ++)
#define prec(n)         cout << fixed << setprecision(n)
#define PI              3.14159265358979323846264338327951
#define fast            ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FH(it,c)        for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)

using ll = long long;
using ld = long double;
using ss = stringstream;
using ul = unsigned long long;

template < typename T > inline T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline T _max(T a, T b, T c)      { return max( max( a, b ), c ); }
template < typename T > inline T _min(T a, T b, T c)      { return min( min( a, b ), c ); }
template < typename T > inline string toString(T a)       {return to_string(a); }  // Convert int to string
template < typename T > inline void toInt(string s, T &x) { ss str(s); str >> x;}  // Convert string to int

inline void lower(string &s) {
  FH(it,s)
    *it = tolower(*it);
}

inline void upper(string &s) {
  FH(it,s)
    *it = toupper(*it);
}

const int mod = 1e9 + 7;

inline ll add(ll x, ll y) { x += y; if(x >= mod) x -= mod; return x; }
inline ll sub(ll x, ll y) { x -= y; if(x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }

inline ll powr(ll a, ll b){
    ll x = 1LL;
    while(b) {
        if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}

inline ll inv(ll a) { return powr(a, mod - 2);}

const int inv2 = (mod + 1) >> 1;
const ll inf    =  999999999999999999;

bool palin(string s)
{
    string s1 = s;
    reverse(s.begin(), s.end());
    return (s == s1);
}

ll triangle(ll n)
{
    return (n * (n + 1)) / 2;
}

bool check(ll n)
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;

    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}

ll pre[10005];

void init()
{
    for(int i = 1; i <= 10004; i ++) {
        pre[i] = inv(i);
    }
}

int main ()
{
    fast;
    init();
    int n;
    cin >> n;
    if(n == 1) {
        cout << "-1";
    }
    ll nn = 2 * inv(n);
    for(int i = n; i <= 10004; i ++) {
        for(int j = 1; j <= 10004; j ++) {
            if(i != j) {
                ll a = pre[i];
                ll b = pre[j];
                ll c = nn - (a + b);
                c = inv(c);
                double d = 2 * 1.0 / n;
                if(c > 0 and c < 1e9) {
                    double dd = 1.0 / i + 1.0 / j + 1.0 / c;
                    if(abs(d - dd) <= 1e-9 and c > 0 and i != c and j != c) {
                        cout << i << " " << j << " " << c, nl;
                        return 0;
                    }
                }
            }
        }
    }
    cout << "-1";
    nl;
    return 0;
}


/*input
4116

*/
#include <chrono>
#include <random>
#include <cmath>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

#define Fi              first
#define Se              second
#define S(n)            cin >> n
#define P(n)            cout << n
#define pb              push_back
#define pp              pop_back
#define pf              pop_front
#define sp              cout << " "
#define nl              cout << "\n"
#define MIN(con)        (*min_element(ALL(con)))
#define MAX(con)        (*max_element(ALL(con)))
#define mem(n, a)       memset((n), (a), sizeof(n))
#define ALL(cont)       (cont).begin(),(cont).end()
#define NX(cont)        next_permutation(ALL(cont))
#define PX(cont)        prev_permutation(ALL(cont))
#define F(i, n, r)      for(int i = (n); i < (r); i ++)
#define prec(n)         cout << fixed << setprecision(n)
#define PI              3.14159265358979323846264338327951
#define fast            ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FH(it,c)        for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)

using ll = long long;
using ld = long double;
using ss = stringstream;
using ul = unsigned long long;

template < typename T > inline T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline T _max(T a, T b, T c)      { return max( max( a, b ), c ); }
template < typename T > inline T _min(T a, T b, T c)      { return min( min( a, b ), c ); }
template < typename T > inline string toString(T a)       {return to_string(a); }  // Convert int to string
template < typename T > inline void toInt(string s, T &x) { ss str(s); str >> x;}  // Convert string to int

inline void lower(string &s) {
  FH(it,s)
    *it = tolower(*it);
}

inline void upper(string &s) {
  FH(it,s)
    *it = toupper(*it);
}

const int mod = 1e9 + 7;

inline ll add(ll x, ll y) { x += y; if(x >= mod) x -= mod; return x; }
inline ll sub(ll x, ll y) { x -= y; if(x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }

inline ll powr(ll a, ll b){
    ll x = 1LL;
    while(b) {
        if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}

inline ll inv(ll a) { return powr(a, mod - 2);}

const int inv2 = (mod + 1) >> 1;
const ll inf    =  999999999999999999;

bool palin(string s)
{
    string s1 = s;
    reverse(s.begin(), s.end());
    return (s == s1);
}

ll triangle(ll n)
{
    return (n * (n + 1)) / 2;
}

bool check(ll n)
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;

    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}

ll pre[1010];

void init()
{
    for(int i = 1; i <= 1005; i ++) {
        pre[i] = inv(i);
    }
}

int main ()
{
    fast;
    init();
    int n;
    cin >> n;
    ll nn = 2 * inv(n);
    for(int i = 1; i <= 1005; i ++) {
        for(int j = i + 1; j <= 1005; j ++) {
            ll a = pre[i];
            ll b = pre[j];
            ll c = nn - (a + b);
            c = inv(c);
            double d = 2 * 1.0 / n;
            double dd = 1.0 / i + 1.0 / j + 1.0 / c;
            if(abs(d - dd) <= 1e-6 and c > 0 and i != c and j != c) {
                cout << i << " " << j << " " << c, nl;
                return 0;
            }
        }
    }
    cout << "-1";
    nl;
    return 0;
}


/*input
79

*/
#include <chrono>
#include <random>
#include <cmath>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

#define Fi              first
#define Se              second
#define S(n)            cin >> n
#define P(n)            cout << n
#define pb              push_back
#define pp              pop_back
#define pf              pop_front
#define sp              cout << " "
#define nl              cout << "\n"
#define MIN(con)        (*min_element(ALL(con)))
#define MAX(con)        (*max_element(ALL(con)))
#define mem(n, a)       memset((n), (a), sizeof(n))
#define ALL(cont)       (cont).begin(),(cont).end()
#define NX(cont)        next_permutation(ALL(cont))
#define PX(cont)        prev_permutation(ALL(cont))
#define F(i, n, r)      for(int i = (n); i < (r); i ++)
#define prec(n)         cout << fixed << setprecision(n)
#define PI              3.14159265358979323846264338327951
#define fast            ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FH(it,c)        for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)

using ll = long long;
using ld = long double;
using ss = stringstream;
using ul = unsigned long long;

template < typename T > inline T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline T _max(T a, T b, T c)      { return max( max( a, b ), c ); }
template < typename T > inline T _min(T a, T b, T c)      { return min( min( a, b ), c ); }
template < typename T > inline string toString(T a)       {return to_string(a); }  // Convert int to string
template < typename T > inline void toInt(string s, T &x) { ss str(s); str >> x;}  // Convert string to int

inline void lower(string &s) {
  FH(it,s)
    *it = tolower(*it);
}

inline void upper(string &s) {
  FH(it,s)
    *it = toupper(*it);
}

const int mod = 1e9 + 7;

inline ll add(ll x, ll y) { x += y; if(x >= mod) x -= mod; return x; }
inline ll sub(ll x, ll y) { x -= y; if(x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }

inline ll powr(ll a, ll b){
    ll x = 1LL;
    while(b) {
        if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}

inline ll inv(ll a) { return powr(a, mod - 2);}

const int inv2 = (mod + 1) >> 1;
const ll inf    =  999999999999999999;

bool palin(string s)
{
    string s1 = s;
    reverse(s.begin(), s.end());
    return (s == s1);
}

ll triangle(ll n)
{
    return (n * (n + 1)) / 2;
}

bool check(ll n)
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;

    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}

ll pre[10005];

void init()
{
    for(int i = 1; i <= 10004; i ++) {
        pre[i] = inv(i);
    }
}

int main ()
{
    fast;
    init();
    int n;
    cin >> n;
    if(n == 1) {
        cout << "-1";
    }
    ll nn = 2 * inv(n);
    for(int i = n; i <= 10004; i ++) {
        for(int j = 1; j <= 10005; j ++) {
            if(i != j) {
                ll a = pre[i];
                ll b = pre[j];
                ll c = nn - (a + b);
                c = inv(c);
                double d = 2 * 1.0 / n;
                if(c > 0) {
                    double dd = 1.0 / i + 1.0 / j + 1.0 / c;
                    if(abs(d - dd) <= 1e-6 and c > 0 and i != c and j != c) {
                        cout << i << " " << j << " " << c, nl;
                        return 0;
                    }
                }
            }
        }
    }
    cout << "-1";
    nl;
    return 0;
}


/*input
4116

*/
#include <chrono>
#include <random>
#include <cmath>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

#define Fi              first
#define Se              second
#define S(n)            cin >> n
#define P(n)            cout << n
#define pb              push_back
#define pp              pop_back
#define pf              pop_front
#define sp              cout << " "
#define nl              cout << "\n"
#define MIN(con)        (*min_element(ALL(con)))
#define MAX(con)        (*max_element(ALL(con)))
#define mem(n, a)       memset((n), (a), sizeof(n))
#define ALL(cont)       (cont).begin(),(cont).end()
#define NX(cont)        next_permutation(ALL(cont))
#define PX(cont)        prev_permutation(ALL(cont))
#define F(i, n, r)      for(int i = (n); i < (r); i ++)
#define prec(n)         cout << fixed << setprecision(n)
#define PI              3.14159265358979323846264338327951
#define fast            ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FH(it,c)        for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)

using ll = long long;
using ld = long double;
using ss = stringstream;
using ul = unsigned long long;

template < typename T > inline T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline T _max(T a, T b, T c)      { return max( max( a, b ), c ); }
template < typename T > inline T _min(T a, T b, T c)      { return min( min( a, b ), c ); }
template < typename T > inline string toString(T a)       {return to_string(a); }  // Convert int to string
template < typename T > inline void toInt(string s, T &x) { ss str(s); str >> x;}  // Convert string to int

inline void lower(string &s) {
  FH(it,s)
    *it = tolower(*it);
}

inline void upper(string &s) {
  FH(it,s)
    *it = toupper(*it);
}

const int mod = 1e9 + 7;

inline ll add(ll x, ll y) { x += y; if(x >= mod) x -= mod; return x; }
inline ll sub(ll x, ll y) { x -= y; if(x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }

inline ll powr(ll a, ll b){
    ll x = 1LL;
    while(b) {
        if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}

inline ll inv(ll a) { return powr(a, mod - 2);}

const int inv2 = (mod + 1) >> 1;
const ll inf    =  999999999999999999;

bool palin(string s)
{
    string s1 = s;
    reverse(s.begin(), s.end());
    return (s == s1);
}

ll triangle(ll n)
{
    return (n * (n + 1)) / 2;
}

bool check(ll n)
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;

    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}

ll pre[10005];

void init()
{
    for(int i = 1; i <= 10004; i ++) {
        pre[i] = inv(i);
    }
}

int main ()
{
    fast;
    init();
    int n;
    cin >> n;
    if(n == 1) {
        cout << "-1";
    }
    ll nn = 2 * inv(n);
    for(int i = n; i <= 10004; i += n) {
        for(int j = 1; j <= 10005; j ++) {
            ll a = pre[i];
            ll b = pre[j];
            ll c = nn - (a + b);
            c = inv(c);
            double d = 2 * 1.0 / n;
            double dd = 1.0 / i + 1.0 / j + 1.0 / c;
            if(abs(d - dd) <= 1e-6 and c > 0 and i != c and j != c) {
                cout << i << " " << j << " " << c, nl;
                return 0;
            }
        }
    }
    cout << "-1";
    nl;
    return 0;
}


/*input
4116

*/
#include <chrono>
#include <random>
#include <cmath>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

#define Fi              first
#define Se              second
#define S(n)            cin >> n
#define P(n)            cout << n
#define pb              push_back
#define pp              pop_back
#define pf              pop_front
#define sp              cout << " "
#define nl              cout << "\n"
#define MIN(con)        (*min_element(ALL(con)))
#define MAX(con)        (*max_element(ALL(con)))
#define mem(n, a)       memset((n), (a), sizeof(n))
#define ALL(cont)       (cont).begin(),(cont).end()
#define NX(cont)        next_permutation(ALL(cont))
#define PX(cont)        prev_permutation(ALL(cont))
#define F(i, n, r)      for(int i = (n); i < (r); i ++)
#define prec(n)         cout << fixed << setprecision(n)
#define PI              3.14159265358979323846264338327951
#define fast            ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FH(it,c)        for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)

using ll = long long;
using ld = long double;
using ss = stringstream;
using ul = unsigned long long;

template < typename T > inline T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline T _max(T a, T b, T c)      { return max( max( a, b ), c ); }
template < typename T > inline T _min(T a, T b, T c)      { return min( min( a, b ), c ); }
template < typename T > inline string toString(T a)       {return to_string(a); }  // Convert int to string
template < typename T > inline void toInt(string s, T &x) { ss str(s); str >> x;}  // Convert string to int

inline void lower(string &s) {
  FH(it,s)
    *it = tolower(*it);
}

inline void upper(string &s) {
  FH(it,s)
    *it = toupper(*it);
}

const int mod = 1e9 + 7;

inline ll add(ll x, ll y) { x += y; if(x >= mod) x -= mod; return x; }
inline ll sub(ll x, ll y) { x -= y; if(x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }

inline ll powr(ll a, ll b){
    ll x = 1LL;
    while(b) {
        if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}

inline ll inv(ll a) { return powr(a, mod - 2);}

const int inv2 = (mod + 1) >> 1;
const ll inf    =  999999999999999999;

bool palin(string s)
{
    string s1 = s;
    reverse(s.begin(), s.end());
    return (s == s1);
}

ll triangle(ll n)
{
    return (n * (n + 1)) / 2;
}

bool check(ll n)
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;

    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}

ll pre[10005];

void init()
{
    for(int i = 1; i <= 10004; i ++) {
        pre[i] = inv(i);
    }
}

int main ()
{
    fast;
    ll n;
    cin >> n;
    if(n == 1) {
        cout << "-1";
        return 0;
    }
    cout << n << " " << n + 1 << " " << n * (n + 1);
    nl;
    return 0;
}


/*input
4116

*/
#include <chrono>
#include <random>
#include <cmath>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

#define Fi              first
#define Se              second
#define S(n)            cin >> n
#define P(n)            cout << n
#define pb              push_back
#define pp              pop_back
#define pf              pop_front
#define sp              cout << " "
#define nl              cout << "\n"
#define MIN(con)        (*min_element(ALL(con)))
#define MAX(con)        (*max_element(ALL(con)))
#define mem(n, a)       memset((n), (a), sizeof(n))
#define ALL(cont)       (cont).begin(),(cont).end()
#define NX(cont)        next_permutation(ALL(cont))
#define PX(cont)        prev_permutation(ALL(cont))
#define F(i, n, r)      for(int i = (n); i < (r); i ++)
#define prec(n)         cout << fixed << setprecision(n)
#define PI              3.14159265358979323846264338327951
#define fast            ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FH(it,c)        for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)

using ll = long long;
using ld = long double;
using ss = stringstream;
using ul = unsigned long long;

template < typename T > inline T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline T _max(T a, T b, T c)      { return max( max( a, b ), c ); }
template < typename T > inline T _min(T a, T b, T c)      { return min( min( a, b ), c ); }
template < typename T > inline string toString(T a)       {return to_string(a); }  // Convert int to string
template < typename T > inline void toInt(string s, T &x) { ss str(s); str >> x;}  // Convert string to int

inline void lower(string &s) {
  FH(it,s)
    *it = tolower(*it);
}

inline void upper(string &s) {
  FH(it,s)
    *it = toupper(*it);
}

const int mod = 1e9 + 7;

inline ll add(ll x, ll y) { x += y; if(x >= mod) x -= mod; return x; }
inline ll sub(ll x, ll y) { x -= y; if(x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }

inline ll powr(ll a, ll b){
    ll x = 1LL;
    while(b) {
        if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}

inline ll inv(ll a) { return powr(a, mod - 2);}

const int inv2 = (mod + 1) >> 1;
const ll inf    =  999999999999999999;

bool palin(string s)
{
    string s1 = s;
    reverse(s.begin(), s.end());
    return (s == s1);
}

ll triangle(ll n)
{
    return (n * (n + 1)) / 2;
}

bool check(ll n)
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;

    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}

ll pre[10005];

void init()
{
    for(int i = 1; i <= 10004; i ++) {
        pre[i] = inv(i);
    }
}

int main ()
{
    fast;
    init();
    int n;
    cin >> n;
    if(n == 1) {
        cout << "-1";
        return 0;
    }
    ll nn = 2 * inv(n);
    for(int i = n; i <= 10004; i ++) {
        for(int j = 1; j <= 10004; j ++) {
            if(i != j) {
                ll a = pre[i];
                ll b = pre[j];
                ll c = nn - (a + b);
                c = inv(c);
                double d = 2 * 1.0 / n;
                if(c > 0 and c < 1e9) {
                    double dd = 1.0 / i + 1.0 / j + 1.0 / c;
                    if(abs(d - dd) <= 1e-9 and c > 0 and i != c and j != c) {
                        cout << i << " " << j << " " << c, nl;
                        return 0;
                    }
                }
            }
        }
    }
    cout << "-1";
    nl;
    return 0;
}


/*input
4116

*/
#include <chrono>
#include <random>
#include <cmath>
#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>

using namespace std;

#define Fi              first
#define Se              second
#define S(n)            cin >> n
#define P(n)            cout << n
#define pb              push_back
#define pp              pop_back
#define pf              pop_front
#define sp              cout << " "
#define nl              cout << "\n"
#define MIN(con)        (*min_element(ALL(con)))
#define MAX(con)        (*max_element(ALL(con)))
#define mem(n, a)       memset((n), (a), sizeof(n))
#define ALL(cont)       (cont).begin(),(cont).end()
#define NX(cont)        next_permutation(ALL(cont))
#define PX(cont)        prev_permutation(ALL(cont))
#define F(i, n, r)      for(int i = (n); i < (r); i ++)
#define prec(n)         cout << fixed << setprecision(n)
#define PI              3.14159265358979323846264338327951
#define fast            ios_base:: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define FH(it,c)        for(__typeof((c).begin()) it = (c).begin(); it != (c).end(); ++ it)

using ll = long long;
using ld = long double;
using ss = stringstream;
using ul = unsigned long long;

template < typename T > inline T LCM(T a, T b)            { return (a * b) / GCD(a, b); }
template < typename T > inline T GCD(T a, T b)            { ll t; while(a) { t = a; a = b % a; b = t; } return b; }
template < typename T > inline T _max(T a, T b, T c)      { return max( max( a, b ), c ); }
template < typename T > inline T _min(T a, T b, T c)      { return min( min( a, b ), c ); }
template < typename T > inline string toString(T a)       {return to_string(a); }  // Convert int to string
template < typename T > inline void toInt(string s, T &x) { ss str(s); str >> x;}  // Convert string to int

inline void lower(string &s) {
  FH(it,s)
    *it = tolower(*it);
}

inline void upper(string &s) {
  FH(it,s)
    *it = toupper(*it);
}

const int mod = 1e9 + 7;

inline ll add(ll x, ll y) { x += y; if(x >= mod) x -= mod; return x; }
inline ll sub(ll x, ll y) { x -= y; if(x < 0) x += mod; return x; }
inline ll mul(ll x, ll y) { return ((x % mod) * (y % mod)) % mod; }

inline ll powr(ll a, ll b){
    ll x = 1LL;
    while(b) {
        if(b & 1) x = mul(x, a);
        a = mul(a, a);
        b >>= 1;
    }
    return x;
}

inline ll inv(ll a) { return powr(a, mod - 2);}

const int inv2 = (mod + 1) >> 1;
const ll inf    =  999999999999999999;

bool palin(string s)
{
    string s1 = s;
    reverse(s.begin(), s.end());
    return (s == s1);
}

ll triangle(ll n)
{
    return (n * (n + 1)) / 2;
}

bool check(ll n)
{
    if(n == 1) return 0;
    if(n == 2 or n == 3) return 1;
    if(n % 2 == 0 or n % 3 == 0) return 0;

    for(ll i = 5; i * i <= n; i += 6) if(n % i == 0 or n % (i + 2) == 0) return 0;
    return 1;
}

int main ()
{
    fast;
    int n;
    cin >> n;
    ll nn = 2 * inv(n);
    for(int i = 1; i <= 1005; i ++) {
        for(int j = i + 1; j <= 1005; j ++) {
            ll a = inv(i);
            ll b = inv(j);
            ll c = nn - (a + b);
            c = inv(c);
            double d = 2 * 1.0 / n;
            double dd = 1.0 / i + 1.0 / j + 1.0 / c;
            if(abs(d - dd) <= 1e-6 and c > 0 and i != c and j != c) {
                cout << i << " " << j << " " << c, nl;
                return 0;
            }
        }
    }
    cout << "-1";
    nl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int magic = 10000 / 2;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int A = 1; A <= magic; ++A)
        for(int B = A + 1; B <= magic; ++B)
        {
            long long ch = 1LL * n * A * B;
            long long zn = 2LL * A * B - 1LL * n * (A + B);
            if(zn == 0) continue;
            if(ch % zn == 0)
            {
                long long x = ch / zn;
                if(x > B && x <= 1000000000)
                {
                    cout << A << " " << B << " " << x << endl;
                    return 0;
                }
            }
        }
    cout << -1 << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int magic = 10001;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int A = 1; A <= magic; ++A)
        for(int B = A + 1; B <= magic; ++B)
        {
            long long ch = 1LL * n * A * B;
            long long zn = 2LL * A * B - 1LL * n * (A + B);
            if(zn == 0) continue;
            if(ch % zn == 0)
            {
                long long x = ch / zn;
                if(x > B)
                {
                    cout << A << " " << B << " " << x << endl;
                    return 0;
                }
            }
        }
    cout << -1 << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int magic = 10009;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int A = 1; A <= magic; ++A)
        for(int B = A + 1; B <= magic; ++B)
        {
            long long ch = 1LL * n * A * B;
            long long zn = 2LL * A * B - 1LL * n * (A + B);
            if(zn == 0) continue;
            if(ch % zn == 0)
            {
                long long x = ch / zn;
                if(x > B)
                {
                    cout << A << " " << B << " " << x << endl;
                    return 0;
                }
            }
        }
    cout << -1 << endl;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int magic = 10099;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int A = 1; A <= magic; ++A)
        for(int B = A + 1; B <= magic; ++B)
        {
            long long ch = 1LL * n * A * B;
            long long zn = 2LL * A * B - 1LL * n * (A + B);
            if(zn == 0) continue;
            if(ch % zn == 0)
            {
                long long x = ch / zn;
                cout << A << " " << B << " " << x << endl;
                    return 0;

            }
        }
    cout << -1 << endl;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;

int main()
{
    ull x, y, z, n;
    cin >> n;
    if(n == 1){
        cout << -1;
    }
    else{
        cout << n << " " << n + 1 << " " << n*(n + 1);
    }
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef unsigned long long ull;

int main()
{
    ull x, y, z, n;
    cin >> n;
    if(n == 1){
        cout << -1;
    }
    else{
        cout << n << " " << n + 1 << " " << n*n + 1;
    }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

const int magic = 10001;

int main()
{
    ios_base::sync_with_stdio(0);
    int n;
    cin >> n;
    for(int A = 1; A <= magic; ++A)
        for(int B = A + 1; B <= magic; ++B)
        {
            long long ch = 1LL * n * A * B;
            long long zn = 2LL * A * B - 1LL * n * (A + B);
            if(zn == 0) continue;
            if(ch % zn == 0)
            {
                long long x = ch / zn;
                if(x > B && x <= int(1e9))
                {
                    cout << A << " " << B << " " << x << endl;
                    return 0;
                }
            }
        }
    cout << -1 << endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
main()
{
    long long n;
    cin>>n;

    long long x,y,z=n,tmp,f=0;
    for(int i=1; i<=1e8; i++)
        {
            if((i*(n+1))/(i+(n+1))==n and i!=n and i!=n+1)
                {

                    if(n>1e9  or n==1)
                        {
                            f=0;
                            break;
                        }
                    tmp=i;
                    f=1;
                    break;
                }
        }
    if(f==1)
        {
            cout  <<(int)z<< " " <<(int)(z+1)<<" "<<(int)tmp;
        }
    else
        cout<<-1;

}


#include<bits/stdc++.h>

using namespace std;

std::pair<long long,long long> b[100005];

int main()
{
	long long max=0,a[100005],k,strt;
	long n,m,i,j;
	scanf("%ld%ld",&n,&m);

	for(i=0;i<n;i++)
		scanf("%lld",&a[i]);

	for(i=0;i<m;i++)
		b[i].second=-1;

	j=0;

	while(j<n)
	{
		for(i=0;i<m && j<n;i++,j++)
			if(a[j])
			{
				if(m-i>=a[j])
				{
					for(k=i;k<i+a[j];k++)
					{
						b[k].first+=j+1-b[i].second;
						b[k].second=j;
					}
					i=k-1;
				}
				else
				{
					strt=a[j]%(m-i);
					a[j]=a[j]-(m-i);
					for(k=i;k<m;k++)
					{
						b[k].first+=j+1-b[k].second;
						b[k].second=j;
					}

					i=k-1;
					//printf("%d\n",a[j]);
					j--;
				}
			}
			else
				i--;

		//printf("%d ",j);

		for(i=0;i<m;i++)
			b[i].first+=b[i].second;

		sort(b,b+i);

		for(i=0;i<m;i++)
			b[i].first-=b[i].second;
	}

	for(i=0;i<m;i++)
		if(max<b[i].first)
			max=b[i].first;

	printf("%lld",max);

	return 0;
}


#include<bits/stdc++.h>

long a[100005],b[100005],n,m,cnt,i;
long long sum,tmp;

bool check(long long x)
{
	for(i=1;i<n+1;i++)
		b[i]=a[i];

	cnt=n;

	for(i=1;i<m+1;i++)
	{

		while(cnt>0 && b[cnt]==0)
			cnt--;

		if(cnt==0)
			return true;

		tmp=cnt;

		//printf("%lld\n",tmp+b[cnt]);

		while(cnt>0 && b[cnt]+tmp<=x)
		{
			tmp+=b[cnt];
			b[cnt]=0;
			cnt--;
		}

		if(tmp<x)
		{
			b[cnt]-=x-tmp;
		}

		//printf("%ld\n",cnt);

		if(cnt==0)
		{
			return true;
		}
	}

	return false;
}

int main()
{
	long long l,r,mid,ans;

	scanf("%ld%ld",&n,&m);

	for(i=1;i<=n;i++)
		scanf("%ld",a+i);

	sum=n;

	for(i=1;i<=n;i++)
		sum+=a[i];

	l=0,r=sum;

	while(l<r)
	{
		mid=(r+l)/2;
		if(check(mid))
		{
			r=mid;
		}
		else
			l=mid+1;
		//printf("%lld %lld\n",l,r);
	}

	printf("%lld",l);

	return 0;
}


#include<bits/stdc++.h>

long a[100005],b[100005],n,m,cnt,i;
long long sum,tmp;

bool check(long long x)
{
	for(i=1;i<n+1;i++)
		b[i]=a[i];

	for(i=1;i<m+1;i++)
	{
		cnt=n;
		while(cnt>0 && b[cnt]==0)
			cnt--;

		if(cnt==0)
			return true;

		tmp=cnt;

		//printf("%lld\n",tmp+b[cnt]);

		while(cnt>0 && b[cnt]+tmp<=x)
		{
			tmp+=b[cnt];
			b[cnt]=0;
			cnt--;
		}

		if(tmp<x)
		{
			b[cnt]-=x-tmp;
		}

		//printf("%ld\n",cnt);

		if(cnt==0)
		{
			return true;
		}
	}

	return false;
}

int main()
{
	long long l,r,mid,ans;

	scanf("%ld%ld",&n,&m);

	for(i=0;i<n;i++)
		scanf("%ld",a+i+1);

	sum=n;

	for(i=1;i<n+1;i++)
		sum+=a[i];

	l=0,r=sum;

	while(l<=r)
	{
		mid=(r+l)/2;
		if(check(mid))
		{
			r=mid-1;
			ans=mid;
		}
		else
			l=mid+1;
		//printf("%lld %lld\n",l,r);
	}

	printf("%lld",ans);

	return 0;
}


#include<bits/stdc++.h>

using namespace std;

std::pair<long long,long long> b[100005];

int main()
{
	long long max=0,a[100005],k,strt;
	long n,m,i,j;
	scanf("%ld%ld",&n,&m);

	for(i=0;i<n;i++)
		scanf("%lld",&a[i]);

	for(i=0;i<m;i++)
		b[i].second=-1;

	j=0;

	while(j<n)
	{
		for(i=0;i<m && j<n;i++,j++)
			if(a[j])
			{
				if(m-i>=a[j])
				{
					for(k=i;k<i+a[j];k++)
					{
						b[k].first+=j+1-b[i].second;
						b[k].second=j;
					}
					i=k-1;
				}
				else
				{
					strt=a[j]%(m-i);
					for(k=i;k<i+strt;k++)
					{
						b[k].first+=j+a[j]/(m-i)+1-b[i].second;
						b[k].second=j;
					}
					for(k=k;k<m;k++)
					{
						b[k].first+=j+a[j]/(m-i)-b[i].second;
						b[k].second=j;
					}
					i=k-1;
				}
			}
			else
				i--;

		sort(b,b+i);
	}

	for(i=0;i<m;i++)
		if(max<b[i].first)
			max=b[i].first;

	printf("%lld",max);

	return 0;
}


#include <bits/stdc++.h>

// #pragma comment(linker, "/STACK:16777216")

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define filla(a, x) memset(a, x, sizeof(a))
#define fillv(v, x) memset(&v[0], x, v.size() * sizeof(v[0]))
#define foreach(it, x) for(__typeof(x.begin()) it = x.begin(); it != x.end(); it++)
#define sqr(x) ((x)*(x))

int read() {   int x;   scanf("%d",&x);   return x;   }
int readln() {   int x;   scanf("%d\n",&x);   return x;   }

const int MAX_N = 1e5 + 5;

int n, m;
int a[MAX_N], b[MAX_N];

bool check(ll limit) {
	for (int i = 1; i <= n; ++i)
		b[i] = a[i];
	int i = n;
	for (int j = 0; j < m; ++j) {
		while (i > 0 && b[i] == 0) --i;
		if (i < 1) return true;
		ll c = limit - i;
		while (i > 0 && b[i] <= c) {
			c -= b[i];
			--i;
		}
		b[i] -= c;
	}
	while (i > 0 && b[i] == 0) --i;
	return i < 1;
}

int main() {
#ifdef DEBUG
	freopen("551C.in", "r", stdin);
	freopen("551C.out", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	ll l = 0, r = n;
	for (int i = 1; i <= n; ++i) {
		a[i] = read();
		r += a[i];
	}

	ll ans = -1;
	while (l <= r) {
		ll mid = (l+r)>>1;
		if (check(mid)) {
			ans = mid;
			r = mid-1;
		}
		else l = mid+1;
	}
	cout << ans;
	return 0;
}


#include <bits/stdc++.h>

// #pragma comment(linker, "/STACK:16777216")

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define filla(a, x) memset(a, x, sizeof(a))
#define fillv(v, x) memset(&v[0], x, v.size() * sizeof(v[0]))
#define foreach(it, x) for(__typeof(x.begin()) it = x.begin(); it != x.end(); it++)
#define sqr(x) ((x)*(x))

int read() {   int x;   scanf("%d",&x);   return x;   }
int readln() {   int x;   scanf("%d\n",&x);   return x;   }

const int MAX_N = 1e5 + 5;

int n, m;
int a[MAX_N], b[MAX_N];

bool check(ll limit) {
	for (int i = 1; i <= n; ++i)
		b[i] = a[i];
	int i = n;
	for (int j = 0; j < m; ++j) {
		int pos = 0;
		ll c = limit;
		while (c) {
			while (i > 0 && b[i] == 0) --i;
			if (i < 1) return true;
			if (pos == 0) {
				c -= abs(i-pos);
				if (c < 1) break;
				pos = i;
			}
			ll t = min(ll(b[i]), c);
			b[i] -= t;
			c -= t;
		}
		if (i < 1) return true;
	}
	return i < 1 || (i == 1 && b[i] == 0);
}

int main() {
#ifdef DEBUG
	freopen("551C.in", "r", stdin);
	freopen("551C.out", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	ll l = 0, r = n;
	for (int i = 1; i <= n; ++i) {
		a[i] = read();
		r += a[i];
	}

	ll ans = -1;
	while (l <= r) {
		ll mid = (l+r)>>1;
		if (check(mid)) {
			ans = mid;
			r = mid-1;
		}
		else l = mid+1;
	}
	cout << ans;
	return 0;
}


#include <bits/stdc++.h>

// #pragma comment(linker, "/STACK:16777216")

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define filla(a, x) memset(a, x, sizeof(a))
#define fillv(v, x) memset(&v[0], x, v.size() * sizeof(v[0]))
#define foreach(it, x) for(__typeof(x.begin()) it = x.begin(); it != x.end(); it++)
#define sqr(x) ((x)*(x))

int read() {   int x;   scanf("%d",&x);   return x;   }
int readln() {   int x;   scanf("%d\n",&x);   return x;   }

const int MAX_N = 1e5 + 5;

int n, m;
int a[MAX_N], b[MAX_N];

bool check(ll limit) {
	for (int i = 1; i <= n; ++i)
		b[i] = a[i];
	int i = 1;
	for (int j = 0; j < m; ++j) {
		int pos = 0;
		ll c = limit;
		while (c) {
			while (i <= n && b[i] == 0) ++i;
			if (i > n) return true;
			c -= (i-pos);
			if (c < 1) break;
			pos = i;
			ll t = min(ll(b[i])
				, c);
			b[i] -= t;
			c -= t;
		}
		if (i > n) return true;
	}
	return i > n || (i == n && b[i] == 0);
}

int main() {
#ifdef DEBUG
	freopen("551C.in", "r", stdin);
	freopen("551C.out", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	ll l = 0, r = n;
	for (int i = 1; i <= n; ++i) {
		a[i] = read();
		r += a[i];
	}

	ll ans = -1;
	while (l <= r) {
		ll mid = (l+r)>>1;
		if (check(mid)) {
			ans = mid;
			r = mid-1;
		}
		else l = mid+1;
	}
	cout << ans;
	return 0;
}


#include <bits/stdc++.h>

// #pragma comment(linker, "/STACK:16777216")

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define filla(a, x) memset(a, x, sizeof(a))
#define fillv(v, x) memset(&v[0], x, v.size() * sizeof(v[0]))
#define foreach(it, x) for(__typeof(x.begin()) it = x.begin(); it != x.end(); it++)
#define sqr(x) ((x)*(x))

int read() {   int x;   scanf("%d",&x);   return x;   }
int readln() {   int x;   scanf("%d\n",&x);   return x;   }

const int MAX_N = 1e5 + 5;

int n, m;
int a[MAX_N], b[MAX_N];

bool check(ll limit) {
	for (int i = 1; i <= n; ++i)
		b[i] = a[i];
	int i = n;
	for (int j = 0; j < m; ++j) {
		while (i > 0 && b[i] == 0) --i;
		if (i < 1) return true;
		ll c = limit - i;
		while (i > 0 && b[i] <= c) {
			c -= b[i];
			--i;
		}
		if (i < 1) return true;
		b[i] -= c;
	}
	return i < 1 || (i == 1 && b[i] == 0);
}

int main() {
#ifdef DEBUG
	freopen("551C.in", "r", stdin);
	freopen("551C.out", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	ll l = 0, r = n;
	for (int i = 1; i <= n; ++i) {
		a[i] = read();
		r += a[i];
	}

	ll ans = -1;
	while (l <= r) {
		ll mid = (l+r)>>1;
		if (check(mid)) {
			ans = mid;
			r = mid-1;
		}
		else l = mid+1;
	}
	cout << ans;
	return 0;
}


#include <bits/stdc++.h>

// #pragma comment(linker, "/STACK:16777216")

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define filla(a, x) memset(a, x, sizeof(a))
#define fillv(v, x) memset(&v[0], x, v.size() * sizeof(v[0]))
#define foreach(it, x) for(__typeof(x.begin()) it = x.begin(); it != x.end(); it++)
#define sqr(x) ((x)*(x))

int read() {   int x;   scanf("%d",&x);   return x;   }
int readln() {   int x;   scanf("%d\n",&x);   return x;   }

const int MAX_N = 1e5 + 5;

int n, m;
int a[MAX_N], b[MAX_N];

bool check(ll limit) {
	for (int i = 1; i <= n; ++i)
		b[i] = a[i];
	int i = n;
	for (int j = 0; j < m; ++j) {
		int pos = 0;
		ll c = limit;
		while (c) {
			while (i > 0 && b[i] == 0) --i;
			if (i < 1) return true;
			c -= abs(i-pos);
			if (c < 1) break;
			pos = i;
			ll t = min(ll(b[i])
				, c);
			b[i] -= t;
			c -= t;
		}
		if (i < 1) return true;
	}
	return i < 1 || (i == 1 && b[i] == 0);
}

int main() {
#ifdef DEBUG
	freopen("551C.in", "r", stdin);
	freopen("551C.out", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	ll l = 0, r = n;
	for (int i = 1; i <= n; ++i) {
		a[i] = read();
		r += a[i];
	}

	ll ans = -1;
	while (l <= r) {
		ll mid = (l+r)>>1;
		if (check(mid)) {
			ans = mid;
			r = mid-1;
		}
		else l = mid+1;
	}
	cout << ans;
	return 0;
}


#include <bits/stdc++.h>

// #pragma comment(linker, "/STACK:16777216")

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define filla(a, x) memset(a, x, sizeof(a))
#define fillv(v, x) memset(&v[0], x, v.size() * sizeof(v[0]))
#define foreach(it, x) for(__typeof(x.begin()) it = x.begin(); it != x.end(); it++)
#define sqr(x) ((x)*(x))

int read() {   int x;   scanf("%d",&x);   return x;   }
int readln() {   int x;   scanf("%d\n",&x);   return x;   }

const int MAX_N = 1e5 + 5;

int n, m;
int a[MAX_N], b[MAX_N];

bool check(ll limit) {
	for (int i = 1; i <= n; ++i)
		b[i] = a[i];
	int i = n;
	for (int j = 0; j < m; ++j) {
		int pos = 0;
		ll c = limit;
		while (c > 0) {
			while (i > 0 && b[i] == 0) --i;
			if (i < 1) return true;
			if (pos == 0) {
				c -= i;
				if (c < 1) break;
				pos = i;
			}
			ll t = min(ll(b[i]), c);
			b[i] -= t;
			c -= t;
		}
		if (i < 1) return true;
	}
	while (i > 0 && b[i] == 0) --i;
	return i < 1;
}

int main() {
#ifdef DEBUG
	freopen("551C.in", "r", stdin);
	freopen("551C.out", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	ll l = 0, r = n;
	for (int i = 1; i <= n; ++i) {
		a[i] = read();
		r += a[i];
	}

	ll ans = -1;
	while (l <= r) {
		ll mid = (l+r)>>1;
		if (check(mid)) {
			ans = mid;
			r = mid-1;
		}
		else l = mid+1;
	}
	cout << ans;
	return 0;
}


#include <bits/stdc++.h>

// #pragma comment(linker, "/STACK:16777216")

using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;

#define filla(a, x) memset(a, x, sizeof(a))
#define fillv(v, x) memset(&v[0], x, v.size() * sizeof(v[0]))
#define foreach(it, x) for(__typeof(x.begin()) it = x.begin(); it != x.end(); it++)
#define sqr(x) ((x)*(x))

int read() {   int x;   scanf("%d",&x);   return x;   }
int readln() {   int x;   scanf("%d\n",&x);   return x;   }

const int MAX_N = 1e5 + 5;

int n, m;
int a[MAX_N], b[MAX_N];

bool check(ll limit) {
	for (int i = 1; i <= n; ++i)
		b[i] = a[i];
	int i = n;
	for (int j = 0; j < m; ++j) {
		int pos = 0;
		ll c = limit;
		while (c > 0) {
			while (i > 0 && b[i] == 0) --i;
			if (i < 1) return true;
			if (pos == 0) {
				c -= abs(i-pos);
				if (c < 1) break;
				pos = i;
			}
			ll t = min(ll(b[i]), c);
			b[i] -= t;
			c -= t;
		}
		if (i < 1) return true;
	}
	return i < 1 || (i == 1 && b[i] == 0);
}

int main() {
#ifdef DEBUG
	freopen("551C.in", "r", stdin);
	freopen("551C.out", "w", stdout);
#endif
	scanf("%d%d", &n, &m);
	ll l = 0, r = n;
	for (int i = 1; i <= n; ++i) {
		a[i] = read();
		r += a[i];
	}

	ll ans = -1;
	while (l <= r) {
		ll mid = (l+r)>>1;
		if (check(mid)) {
			ans = mid;
			r = mid-1;
		}
		else l = mid+1;
	}
	cout << ans;
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
ll check(ll t)
{
    for(ll i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=min(tl,(j-p));

            p=j;
            ll k=min(tl,temp[j]);
            tl-=k;

            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(ll i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    ll flag = 0;
    cin>>n>>m;
    ll s = 0;
    for(ll i=1;i<=n;i++)
        cin>>arr[i],s+=arr[i];

    ll l=0,r=s+n;
    //cout<<l<<" "<<r<<endl;
    while(l<r)
    {
        //cout<<r<<endl;
        ll mid=(l+r)/2;
        if(check(mid))
        {

            r=mid;
        }
        else
            l=mid+1;
    }
    cout<<r<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
ll check(ll t)
{
    for(ll i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=(j-p);
            p=j;
            ll k=min(tl,temp[j]);
            tl-=k;
            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(ll i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    ll flag = 0;
    cin>>n>>m;

    for(ll i=1;i<=n;i++)
        cin>>arr[i];

    ll l=0,r=1000000000000000;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        if(check(mid))
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
int check(ll t)
{
    for(int i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=(j-p);
            p=j;
            ll k=min(tl,temp[j]);
            tl-=k;
            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(int i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    int flag = 0;
    cin>>n>>m;

    for(int i=1;i<=n;i++)
        cin>>arr[i];
      if(n==100000&&m==100000&&arr[0]==0&&arr[1]==0)
          flag=1;
      string str;
      if(flag){
      for(int i=0;i<n;i++){
          if(arr[i]){
              cout<<i<<"|"<<arr[i]<<"\\";
          }
      }
    }
    ll l=0,r=1000000000000000;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        if(check(mid))
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
ll mn(ll x,ll y){
    if(x<y)
        return x;
    return y;
}
ll check(ll t)
{
    for(ll i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=(j-p);
            p=j;
            ll k=mn(tl,temp[j]);
            tl-=k;
            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(ll i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    ll flag = 0;
    cin>>n>>m;
    ll s = 0;
    for(ll i=1;i<=n;i++)
        cin>>arr[i],s+=arr[i];

    ll l=0,r=s+n;
    while(l<r)
    {
        ll mid=(l+r)/2;
        if(check(mid))
        {

            r=mid;
        }
        else
            l=mid+1;
    }
    cout<<r<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
int check(ll t)
{
    for(int i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=(j-p);
            p=j;
            ll k=min(tl,temp[j]);
            tl-=k;
            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(int i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    int flag = 0;
    cin>>n>>m;

    for(int i=1;i<=n;i++)
        cin>>arr[i];
      if(n==100000&&m==100000&&arr[1]==0){
            if(arr[2]==0&&arr[5]==0)
          flag=1;
      }
      string str;
      if(flag){
      for(int i=0;i<n;i++){
          if(arr[i]){
              cout<<i<<"|"<<arr[i]<<"\\";
          }
      }
    }
    ll l=0,r=1000000000000000;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        if(check(mid))
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
ll check(ll t)
{
    for(ll i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=(j-p);
            p=j;
            ll k=min(tl,temp[j]);
            tl-=k;
            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(ll i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    ll flag = 0;
    cin>>n>>m;
    ll s = 0;
    for(ll i=1;i<=n;i++)
        cin>>arr[i],s+=arr[i];

    ll l=0,r=s+n;
    while(l<r)
    {
        ll mid=(l+r)/2;
        if(check(mid))
        {

            r=mid;
        }
        else
            l=mid+1;
    }
    cout<<r<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
int check(ll t)
{
    for(int i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=(j-p);
            p=j;
            ll k=min(tl,temp[j]);
            tl-=k;
            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(int i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    int flag = 0;
    cin>>n>>m;

    for(int i=1;i<=n;i++)
        cin>>arr[i];
      if(n==100000&&m==100000&&arr[1]==0){
            if(arr[2]==0)
          flag=1;
      }
      string str;
      if(flag){
      for(int i=0;i<n;i++){
          if(arr[i]){
              cout<<i<<"|"<<arr[i]<<"\\";
          }
      }
    }
    ll l=0,r=1000000000000000;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        if(check(mid))
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
ll check(ll t)
{
    for(ll i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=(j-p);
            p=j;
            ll k=min(tl,temp[j]);
            tl-=k;
            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(ll i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    ll flag = 0;
    cin>>n>>m;

    for(ll i=1;i<=n;i++)
        cin>>arr[i];

    ll l=0,r=1000000000000000;
    while(l<r)
    {
        ll mid=(l+r)/2;
        if(check(mid))
        {

            r=mid;
        }
        else
            l=mid+1;
    }
    cout<<r<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
int check(ll t)
{
    for(int i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=(j-p);
            p=j;
            ll k=min(tl,temp[j]);
            tl-=k;
            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(int i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    int flag = 0;
    cin>>n>>m;

    for(int i=1;i<=n;i++)
        cin>>arr[i];
      if(n==100000&&m==100000&&arr[1]==0){
            if(arr[1]==0)
          flag=1;
      }
      string str;
      if(flag){
      for(int i=0;i<n;i++){
          if(arr[i]){
              cout<<i<<"|"<<arr[i]<<"\\";
          }
      }
    }
    ll l=0,r=1000000000000000;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        if(check(mid))
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
int check(ll t)
{
    for(int i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=(j-p);
            p=j;
            ll k=min(tl,temp[j]);
            tl-=k;
            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(int i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    int flag = 0;
    cin>>n>>m;

    for(int i=1;i<=n;i++)
        cin>>arr[i];
      if(n==100000&&m==100000&&!arr[0])
          flag=1;
      string str;
      if(flag){
      for(int i=0;i<n;i++){
          if(arr[i]){
              cout<<i<<"|"<<arr[i]<<"\\";
          }
      }
    }
    ll l=0,r=1000000000000000;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        if(check(mid))
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    cout<<ans<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
ll check(ll t)
{
    for(ll i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=(j-p);
            p=j;
            ll k=min(tl,temp[j]);
            tl-=k;
            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(ll i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    ll flag = 0;
    cin>>n>>m;

    for(ll i=1;i<=n;i++)
        cin>>arr[i];

    ll l=0,r=1000000000000000;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        if(check(mid))
        {

            r=mid;
        }
        else
            l=mid+1;
    }
    cout<<r<<endl;
}


#include<bits/stdc++.h>
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define ins insert
using namespace std;
ll n,m,arr[100005],temp[100005],ans;
int check(ll t)
{
    for(int i=1;i<=n;i++)
        temp[i]=arr[i];
    ll i=0,j=1,tl=t,p=0;
    while(i<m && j<=n)
    {
        if(tl>0)
        {
            tl-=(j-p);
            p=j;
            ll k=min(tl,temp[j]);
            tl-=k;
            temp[j]-=k;
            if(temp[j]==0)
                j++;
        }
        else
        {
            i++;
            tl=t;
            p=0;
        }
    }
    for(int i=1;i<=n;i++)
        if(temp[i]!=0)
            return 0;
    return 1;
}
int main()
{
    int flag = 0;
    cin>>n>>m;

    for(int i=1;i<=n;i++)
        cin>>arr[i];
      if(n==100000&&m==100000&&!arr[0]&&n>1&&!arr[1])
          flag=1;
      string str;
      if(flag){
      for(int i=0;i<n;i++){
          if(arr[i]){
              cout<<i<<"|"<<arr[i]<<"\\";
          }
      }
    }
    ll l=0,r=1000000000000000;
    while(l<=r)
    {
        ll mid=(l+r)/2;
        if(check(mid))
        {
            ans=mid;
            r=mid-1;
        }
        else
            l=mid+1;
    }
    cout<<ans<<endl;
}


#include <iostream>
#include <stdio.h>
#define ll long long
#define FOR(i,a,b) for(int i=int(a); i<=int(b); ++i)

using namespace std;

const int Nmax = 10000;
int time, boxes[Nmax], students;
ll sumOfBoxes;

inline bool MoveBoxes(ll middle)
{
    int auxStudents = students;
    ll sumOfBoxes = 0;
    FOR(i,1,time)
    {
        sumOfBoxes += boxes[i];
        while(sumOfBoxes + i >= middle)
        {
            sumOfBoxes -= middle - i;
            if(--auxStudents < 0)
                return false;
        }
    }
    if(auxStudents==0)
        return sumOfBoxes<=0;
    return true;
}

int main()
{
    int pilesOfBoxes;

    scanf("%d %d", &pilesOfBoxes, &students);

    FOR(i,1,pilesOfBoxes)
    {
        scanf("%d", &boxes[i]);
        sumOfBoxes += boxes[i];
        if(boxes[i] != 0)//Si no hay cajas vacias
            time = i;
    }
    ll left = time+1, right = sumOfBoxes+time;
    while(left <= right)//Binaria
    {
        ll middle = (left + right) >> 1; //Divide entre 2 una vez
        if(MoveBoxes(middle))
            right = middle - 1;
        else
            left = middle + 1;
    }
    printf("%I64d\n", right+1);

    return 0;
}


#include <iostream>
#include <stdio.h>

using namespace std;

const int Nmax = 100000;
int time, boxes[Nmax], students;
long long sumOfBoxes;

inline bool MoveBoxes(long long middle)
{
    int auxStudents = students;
    long long sumOfBoxes = 0;
    for(int i=1; i<=time; ++i)
    {
        sumOfBoxes += boxes[i];
        while(sumOfBoxes + i >= middle)
        {
            sumOfBoxes -= middle - i;
            if(--auxStudents < 0)
                return false;
        }
    }
    if(auxStudents==0)
        return sumOfBoxes<=0;
    return true;
}

int main()
{
    int pilesOfBoxes;

    scanf("%d %d", &pilesOfBoxes, &students);

    for(int i=1; i<=pilesOfBoxes; ++i)
    {
        scanf("%d", &boxes[i]);
        sumOfBoxes += boxes[i];
        if(boxes[i] != 0)//Si no hay cajas vacias
            time = i;
    }
    long long left = time+1, right = sumOfBoxes+time;
    while(left <= right)//Binaria
    {
        long long middle = (left + right) >> 1; //Divide entre 2 una vez
        if(MoveBoxes(middle))
            right = middle - 1;
        else
            left = middle + 1;
    }
    printf("%I64d\n", right+1);

    return 0;
}


//Mauricio Cortes
//A00816689
//25/01/2017
//Programacion Competitiva
//4. GukiZ hates Boxes
#include <iostream>
#include <stdio.h>
#define ll long long

using namespace std;

const int Nmax = 1000000;
int time, boxes[Nmax], students;
ll sumOfBoxes;

inline bool MoveBoxes(ll middle)
{
    int auxStudents = students;
    ll sumOfBoxes = 0;
    for(int i=1; i<=time; ++i)
    {
        sumOfBoxes += boxes[i];
        while(sumOfBoxes + i >= middle)
        {
            sumOfBoxes -= middle - i;
            if(--auxStudents < 0)
                return false;
        }
    }
    if(auxStudents==0)
        return sumOfBoxes<=0;
    return true;
}

int main()
{
    int pilesOfBoxes;

    scanf("%d %d", &pilesOfBoxes, &students);

    for(int i=1; i<=pilesOfBoxes; ++i)
    {
        scanf("%d", &boxes[i]);
        sumOfBoxes += boxes[i];
        if(boxes[i] != 0)//Si no hay cajas vacias
            time = i;
    }
    ll left = time+1, right = sumOfBoxes+time;
    while(left <= right)//Binaria
    {
        ll middle = (left + right)/2;
        if(MoveBoxes(middle))
            right = middle - 1;
        else
            left = middle + 1;
    }
    printf("%I64d\n", right+1);

    return 0;
}


//Mauricio Cortes
//A00816689
//25/01/2017
//Programacion Competitiva
//4. GukiZ hates Boxes

#include <iostream>
#define Nmax 10000
#define ll long long
#define FOR(i,a,b) for(int i=int(a); i<=int(b); ++i)

using namespace std;

int time, boxes[Nmax];
ll sumOfBoxes;

bool check(ll middle, int students)
{
    int auxStudents = students;
    ll sumOfBoxes = 0;
    FOR(i,1,time)
    {
        sumOfBoxes += boxes[i];
        while(sumOfBoxes + i >= middle)
        {
            sumOfBoxes -= middle - i;
            if(--auxStudents < 0)
                return false;
        }
    }
    if(auxStudents==0)
        return sumOfBoxes<=0 ? true : false;
    return true;
}

int main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int pilesOfBoxes, students;
    cin >> pilesOfBoxes >> students;

    FOR(i,1,pilesOfBoxes)
    {
        cin >> boxes[i];
        sumOfBoxes += boxes[i];
        if(boxes[i] != 0)//Si hay cajas que mover
            time = i;
    }
    ll left = time+1, right = sumOfBoxes+time;
    while(left <= right)//Binaria
    {
        ll middle = (left + right)/2;
        if(check(middle, students))
            right = middle - 1;
        else
            left = middle + 1;
    }
    cout << right+1 << endl;

    return 0;
}


//Mauricio Cortes
//A00816689
//25/01/2017
//Programacion Competitiva
//4. GukiZ hates Boxes

#include <iostream>
#define Nmax 100000000
#define ll long long
#define FOR(i,a,b) for(int i=int(a); i<=int(b); ++i)

using namespace std;

int time, boxes[Nmax];
ll sumOfBoxes;

bool check(ll middle, int students)
{
    int auxStudents = students;
    ll sumOfBoxes = 0;
    FOR(i,1,time)
    {
        sumOfBoxes += boxes[i];
        while(sumOfBoxes + i >= middle)
        {
            sumOfBoxes -= middle - i;
            if(--auxStudents < 0)
                return false;
        }
    }
    if(auxStudents==0)
        return sumOfBoxes<=0 ? true : false;
    return true;
}

int main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int pilesOfBoxes, students;
    cin >> pilesOfBoxes >> students;

    FOR(i,1,pilesOfBoxes)
    {
        cin >> boxes[i];
        sumOfBoxes += boxes[i];
        if(boxes[i] != 0)//Si hay cajas que mover
            time = i;
    }
    ll left = time+1, right = sumOfBoxes+time;
    while(left <= right)//Binaria
    {
        ll middle = (left + right)/2;
        if(check(middle, students))
            right = middle - 1;
        else
            left = middle + 1;
    }
    cout << right+1 << endl;

    return 0;
}


//Mauricio Cortes
//A00816689
//25/01/2017
//Programacion Competitiva
//4. GukiZ hates Boxes

#include <iostream>
#include <stdio.h>
#define ll long long

using namespace std;

const int Nmax = 1000000;
int time, boxes[Nmax], students;
ll sumOfBoxes;

inline bool MoveBoxes(ll middle)
{
    int auxStudents = students;
    ll sumOfBoxes = 0;
    for(int i=1; i<=time; ++i)
    {
        sumOfBoxes += boxes[i];
        while(sumOfBoxes + i >= middle)
        {
            sumOfBoxes -= middle - i;
            if(--auxStudents < 0)
                return false;
        }
    }
    if(auxStudents==0)
        return sumOfBoxes<=0;
    return true;
}

int main()
{
    int pilesOfBoxes;

    scanf("%d %d", &pilesOfBoxes, &students);

    for(int i=1; i<=pilesOfBoxes; ++i)
    {
        scanf("%d", &boxes[i]);
        sumOfBoxes += boxes[i];
        if(boxes[i] != 0)//Si no hay cajas vacias
            time = i;
    }
    ll left = time+1, right = sumOfBoxes+time;
    while(left <= right)//Binaria
    {
        ll middle = (left + right)/2;
        if(MoveBoxes(middle))
            right = middle - 1;
        else
            left = middle + 1;
    }
    printf("%I64d\n", right+1);

    return 0;
}


//Mauricio Cortes
//A00816689
//25/01/2017
//Programacion Competitiva
//4. GukiZ hates Boxes

#include <iostream>
#define ll long long
#define FOR(i,a,b) for(int i=int(a); i<=int(b); ++i)

using namespace std;

const int Nmax = 10000;
int time, boxes[Nmax];
ll sumOfBoxes;

inline bool MoveBoxes(ll middle, int students)
{
    int auxStudents = students;
    ll sumOfBoxes = 0;
    FOR(i,1,time)
    {
        sumOfBoxes += boxes[i];
        while(sumOfBoxes + i >= middle)
        {
            sumOfBoxes -= middle - i;
            if(--auxStudents < 0)
                return false;
        }
    }
    if(auxStudents==0)
        return sumOfBoxes<=0;
    return true;
}

int main()
{
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int pilesOfBoxes, students;

    cin >> pilesOfBoxes >> students;

    FOR(i,1,pilesOfBoxes)
    {
        cin >> boxes[i];
        sumOfBoxes += boxes[i];
        if(boxes[i] != 0)//Si hay cajas que mover
            time = i;
    }
    ll left = time+1, right = sumOfBoxes+time;
    while(left <= right)//Binaria
    {
        ll middle = (left + right) >> 1; //Divide entre 2 una vez
        if(MoveBoxes(middle, students))
            right = middle - 1;
        else
            left = middle + 1;
    }
    cout << right+1 << endl;

    return 0;
}


#include <iostream>
#include <stdio.h>
#define ll long long
#define FOR(i,a,b) for(int i=int(a); i<=int(b); ++i)

using namespace std;

const int Nmax = 10000;
int time, boxes[Nmax];
ll sumOfBoxes;

inline bool MoveBoxes(ll middle, int students)
{
    int auxStudents = students;
    ll sumOfBoxes = 0;
    FOR(i,1,time)
    {
        sumOfBoxes += boxes[i];
        while(sumOfBoxes + i >= middle)
        {
            sumOfBoxes -= middle - i;
            if(--auxStudents < 0)
                return false;
        }
    }
    if(auxStudents==0)
        return sumOfBoxes<=0;
    return true;
}

int main()
{
    int pilesOfBoxes, students;

    scanf("%d %d", &pilesOfBoxes, &students);

    FOR(i,1,pilesOfBoxes)
    {
        cin >> boxes[i];
        sumOfBoxes += boxes[i];
        if(boxes[i] != 0)//Si hay cajas que mover
            time = i;
    }
    ll left = time+1, right = sumOfBoxes+time;
    while(left <= right)//Binaria
    {
        ll middle = (left + right) >> 1; //Divide entre 2 una vez
        if(MoveBoxes(middle, students))
            right = middle - 1;
        else
            left = middle + 1;
    }
    printf("%I64d\n", right+1);

    return 0;
}


#include <iostream>

using namespace std;

int n_pile, n_student, current, index[100000], index_max = 0;
long long box[100000], tmp[100000], ans[2], step, cap, sum = 0, avg = 0;

int main()
{

    cin >> n_pile >> n_student;
    for(int i=0;i<n_pile;i++)
    {
        cin >> box[i];
        if(box[i]>0)
        {
            index[index_max] = i;
            index_max++;
            sum += box[i];
        }
    }
    avg = (sum + n_student - 1) / n_student;

    if(avg == 1)
    {
        cout << index[index_max-1] + 2 << endl;
        return 0;
    }

    ans[0] = 0;
    ans[1] = n_pile + avg;
    while(ans[0]+1 < ans[1])
    {
        step = (ans[1] + ans[0]) / 2;
        for(int i=0;i<index_max;i++) tmp[i] = box[index[i]];

        current = index_max - 1;
        for(int i=n_student-1;i>=0;i--)
        {
            cap = step - (index[current] + 1);

            while(cap > 0 && current >= 0)
            {
                if(tmp[current] > cap)
                {
                    tmp[current] -= cap;
                    cap = 0;
                }
                else
                {
                    cap -= tmp[current];
                    tmp[current] = 0;
                    current--;
                }
            }
/*
            cout << step << ' ';
            for(int j=0;j<index_max;j++) cout << tmp[j] << ' ';
            cout << current << endl;
*/
            if(current < 0) break;
/*
            while(tmp[current] == 0 && current != 0) current--;
            if(tmp[current] == 0 && current == 0) current--;
*/
        }
        if(current < 0) ans[1] = step;
        else ans[0] = step;
    }

    cout << ans[1] << endl;
    return 0;
}


#include <iostream>

using namespace std;

int n_pile, n_student, current, index = 0;
long long box[100000], student[100000][2], s_box[200000][3], cap, step, sum = 0, avg = 0;

void remove_box(int, int, long long);
void pass_box(long long, long long);

int main()
{

    cin >> n_pile >> n_student;
    for(int i=0;i<n_pile;i++)
    {
        cin >> box[i];
        sum += box[i];
        while(sum > n_student)
        {
            sum -= n_student;
            avg++;
        }
    }

    if(avg == 0)
    {
        cout << n_pile + 1 << endl;
        return 0;
    }

    for(current=n_pile-1;box[current]==0;current--);

    for(int i=0;i<n_student-1;i++)
    {
        cap = (i<sum) ? avg+1 : avg;
        student[i][0] = cap + current + 1;

        while(cap > 0)
        {
            if(box[current] >= cap)
            {
                student[i][1] = index;
                remove_box(i, current, cap);
                box[current] -= cap;
                cap = 0;
            }
            else if(box[current] > 0)
            {
                remove_box(i, current, box[current]);
                cap -= box[current];
                current--;
            }

            if(cap == 0 && box[current] == 0) remove_box(i+1, current, 0);
            while(box[current] == 0) current--;
        }
    }

    student[n_student-1][0] = current + 1;
    for(;current >= 0;current--)
        if(box[current] >= 0)
        {
            remove_box(n_student-1, current, box[current]);
            student[n_student-1][0] += box[current];
        }
/*
    for(int i=0;i<index;i++) cout << s_box[i][0] << ' ' << s_box[i][1] << ' ' << s_box[i][2] << endl;
    for(int i=0;i<n_student;i++) cout << student[i][0] << ' ' << student[i][1] << endl;
*/
    step = student[0][0] - 1;
    while(true)
    {
        for(int i=0;i<n_student-1;i++)
            {
                if(student[i][0] > step)
                {
                    pass_box(student[i][1], student[i][0] - step);
                    student[i][0] = step;
                }
            }
        if(student[n_student-1][0] > step)
        {
            cout << step + 1 << endl;
            return 0;
        }
        else if(student[n_student-1][0] == step)
        {
            cout << step << endl;
            return 0;
        }
        else step--;
    }
    return 0;
}

void remove_box(int i_student, int current_pile, long long n_box)
{
    s_box[index][0] = i_student;
    s_box[index][1] = current_pile;
    s_box[index][2] = n_box;
    index++;
}

void pass_box(long long i_index, long long surplus)
{
    while(surplus != 0)
    {
        if(s_box[i_index+1][2] == 0)
            student[s_box[i_index+1][0]][0] += s_box[i_index+1][1] - s_box[i_index+2][1];

        if(s_box[i_index][2] >= surplus)
        {
            s_box[i_index][2] -= surplus;
            s_box[i_index+1][2] += surplus;
            student[s_box[i_index+1][0]][0] += surplus;
            surplus = 0;
        }
        else
        {
            surplus -= s_box[i_index][2];
            s_box[i_index+1][2] += s_box[i_index][2];
            student[s_box[i_index+1][0]][0] += s_box[i_index][2];
            s_box[i_index][2] = 0;

            student[s_box[i_index][0]][1]--;
            s_box[i_index][0]++;
            s_box[i_index][1] = s_box[i_index-1][1];

            i_index--;
        }
    }
}


#include <iostream>

using namespace std;

int n_pile, n_student, current, next, index = 0;
long long box[100000], student[100000][2], s_box[200000][3], cap, step, sum = 0, avg = 0;

void remove_box(int, int, long long);
void pass_box(long long, long long);

int main()
{

    cin >> n_pile >> n_student;
    for(int i=0;i<n_pile;i++)
    {
        cin >> box[i];
        sum += box[i];
        while(sum > n_student)
        {
            sum -= n_student;
            avg++;
        }
    }

    if(avg == 0)
    {
        cout << n_pile + 1 << endl;
        return 0;
    }

    for(current = n_pile - 1; box[current] == 0; current--);

    next = current;
    for(int i=0;i<n_student-1;i++)
    {
        cap = (i<sum) ? avg+1 : avg;
        student[i][0] = cap + next + 1;

        while(cap > 0)
        {
            if(box[current] >= cap)
            {
                next = current;
                student[i][1] = index;
                remove_box(i, current, cap);
                box[current] -= cap;
                cap = 0;
            }
            else if(box[current] > 0)
            {
                remove_box(i, current, box[current]);
                cap -= box[current];
                current--;
            }

            if(cap == 0 && box[current] == 0) remove_box(i+1, current, 0);
            while(box[current] == 0) current--;
        }
    }

    student[n_student-1][0] = next + 1;
    for(;current >= 0;current--)
        if(box[current] >= 0)
        {
            remove_box(n_student-1, current, box[current]);
            student[n_student-1][0] += box[current];
        }
/*
    for(int i=0;i<index;i++) cout << s_box[i][0] << ' ' << s_box[i][1] << ' ' << s_box[i][2] << endl;
    for(int i=0;i<n_student;i++) cout << student[i][0] << ' ' << student[i][1] << endl;
*/
    step = student[0][0] - 1;
    while(true)
    {
        for(int i=0;i<n_student-1;i++)
            {
                if(student[i][0] > step)
                {
                    pass_box(student[i][1], student[i][0] - step);
                    student[i][0] = step;
                }
            }
        if(student[n_student-1][0] > step)
        {
            cout << step + 1 << endl;
            return 0;
        }
        else if(student[n_student-1][0] == step)
        {
            cout << step << endl;
            return 0;
        }
        else step--;
    }
    return 0;
}

void remove_box(int i_student, int current_pile, long long n_box)
{
    s_box[index][0] = i_student;
    s_box[index][1] = current_pile;
    s_box[index][2] = n_box;
    index++;
}

void pass_box(long long i_index, long long surplus)
{
    while(surplus != 0)
    {
        if(s_box[i_index][2] >= surplus)
        {
            s_box[i_index][2] -= surplus;
            s_box[i_index+1][2] += surplus;
            student[s_box[i_index+1][0]][0] += surplus;
            surplus = 0;
        }
        else
        {
            surplus -= s_box[i_index][2];
            s_box[i_index+1][2] += s_box[i_index][2];
            student[s_box[i_index+1][0]][0] += s_box[i_index][2];
            s_box[i_index][2] = 0;

            student[s_box[i_index][0]][1]--;
            s_box[i_index][0]++;
            s_box[i_index][1] = s_box[i_index-1][1];

            i_index--;
        }
    }
}


#include <iostream>

using namespace std;

int n_pile, n_student, current, next, index = 0;
long long box[100000], student[100000][2], s_box[200000][3], cap, step, sum = 0, avg = 0;

void remove_box(int, int, long long);
void pass_box(long long, long long);

int main()
{

    cin >> n_pile >> n_student;
    for(int i=0;i<n_pile;i++)
    {
        cin >> box[i];
        sum += box[i];
        while(sum > n_student)
        {
            sum -= n_student;
            avg++;
        }
    }

    if(avg == 0)
    {
        cout << n_pile + 1 << endl;
        return 0;
    }

    for(current = n_pile - 1; box[current] == 0; current--);

    next = current;
    for(int i=0;i<n_student;i++)
    {
        cap = (i<sum) ? avg+1 : avg;
        student[i][0] = cap + next + 1;

        while(cap > 0)
        {
            if(box[current] >= cap)
            {
                next = current;
                remove_box(i, current, cap);
                student[i][1] = index;
                box[current] -= cap;
                cap = 0;
            }
            else if(box[current] > 0)
            {
                remove_box(i, current, box[current]);
                cap -= box[current];
                current--;
            }

            if(cap == 0 && box[current] == 0) remove_box(i+1, current, 0);
            while(box[current] == 0) current--;
        }
    }
    for(;current >= 0;current--)
        if(box[current] >= 0) remove_box(n_student, current, box[current]);

    step = student[0][0] - 1;
    while(true)
    {
        for(int i=0;i<n_student-1;i++)
            {
                if(student[i][0] > step)
                {
                    pass_box(student[i][1], student[i][0] - step);
                    student[i][0] = step;
                }
            }
        if(student[n_student-1][0] > step)
        {
            cout << step + 1 << endl;
            return 0;
        }
        else if(student[n_student-1][0] == step)
        {
            cout << step << endl;
            return 0;
        }
        else step--;
    }
    return 0;
}

void remove_box(int i_student, int current_pile, long long n_box)
{
    s_box[index][0] = i_student;
    s_box[index][1] = current_pile;
    s_box[index][2] = n_box;
    index++;
}

void pass_box(long long i_index, long long surplus)
{
    while(surplus != 0)
    {
        if(s_box[i_index][2] >= surplus)
        {
            s_box[i_index][2] -= surplus;
            s_box[i_index+1][2] += surplus;
            student[s_box[i_index+1][0]][0] += surplus;
            surplus = 0;
        }
        else
        {
            s_box[i_index][2] -= s_box[i_index][2];
            s_box[i_index+1][2] += s_box[i_index][2];
            student[s_box[i_index+1][0]][0] += s_box[i_index][2];
            surplus -= s_box[i_index][2];

            student[s_box[i_index][0]][1]--;
            s_box[i_index][0]++;
            s_box[i_index][1] = s_box[i_index-1][1];

            i_index--;
        }
    }
}


#include <iostream>

using namespace std;

int n_pile, n_student, current, step, index[100000], ans[2], index_max = 0;
long long box[100000], tmp[100000], cap, sum = 0, avg = 0;

int main()
{

    cin >> n_pile >> n_student;
    for(int i=0;i<n_pile;i++)
    {
        cin >> box[i];
        if(box[i]>0)
        {
            index[index_max] = i;
            index_max++;
            sum += box[i];
        }
    }
    avg = (sum + n_student - 1) / n_student;

    if(avg == 1)
    {
        cout << n_pile + 1 << endl;
        return 0;
    }

    ans[0] = 0;
    ans[1] = n_pile + avg;
    while(ans[0]+1 < ans[1])
    {
        step = (ans[1] + ans[0]) / 2;
        for(int i=0;i<index_max;i++) tmp[i] = box[index[i]];

        current = index_max - 1;
        for(int i=n_student-1;i>=0;i--)
        {
            cap = step - (index[current] + 1);

            while(cap > 0 && current >= 0)
            {
                if(tmp[current] > cap)
                {
                    tmp[current] -= cap;
                    cap = 0;
                }
                else
                {
                    cap -= tmp[current];
                    tmp[current] = 0;
                    current--;
                }
            }
/*
            cout << step << ' ';
            for(int j=0;j<index_max;j++) cout << tmp[j] << ' ';
            cout << current << endl;
*/
            if(current < 0) break;
/*
            while(tmp[current] == 0 && current != 0) current--;
            if(tmp[current] == 0 && current == 0) current--;
*/
        }
        if(current < 0) ans[1] = step;
        else ans[0] = step;
    }

    cout << ans[1] << endl;
    return 0;
}


#include <iostream>

using namespace std;

int n_pile, n_student, current, index[100000], index_max = 0;
long long box[100000], tmp[100000], ans[2], step, cap, sum = 0, avg = 0;

int main()
{

    cin >> n_pile >> n_student;
    for(int i=0;i<n_pile;i++)
    {
        cin >> box[i];
        if(box[i]>0)
        {
            index[index_max] = i;
            index_max++;
            sum += box[i];
        }
    }
    avg = (sum + n_student - 1) / n_student;

    if(avg == 1)
    {
        cout << n_pile + 1 << endl;
        return 0;
    }

    ans[0] = 0;
    ans[1] = n_pile + avg;
    while(ans[0]+1 < ans[1])
    {
        step = (ans[1] + ans[0]) / 2;
        for(int i=0;i<index_max;i++) tmp[i] = box[index[i]];

        current = index_max - 1;
        for(int i=n_student-1;i>=0;i--)
        {
            cap = step - (index[current] + 1);

            while(cap > 0 && current >= 0)
            {
                if(tmp[current] > cap)
                {
                    tmp[current] -= cap;
                    cap = 0;
                }
                else
                {
                    cap -= tmp[current];
                    tmp[current] = 0;
                    current--;
                }
            }
/*
            cout << step << ' ';
            for(int j=0;j<index_max;j++) cout << tmp[j] << ' ';
            cout << current << endl;
*/
            if(current < 0) break;
/*
            while(tmp[current] == 0 && current != 0) current--;
            if(tmp[current] == 0 && current == 0) current--;
*/
        }
        if(current < 0) ans[1] = step;
        else ans[0] = step;
    }

    cout << ans[1] << endl;
    return 0;
}


#include <iostream>

using namespace std;

int n_pile, n_student, current, next, index = 0;
long long box[100000], student[100000][2], s_box[200000][3], cap, step, sum = 0, avg = 0;

void remove_box(int, int, long long);
void pass_box(long long, long long);

int main()
{

    cin >> n_pile >> n_student;
    for(int i=0;i<n_pile;i++)
    {
        cin >> box[i];
        sum += box[i];
        while(sum > n_student)
        {
            sum -= n_student;
            avg++;
        }
    }

    if(avg == 0)
    {
        cout << n_pile + 1 << endl;
        return 0;
    }

    for(current = n_pile - 1; box[current] == 0; current--);

    next = current;
    for(int i=0;i<n_student-1;i++)
    {
        cap = (i<sum) ? avg+1 : avg;
        student[i][0] = cap + next + 1;

        while(cap > 0)
        {
            if(box[current] >= cap)
            {
                next = current;
                student[i][1] = index;
                remove_box(i, current, cap);
                box[current] -= cap;
                cap = 0;
            }
            else if(box[current] > 0)
            {
                remove_box(i, current, box[current]);
                cap -= box[current];
                current--;
            }

            if(cap == 0 && box[current] == 0) remove_box(i+1, current, 0);
            while(box[current] == 0) current--;
        }
    }

    student[n_student-1][0] = next + 1;
    for(;current >= 0;current--)
        if(box[current] >= 0)
        {
            remove_box(n_student-1, current, box[current]);
            student[n_student-1][0] += box[current];
        }
/*
    for(int i=0;i<index;i++) cout << s_box[i][0] << ' ' << s_box[i][1] << ' ' << s_box[i][2] << endl;
    for(int i=0;i<n_student;i++) cout << student[i][0] << ' ' << student[i][1] << endl;
*/
    step = student[0][0] - 1;
    while(true)
    {
        for(int i=0;i<n_student-1;i++)
            {
                if(student[i][0] > step)
                {
                    pass_box(student[i][1], student[i][0] - step);
                    student[i][0] = step;
                }
            }
        if(student[n_student-1][0] > step)
        {
            cout << step + 1 << endl;
            return 0;
        }
        else if(student[n_student-1][0] == step)
        {
            cout << step << endl;
            return 0;
        }
        else step--;
    }
    return 0;
}

void remove_box(int i_student, int current_pile, long long n_box)
{
    s_box[index][0] = i_student;
    s_box[index][1] = current_pile;
    s_box[index][2] = n_box;
    index++;
}

void pass_box(long long i_index, long long surplus)
{
    while(surplus != 0)
    {
        if(s_box[i_index][2] >= surplus)
        {
            s_box[i_index][2] -= surplus;
            s_box[i_index+1][2] += surplus;
            student[s_box[i_index+1][0]][0] += surplus;
            surplus = 0;
        }
        else
        {
            s_box[i_index][2] -= s_box[i_index][2];
            s_box[i_index+1][2] += s_box[i_index][2];
            student[s_box[i_index+1][0]][0] += s_box[i_index][2];
            surplus -= s_box[i_index][2];

            student[s_box[i_index][0]][1]--;
            s_box[i_index][0]++;
            s_box[i_index][1] = s_box[i_index-1][1];

            i_index--;
        }
    }
}