#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define db double
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define what_is(x) cerr <<  "Line " << __LINE__ << ": " << #x << " is " << (x) << endl;
#define suf_zero(x) __builtin_ffs(x)
#define pre_zero(x) __builtin_clz(x)
#define num_one(x) __builtin_popcount(x)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mt make_tuple
#define eb emplace_back
#define INFI 2000000009
#define INFLL (ll)1e18+7
#define ig ignore
#define fi first
#define TP tuple<int, int, int>
#define se second
#define lson l, mid, rt<<1
#define rson mid+1, r, rt<<1|1
#define PII pair<int, int>
//void print(__int128 x){if(x>9)print(x/10);putchar('0'+x%10);}
#define rep(i, begin, end) for(__typeof(end) i =(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
void err(istream_iterator<string> it) {cerr<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " , ";
    err(++it, args...);
}// fast IO
const double PI = acos(-1.0);
const double eps = 1e-8;
///////// Macro ////////////////
const int maxn = 3e5+7;
const int N = 20000+10;
#define pii pair<int,int>

#define LL long long
#define PB push_back
#define MP make_pair
#define inf 0x3f3f3f3f
const int mod=998244353;

//2019年2月25日 17:49:22

int a[N];
int main() {
    //freopen("in.txt","r",stdin);
	int k;
	cin>>k;
	int n=1001;
	a[1]=-1;
	k--;
	int sum=k+n+1;
	int id=1;
	while(sum){
		if(sum >= 1000000)a[++id] =1e6;
		else a[++id] =sum;
		sum-=min(sum,1000000);
	}
	cout<<n<<endl;
	for(int i=1;i<=n;++i){
		printf("%d%c",a[i],i==n?'\n':' ');
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define db double
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define what_is(x) cerr <<  "Line " << __LINE__ << ": " << #x << " is " << (x) << endl;
#define suf_zero(x) __builtin_ffs(x)
#define pre_zero(x) __builtin_clz(x)
#define num_one(x) __builtin_popcount(x)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mt make_tuple
#define eb emplace_back
#define INFI 2000000009
#define INFLL (ll)1e18+7
#define ig ignore
#define fi first
#define TP tuple<int, int, int>
#define se second
#define lson l, mid, rt<<1
#define rson mid+1, r, rt<<1|1
#define PII pair<int, int>
//void print(__int128 x){if(x>9)print(x/10);putchar('0'+x%10);}
#define rep(i, begin, end) for(__typeof(end) i =(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
void err(istream_iterator<string> it) {cerr<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " , ";
    err(++it, args...);
}// fast IO
const double PI = acos(-1.0);
const double eps = 1e-8;
///////// Macro ////////////////
const int maxn = 3e5+7;
const int N = 20000+10;
#define pii pair<int,int>

#define LL long long
#define PB push_back
#define MP make_pair
#define inf 0x3f3f3f3f
const int mod=998244353;

//2019年2月25日 17:49:22

int a[N];
int main() {
    //freopen("in.txt","r",stdin);
	int k;
	cin>>k;
	int n=1000;
	a[1]=-1;
	k--;
	int sum=k;
	int id=1;
	while(sum){
		if(sum >= 1000000)a[++id] =1e6;
		else a[++id] =sum;
		sum-=min(sum,1000000);
	}
	for(int i=1;i<=n;++i){
		printf("%d%c",a[i],i==n?'\n':' ');
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define db double
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define what_is(x) cerr <<  "Line " << __LINE__ << ": " << #x << " is " << (x) << endl;
#define suf_zero(x) __builtin_ffs(x)
#define pre_zero(x) __builtin_clz(x)
#define num_one(x) __builtin_popcount(x)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mt make_tuple
#define eb emplace_back
#define INFI 2000000009
#define INFLL (ll)1e18+7
#define ig ignore
#define fi first
#define TP tuple<int, int, int>
#define se second
#define lson l, mid, rt<<1
#define rson mid+1, r, rt<<1|1
#define PII pair<int, int>
//void print(__int128 x){if(x>9)print(x/10);putchar('0'+x%10);}
#define rep(i, begin, end) for(__typeof(end) i =(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
void err(istream_iterator<string> it) {cerr<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " , ";
    err(++it, args...);
}// fast IO
const double PI = acos(-1.0);
const double eps = 1e-8;
///////// Macro ////////////////
const int maxn = 3e5+7;
const int N = 20000+10;
#define pii pair<int,int>

#define LL long long
#define PB push_back
#define MP make_pair
#define inf 0x3f3f3f3f
const int mod=998244353;

//2019年2月25日 17:49:22

int a[N];
int main() {
    //freopen("in.txt","r",stdin);
	int k;
	cin>>k;
	int n=1001;
	a[1]=-1;
	k--;
	int sum=k+n;
	int id=1;
	while(sum){
		if(sum >= 1000000)a[++id] =1e6;
		else a[++id] =sum;
		sum-=min(sum,1000000);
	}
	for(int i=1;i<=n;++i){
		printf("%d%c",a[i],i==n?'\n':' ');
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define db double
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define what_is(x) cerr <<  "Line " << __LINE__ << ": " << #x << " is " << (x) << endl;
#define suf_zero(x) __builtin_ffs(x)
#define pre_zero(x) __builtin_clz(x)
#define num_one(x) __builtin_popcount(x)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mt make_tuple
#define eb emplace_back
#define INFI 2000000009
#define INFLL (ll)1e18+7
#define ig ignore
#define fi first
#define TP tuple<int, int, int>
#define se second
#define lson l, mid, rt<<1
#define rson mid+1, r, rt<<1|1
#define PII pair<int, int>
//void print(__int128 x){if(x>9)print(x/10);putchar('0'+x%10);}
#define rep(i, begin, end) for(__typeof(end) i =(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
void err(istream_iterator<string> it) {cerr<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " , ";
    err(++it, args...);
}// fast IO
const double PI = acos(-1.0);
const double eps = 1e-8;
///////// Macro ////////////////
const int maxn = 3e5+7;
const int N = 20000+10;
#define pii pair<int,int>

#define LL long long
#define PB push_back
#define MP make_pair
#define inf 0x3f3f3f3f
const int mod=998244353;

//2019年2月25日 17:49:22

int a[N];
int main() {
    //freopen("in.txt","r",stdin);
	int k;
	cin>>k;
	int n=1001;
	a[1]=-1;
	k--;
	int sum=k+n;
	int id=1;
	while(sum){
		if(sum >= 1000000)a[++id] =1e6;
		else a[++id] =sum;
		sum-=min(sum,1000000);
	}
	cout<<n<<endl;
	for(int i=1;i<=n;++i){
		printf("%d%c",a[i],i==n?'\n':' ');
	}

}


#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define db double
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x.size())
#define what_is(x) cerr <<  "Line " << __LINE__ << ": " << #x << " is " << (x) << endl;
#define suf_zero(x) __builtin_ffs(x)
#define pre_zero(x) __builtin_clz(x)
#define num_one(x) __builtin_popcount(x)
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
#define mt make_tuple
#define eb emplace_back
#define INFI 2000000009
#define INFLL (ll)1e18+7
#define ig ignore
#define fi first
#define TP tuple<int, int, int>
#define se second
#define lson l, mid, rt<<1
#define rson mid+1, r, rt<<1|1
#define PII pair<int, int>
//void print(__int128 x){if(x>9)print(x/10);putchar('0'+x%10);}
#define rep(i, begin, end) for(__typeof(end) i =(begin)-((begin)>(end));i!=(end)-((begin)>(end));i+=1-2*((begin)>(end)))
void err(istream_iterator<string> it) {cerr<<endl;}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cerr << *it << " = " << a << " , ";
    err(++it, args...);
}// fast IO
const double PI = acos(-1.0);
const double eps = 1e-8;
///////// Macro ////////////////
const int maxn = 3e5+7;
const int N = 20000+10;
#define pii pair<int,int>

#define LL long long
#define PB push_back
#define MP make_pair
#define inf 0x3f3f3f3f
const int mod=998244353;

//2019年2月25日 17:49:22

int a[N];
int main() {
    //freopen("in.txt","r",stdin);
	int k;
	cin>>k;
	int n=1901;
	a[1]=-1;
	k--;
	int sum=k+n+1;
	int id=1;
	while(sum){
		if(sum >= 1000000)a[++id] =1e6;
		else a[++id] =sum;
		sum-=min(sum,1000000);
	}
	cout<<n<<endl;
	for(int i=1;i<=n;++i){
		printf("%d%c",a[i],i==n?'\n':' ');
	}

}


#include <iostream>

using namespace std;

const int Vmax = 1e6;

int n = 2000;
int s, k, a[3000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin >> k;
    s = k + n - 1;

    a[1] = -1;
    for (int i = 2; i <= n; ++ i) {
        a[i] = 1;
        --s;
    }

    for (int i = 2; i <= n; ++ i) {
        int dif = min (s, Vmax);
        s -= dif;
        a[i] += dif;
    }

    cout << n << '\n';
    for (int i = 1; i <= n; ++ i) {
        cout << a[i] << " ";
    }
    return 0;
}


#include <iostream>

using namespace std;

const int Vmax = 1e6;

int n = 2000;
int s, k, a[3000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin >> k;
    s = k + n;

    a[1] = -1;
    for (int i = 2; i <= n; ++ i) {
        a[i] = 1;
        --s;
    }

    for (int i = 2; i <= n; ++ i) {
        int dif = min (s, Vmax - 1);
        s -= dif;
        a[i] += dif;
    }

    cout << n << '\n';
    for (int i = 1; i <= n; ++ i) {
        cout << a[i] << " ";
    }
    return 0;
}


#include <iostream>

using namespace std;

const int Vmax = 1e6;

int n = 2000;
int s, k, a[3000];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);

    cin >> k;
    s = k + n;

    a[1] = -1;
    for (int i = 2; i <= n; ++ i) {
        a[i] = 1;
        --s;
    }

    for (int i = 2; i <= n; ++ i) {
        int dif = min (s, Vmax);
        s -= dif;
        a[i] += dif;
    }

    cout << n << '\n';
    for (int i = 1; i <= n; ++ i) {
        cout << a[i] << " ";
    }
    return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define pic pair<int,char>
#define pii pair<int,int>
using namespace std;
const int maxn=5000+7;
const int mod= 998244353;
int k;
int main(){
    scanf("%d",&k);
    printf("2000\n");
    printf("-1");
    int v=k+1;
    for(int i=1;i<=1999;i++){
        int res;
        if(v>=1e6-1)res=1e6,v-=1e6-1;
        else if(v>0)res=v+1,v=0;
        else res=1;
        printf(" %d",res);
    }
    printf("\n");
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
inline int read(){
    int w=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        w=(w<<3)+(w<<1)+ch-48;
        ch=getchar();
    }
    return w*f;
}
int m;
int main(){
    m=read();int i,j,k;
    for(i=1;i<=1998;i++){
        cout<<0<<" ";
    }
    int a,b;
    b=1000000-m%2000;
    a=(b+m)/2000-b;
    cout<<a<<" "<<b<<endl;
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
inline int read(){
    int w=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-') f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        w=(w<<3)+(w<<1)+ch-48;
        ch=getchar();
    }
    return w*f;
}
int m;
int main(){
    m=read();int i,j,k;
    cout<<2000<<endl;
    for(i=1;i<=1998;i++){
        cout<<0<<" ";
    }
    int a,b;
    b=1000000-m%2000;
    a=(b+m)/2000-b;
    cout<<a<<" "<<b<<endl;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double
const ll maxn=1e5+1;
int k;
int main()
{
    cin>>k;
    int h=min(int(sqrt(k))-1,1500);
    int a=(k+h-1)/h,t=h*a-k;
    if (t==0)
    {
        h++;
        t=a;
    }
    int x=a+t;
    cout<<h+1<<endl;
    for (int i=1;i<=h-1;i++) cout<<0<<" ";
    cout<<-t<<" "<<x;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define ld long double
const ll maxn=1e5+1;
int k;
int main()
{
    cin>>k;
    int h=min(int(sqrt(k)),1500);
    int a=(k+h-1)/h,t=h*a-k;
    if (t==0)
    {
        h++;
        t=a;
    }
    int x=a+t;
    cout<<h+1<<endl;
    for (int i=1;i<=h-1;i++) cout<<0<<" ";
    cout<<-t<<" "<<x;
    return 0;
}


#include<bits/stdc++.h>

using namespace std;

signed main()
{
	long long n;
	cin >> n;
	cout << 2000 << endl;
	cout << -1 << " ";
	cout << 2000 + n << " ";
	for (long long i=0;i<1998;i++) cout << 0 << " ";
}


#include<bits/stdc++.h>

using namespace std;

signed main()

{
	long long k;
	cin >> k;
	long long s = 4000 + k;
	long long sum = 0;
	cout << 2000 << endl << -2 << " ";
	for (long long i=1;i<=1998;i++){
		cout << s/1998 << " ";
		sum+=s/1998;
	}
	cout << s - sum;
}


#include<bits/stdc++.h>

using namespace std;

signed main()

{
	long long k;
	cin >> k;
	long long s = 2000 + k;
	long long sum=0;
	cout << 2000 << endl << -1 << " ";
	for (long long i=1;i<=1998;i++){
		cout << s/1998 << " ";
		sum+=s/1998;
	}
	cout << s - sum;
}


#include <bits/stdc++.h>

using namespace std;

long long k;

int main(){
    cin>>k;
    long long y=2000-k%2000+998000;
    long long x=y-(k+y)/2000;
    cout<<2000<<endl;
    for(int i=0;i<1998;i++)
        cout<<"0 ";
    cout<<-1*x<<" "<<y;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

long long k;

int main(){
    cin>>k;
    long long y=2000-k%2000+998000;
    long long x=y-(k+y)/2000;
    cout<<200<<endl;
    for(int i=0;i<1998;i++)
        cout<<"0 ";
    cout<<-1*x<<" "<<y;
    return 0;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int n,m;
int a[201];
int b[201];
bool used[201];
vector<int>d[201];
vector<int>p[201];
int mi(int i,int j1,int j2){
   int minx=1000001;
   for (auto to:d[i]){
        if (to>=j1 && to<=j2) return 0;
        minx=min(minx,(to-j2+n)%n);
   }
   return minx;
}
int main(){
    int k;cin>>k;
    int k1=k+1;
    int l1=1;
    for (int i=2;i*i<=k1 && i<2000;i++) {
        if (k1%i==0) {
                l1=i;
        }
    }
    int l=l1+1;
    int x=k1/l1+1;
    if (x>1000000){
        cout<<-1;
        return 0;
    }
    cout<<l<<endl;
    for (int i=1;i<=l-2;i++) cout<<0<<" ";
    cout<<-1<<" "<<x;

    /*cin>>n>>m;
    for (int i=1;i<=m;i++){
        cin>>a[i]>>b[i];
        d[a[i]].push_back(b[i]);
    }
    for (int i=1;i<=n;i++){
        p[d[i].size()].push_back(i);
    }
    int lap=0;
    for (int i=1;i<=m;i++){
        if ((int)p[i].size()) lap=i-1;
    }

    for (int k=1;k<=n;k++){
        int cur=p[lap+1][p[lap+1].size()-1];
        int maxx=0;
        vector<int>c(n+1,0);
        for (auto i:p[lap+1]){
            c[i]=mi(i,p[lap+1][0],p[lap+1][p[lap+1].size()-1]);
        }
        int ans=0;
        for (int i=1;i<=n;i++){
            ans=max(ans,c[i]);
        }
        cout<<ans+lap*n+(p[lap+1][p[lap+1].size()-1]-k+n)%n<<endl;
        //for (int j=1;j<=m;j++) used[j]=true;

    }*/
    return 0;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int l[200001];
int r[200001];
int main()
{
    int k;cin>>k;
    cout<<2000<<endl;
    cout<<-1<<" ";
    int c=k+2000;
    for (int i=0;i<1999;i++){
        int a=0;
        if (c>0) a=min(1000000,c);
        cout<<a<<" ";
        c-=a;
    }
/*
    int n;cin>>n;
    for (int i=1;i<=n;i++) cin>>l[i]>>r[i];
    set<pair<int,int> >u;
    set<pair<int,int> >v;
    for (int i=1;i<=n;i++){
        u.insert({l[i],r[i]});
        v.insert({r[i],l[i]});
    }
    int c=0;
    int cnt=0;
    while(!u.empty()){
        while ((*u.begin()).first<c){
            int cur1=(*u.begin()).first;
            int cur2=(*u.begin()).second;
            u.erase({cur1,cur2});
            v.erase({cur2,cur1});
        }
        c=(*v.begin()).first;
        cout<<c<<" "<<u.size()<<endl;
        cnt++;
    }
    cout<<cnt;
*/
    return 0;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int n,m;
int a[201];
int b[201];
bool used[201];
vector<int>d[201];
vector<int>p[201];
int mi(int i,int j1,int j2){
   int minx=1000001;
   for (auto to:d[i]){
        if (to>=j1 && to<=j2) return 0;
        minx=min(minx,(to-j2+n)%n);
   }
   return minx;
}
int main(){
    int k;cin>>k;
    int k1=k+1;
    int l1=1;
    for (int i=2;i<=k1 && i<2000;i++) {
        if (k1%i==0) {
                l1=i;
        }
    }
    int l=l1+1;
    int x=k1/l1+1;
    if (x>1000000){
        cout<<-1;
        return 1;
    }
    cout<<l<<endl;
    for (int i=1;i<=l-2;i++) cout<<0<<" ";
    cout<<-1<<" "<<x;

    /*cin>>n>>m;
    for (int i=1;i<=m;i++){
        cin>>a[i]>>b[i];
        d[a[i]].push_back(b[i]);
    }
    for (int i=1;i<=n;i++){
        p[d[i].size()].push_back(i);
    }
    int lap=0;
    for (int i=1;i<=m;i++){
        if ((int)p[i].size()) lap=i-1;
    }

    for (int k=1;k<=n;k++){
        int cur=p[lap+1][p[lap+1].size()-1];
        int maxx=0;
        vector<int>c(n+1,0);
        for (auto i:p[lap+1]){
            c[i]=mi(i,p[lap+1][0],p[lap+1][p[lap+1].size()-1]);
        }
        int ans=0;
        for (int i=1;i<=n;i++){
            ans=max(ans,c[i]);
        }
        cout<<ans+lap*n+(p[lap+1][p[lap+1].size()-1]-k+n)%n<<endl;
        //for (int j=1;j<=m;j++) used[j]=true;

    }*/
    return 0;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int n,m;
int a[201];
int b[201];
bool used[201];
vector<int>d[201];
vector<int>p[201];
int mi(int i,int j1,int j2){
   int minx=1000001;
   for (auto to:d[i]){
        if (to>=j1 && to<=j2) return 0;
        minx=min(minx,(to-j2+n)%n);
   }
   return minx;
}
int main(){
    int k;cin>>k;
    int k1=k+1;
    int l1=1;
    for (int i=2;i*i<=k1;i++) {
        if (k1%i==0) l1=i;
    }
    int l=l1+1;
    int x=k1/l1+1;
    if (x>1000000){
        cout<<-1;
        return 1;
    }
    cout<<l<<endl;
    for (int i=1;i<=l-2;i++) cout<<0<<" ";
    cout<<-1<<" "<<x;

    /*cin>>n>>m;
    for (int i=1;i<=m;i++){
        cin>>a[i]>>b[i];
        d[a[i]].push_back(b[i]);
    }
    for (int i=1;i<=n;i++){
        p[d[i].size()].push_back(i);
    }
    int lap=0;
    for (int i=1;i<=m;i++){
        if ((int)p[i].size()) lap=i-1;
    }

    for (int k=1;k<=n;k++){
        int cur=p[lap+1][p[lap+1].size()-1];
        int maxx=0;
        vector<int>c(n+1,0);
        for (auto i:p[lap+1]){
            c[i]=mi(i,p[lap+1][0],p[lap+1][p[lap+1].size()-1]);
        }
        int ans=0;
        for (int i=1;i<=n;i++){
            ans=max(ans,c[i]);
        }
        cout<<ans+lap*n+(p[lap+1][p[lap+1].size()-1]-k+n)%n<<endl;
        //for (int j=1;j<=m;j++) used[j]=true;

    }*/
    return 0;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int n,m;
int a[201];
int b[201];
bool used[201];
vector<int>d[201];
vector<int>p[201];
int mi(int i,int j1,int j2){
   int minx=1000001;
   for (auto to:d[i]){
        if (to>=j1 && to<=j2) return 0;
        minx=min(minx,(to-j2+n)%n);
   }
   return minx;
}
int main(){
    int k;cin>>k;
    int k1=k+1;
    int l1=1;
    for (int i=2;i<=k1 && i<2000;i++) {
        if (k1%i==0) {
                l1=i;
        }
    }
    int l=l1+1;
    int x=k1/l1+1;
    if (x>1000000){
        cout<<-1;
        return 0;
    }
    cout<<l<<endl;
    for (int i=1;i<=l-2;i++) cout<<0<<" ";
    cout<<-1<<" "<<x;

    /*cin>>n>>m;
    for (int i=1;i<=m;i++){
        cin>>a[i]>>b[i];
        d[a[i]].push_back(b[i]);
    }
    for (int i=1;i<=n;i++){
        p[d[i].size()].push_back(i);
    }
    int lap=0;
    for (int i=1;i<=m;i++){
        if ((int)p[i].size()) lap=i-1;
    }

    for (int k=1;k<=n;k++){
        int cur=p[lap+1][p[lap+1].size()-1];
        int maxx=0;
        vector<int>c(n+1,0);
        for (auto i:p[lap+1]){
            c[i]=mi(i,p[lap+1][0],p[lap+1][p[lap+1].size()-1]);
        }
        int ans=0;
        for (int i=1;i<=n;i++){
            ans=max(ans,c[i]);
        }
        cout<<ans+lap*n+(p[lap+1][p[lap+1].size()-1]-k+n)%n<<endl;
        //for (int j=1;j<=m;j++) used[j]=true;

    }*/
    return 0;
}


#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int n,m;
int a[201];
int b[201];
bool used[201];
vector<int>d[201];
vector<int>p[201];
int mi(int i,int j1,int j2){
   int minx=1000001;
   for (auto to:d[i]){
        if (to>=j1 && to<=j2) return 0;
        minx=min(minx,(to-j2+n)%n);
   }
   return minx;
}
int main(){
    int k;cin>>k;
    int k1=k+1;
    int l1=1;
    for (int i=2;i*i<=k1;i++) {
        if (k1%i==0) l1=i;
    }
    int l=l1+1;
    int x=k1/l1+1;
    if (x>1000000){
        cout<<-1;
        return 0;
    }
    cout<<l<<endl;
    for (int i=1;i<=l-2;i++) cout<<0<<" ";
    cout<<-1<<" "<<x;

    /*cin>>n>>m;
    for (int i=1;i<=m;i++){
        cin>>a[i]>>b[i];
        d[a[i]].push_back(b[i]);
    }
    for (int i=1;i<=n;i++){
        p[d[i].size()].push_back(i);
    }
    int lap=0;
    for (int i=1;i<=m;i++){
        if ((int)p[i].size()) lap=i-1;
    }

    for (int k=1;k<=n;k++){
        int cur=p[lap+1][p[lap+1].size()-1];
        int maxx=0;
        vector<int>c(n+1,0);
        for (auto i:p[lap+1]){
            c[i]=mi(i,p[lap+1][0],p[lap+1][p[lap+1].size()-1]);
        }
        int ans=0;
        for (int i=1;i<=n;i++){
            ans=max(ans,c[i]);
        }
        cout<<ans+lap*n+(p[lap+1][p[lap+1].size()-1]-k+n)%n<<endl;
        //for (int j=1;j<=m;j++) used[j]=true;

    }*/
    return 0;
}


#include "bits/stdc++.h"

#define wsp                cin >> ws;
#define sp                 setprecision
#define sn(n)              scanf("%lld",&n)
#define cn(n)              cin>>n
#define pr(n)              printf("%lld\n",n)
#define ff                 first
#define ss                 second
#define prn                cout<<endl
#define str(n)             scanf("%s",n)
#define pb                 push_back
#define len(n)             n.length()
#define forp(i,a,b)        for(ll i=a;i<=b;i++)
#define rep(i,n)           for(ll i=0;i<n;i++)
#define forn(i,a,b)        for(ll i=a;i>=b;i--)
#define ren(i,n)           for(ll i=n-1;i>=0;i--)
#define LALIT              ios_base::sync_with_stdio(false);cin.tie(0)
#define tr(container, it)  for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define mem(n,m)           memset(n,m,sizeof(n))
#define mp                 make_pair
#define mod               1000000007
#define watch(x)           cout << (#x) << " is " << (x) << endl

using namespace std;
typedef unsigned long long int ull;
typedef long long int          ll;
typedef pair<int, int>         pii;
typedef pair<ll, int>          pli;
typedef pair<double, int>      pdi;
typedef pair<ll, ll>           pll;
typedef pair<double, double>   pdd;

const int  N = int(300000)+5;

ll  t , n , m ,  q , k  , cnt , sum  , x , y , z , l , r  , ans;

ll a[N] , b[N] , c[N] ;

int main()
{
   LALIT ;
   cin >> k ;
   if(k==1)
   {
   	 cout << "2\n-1 3" ;
   	 return 0 ;
   }
   n = min(k,(ll)1005) ;
   x = k + n - 1 ;
   cout << n << "\n-1 ";x++;
   forp(i,1,n-1)
   {
   	 y = n - 1 - i ;
   	 sum = min(x-y,(ll)1e6) ;
   	 cout << sum << " ";
   	 x = x - sum ;
	}
   return 0 ;
}


#include "bits/stdc++.h"

#define wsp                cin >> ws;
#define sp                 setprecision
#define sn(n)              scanf("%lld",&n)
#define cn(n)              cin>>n
#define pr(n)              printf("%lld\n",n)
#define ff                 first
#define ss                 second
#define prn                cout<<endl
#define str(n)             scanf("%s",n)
#define pb                 push_back
#define len(n)             n.length()
#define forp(i,a,b)        for(ll i=a;i<=b;i++)
#define rep(i,n)           for(ll i=0;i<n;i++)
#define forn(i,a,b)        for(ll i=a;i>=b;i--)
#define ren(i,n)           for(ll i=n-1;i>=0;i--)
#define LALIT              ios_base::sync_with_stdio(false);cin.tie(0)
#define tr(container, it)  for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define mem(n,m)           memset(n,m,sizeof(n))
#define mp                 make_pair
#define mod               1000000007
#define watch(x)           cout << (#x) << " is " << (x) << endl

using namespace std;
typedef unsigned long long int ull;
typedef long long int          ll;
typedef pair<int, int>         pii;
typedef pair<ll, int>          pli;
typedef pair<double, int>      pdi;
typedef pair<ll, ll>           pll;
typedef pair<double, double>   pdd;

const int  N = int(300000)+5;

ll  t , n , m ,  q , k  , cnt , sum  , x , y , z , l , r  , ans;

ll a[N] , b[N] , c[N] ;

int main()
{
   LALIT ;
   cin >> k ;k++;
   n = min(k,(ll)1005) ;
   x = k + n - 1 ;
   cout << "-1 ";
   forp(i,1,n-1)
   {
   	 y = n - 1 - i ;
   	 sum = min(x-y,(ll)1e6) ;
   	 cout << sum << " ";
   	 x = x - sum ;
	}
   return 0 ;
}


#include "bits/stdc++.h"

#define wsp                cin >> ws;
#define sp                 setprecision
#define sn(n)              scanf("%lld",&n)
#define cn(n)              cin>>n
#define pr(n)              printf("%lld\n",n)
#define ff                 first
#define ss                 second
#define prn                cout<<endl
#define str(n)             scanf("%s",n)
#define pb                 push_back
#define len(n)             n.length()
#define forp(i,a,b)        for(ll i=a;i<=b;i++)
#define rep(i,n)           for(ll i=0;i<n;i++)
#define forn(i,a,b)        for(ll i=a;i>=b;i--)
#define ren(i,n)           for(ll i=n-1;i>=0;i--)
#define LALIT              ios_base::sync_with_stdio(false);cin.tie(0)
#define tr(container, it)  for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define mem(n,m)           memset(n,m,sizeof(n))
#define mp                 make_pair
#define mod               1000000007
#define watch(x)           cout << (#x) << " is " << (x) << endl

using namespace std;
typedef unsigned long long int ull;
typedef long long int          ll;
typedef pair<int, int>         pii;
typedef pair<ll, int>          pli;
typedef pair<double, int>      pdi;
typedef pair<ll, ll>           pll;
typedef pair<double, double>   pdd;

const int  N = int(300000)+5;

ll  t , n , m ,  q , k  , cnt , sum  , x , y , z , l , r  , ans;

ll a[N] , b[N] , c[N] ;

int main()
{
   LALIT ;
   cin >> k ;
   if(k==1)
   {
   	 cout << "-1 3" ;
   	 return 0 ;
   }
   n = min(k,(ll)1005) ;
   x = k + n - 1 ;
   cout << "-1 ";x++;
   forp(i,1,n-1)
   {
   	 y = n -1 - i ;
   	 sum = min(x-y,(ll)1e6) ;
   	 cout << sum << " ";
   	 x = x - sum ;
	}
   return 0 ;
}


#include<bits/stdc++.h>

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char SMAX(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char SMIN(A &a, const B &b) {return b < a ? a = b , 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I>
inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

inline void Print(int a, int n) {
	printf("%d\n", n);
	for (int i = 1; i < n - 1; ++i) printf("0 ");
	printf("%d %d\n", -1, a); exit(0);
}

int main() {
	#ifdef hzhkk
	freopen("hkk.in", "r", stdin);
	#endif
	int k, S = -1, n;
	read(k);
	for (n = 2; n <= 1000 ; ++n)
		if (S + 1e6 - n + 1 <= k) S += 1e6;
		else break;
	if (S - n + 1 != k) {
		printf("%d\n", n + 1);
		printf("-1 ");
		for (int i = 2; i <= n; ++i) printf("1000000 ");
		printf("%d\n", k - S + n - 1);
	} else {
		printf("%d\n", n);
		printf("-1 ");
		for (int i = 2; i <= n; ++i) printf("1000000 ");
	}
}


#include<bits/stdc++.h>

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char SMAX(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char SMIN(A &a, const B &b) {return b < a ? a = b , 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I>
inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

inline void Print(int a, int n) {
	printf("%d\n", n);
	for (int i = 1; i < n - 1; ++i) printf("0 ");
	printf("%d %d\n", -1, a); exit(0);
}

int main() {
	#ifdef hzhkk
	freopen("hkk.in", "r", stdin);
	#endif
	int k, S = -1, n;
	read(k);
	printf("-1 ");
	for (n = 2; n <= 1000 ; ++n)
		if (S + 1e6 - n + 1 <= k) S += 1e6;
		else break;
	if (S - n + 1 != k) {
		printf("%d\n", n + 1);
		for (int i = 1; i <= n; ++i) printf("1000000 ");
		printf("%d\n", k - S + n - 1);
	} else {
		printf("%d\n", n);
		for (int i = 1; i <= n; ++i) printf("1000000 ");
	}
}


#include<bits/stdc++.h>

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char SMAX(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char SMIN(A &a, const B &b) {return b < a ? a = b , 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I>
inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

inline void Print(int a, int n) {
	printf("%d\n", n);
	for (int i = 1; i < n - 1; ++i) printf("0 ");
	printf("%d %d\n", -1, a); exit(0);
}

int main() {
	#ifdef hzhkk
	freopen("hkk.in", "r", stdin);
	#endif
	int k, S = -1, n;
	read(k);
	printf("-1 ");
	for (n = 2; n <= 1000 ; ++n)
		if (S + 1e6 - n + 1 <= k) S += 1e6, printf("1000000 ");
		else break;
	if (S - n + 1 != k) printf("%d\n", k - S + n - 1);
	else puts("-1");
}


#include<bits/stdc++.h>

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char SMAX(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char SMIN(A &a, const B &b) {return b < a ? a = b , 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I>
inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

inline void Print(int a, int n) {
	printf("%d\n", n);
	for (int i = 1; i < n - 1; ++i) printf("0 ");
	printf("%d %d\n", -1, a); exit(0);
}

int main() {
	#ifdef hzhkk
	freopen("hkk.in", "r", stdin);
	#endif
	int k, S = -1, n;
	read(k);
	for (n = 2; n <= 1000 ; ++n)
		if (S + 1e6 - n + 1 <= k) S += 1e6;
		else break;
	if (S - (n - 1) + 1 != k) {
		printf("%d\n", n);
		printf("-1 ");
		for (int i = 2; i < n; ++i) printf("1000000 ");
		printf("%d\n", k - S + n - 1);
	} else {
		printf("%d\n", n - 1);
		printf("-1 ");
		for (int i = 2; i < n; ++i) printf("1000000 ");
	}
}


#include<bits/stdc++.h>

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char SMAX(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char SMIN(A &a, const B &b) {return b < a ? a = b , 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I>
inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

inline void Print(int a, int n) {
	printf("%d\n", n);
	for (int i = 1; i < n - 1; ++i) printf("0 ");
	printf("%d %d\n", -1, a); exit(0);
}

int main() {
	#ifdef hzhkk
	freopen("hkk.in", "r", stdin);
	#endif
	int k, S = -1, n = 2000, i;
	read(k); S = k + n - 1;
	printf("%d\n-1 ", n);
	for (i = 2; S + 1 >= 1000000; ++i) printf("1000000 "),  S -= 1000000;
	if (S + 1) printf("%d ", S + 1), ++i;
	for (; i <= n; ++i) printf("0 ");
}


#include<bits/stdc++.h>

#define fec(i, x, y) (int i = head[x], y = g[i].to; i; i = g[i].ne, y = g[i].to)
#define dbg(...) fprintf(stderr, __VA_ARGS__)
#define File(x) freopen(#x".in", "r", stdin), freopen(#x".out", "w", stdout)
#define fi first
#define se second
#define pb push_back

template<typename A, typename B> inline char SMAX(A &a, const B &b) {return a < b ? a = b , 1 : 0;}
template<typename A, typename B> inline char SMIN(A &a, const B &b) {return b < a ? a = b , 1 : 0;}

typedef long long ll; typedef unsigned long long ull; typedef std::pair<int, int> pii;

template<typename I>
inline void read(I &x) {
	int f = 0, c;
	while (!isdigit(c = getchar())) c == '-' ? f = 1 : 0;
	x = c & 15;
	while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + (c & 15);
	f ? x = -x : 0;
}

inline void Print(int a, int n) {
	printf("%d\n", n);
	for (int i = 1; i < n - 1; ++i) printf("0 ");
	printf("%d %d\n", -1, a); exit(0);
}

int main() {
	#ifdef hzhkk
	freopen("hkk.in", "r", stdin);
	#endif
	int k, S = -1, n;
	read(k);
	for (n = 2; n <= 1000 ; ++n)
		if (S + 1e6 - n + 1 <= k) S += 1e6;
		else break;
	if (S - n + 1 != k) {
		printf("%d\n", n + 1);
		for (int i = 1; i <= n; ++i) printf("1000000 ");
		printf("%d\n", k - S + n - 1);
	} else {
		printf("%d\n", n);
		for (int i = 1; i <= n; ++i) printf("1000000 ");
	}
}


#include<bits/stdc++.h>
using namespace std;
#define M 999999ll
#define LL long long
LL k,n,x,y,mx;
int main()
{
	scanf("%I64d",&k);
	for(x=1;x<1000;x++)
	  {n=2*x+1,y=(M+k)/(2ll*x+1)+x,mx=(2ll*x+1)*(y-x)-k;if(mx>=y && mx<=M)break;}
	printf("%I64d\n",n);
	for(LL i=1;i<=n;i++)
	  printf("%I64d%c",i<n?(i&1?mx:-mx-1):y,i<n?' ':'\n');
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define M 1000000ll
#define LL long long
LL k,n,x,y,mx;
int main()
{
	scanf("%I64d",&k);
	for(x=1;x<1000;x++)
	  {n=2*x+1,y=(M+k)/(2ll*x+1),mx=(2ll*x+1)*y-k;if(mx>=y && mx<=M)break;}
	printf("%I64d\n",n);
	for(LL i=1;i<=n;i++)
	  printf("%I64d%c",i<n?(i&1?mx:-mx):y,i<n?' ':'\n');
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
#define M 999999ll
#define LL long long
LL k,n,x,y,mx;
int main()
{
	scanf("%I64d",&k);
	for(x=1;x<1000;x++)
	  if((x+k)*(2ll*x+1)<=2ll*x*(M+k))
	    {n=2*x+1,y=(M+k)/(2ll*x+1)+x,mx=(2ll*x+1)*(y-x)-k;break;}
	printf("%I64d\n",n);
	for(LL i=1;i<=n;i++)
	  printf("%I64d%c",i<n?(i&1?mx:-(mx+1)):y,i<n?' ':'\n');
}


#include <cstring>
#include <algorithm>
#include <iostream>
#include <vector>

using namespace std;

const int INF = 1e9+7;

int dist(int a, int b, int n) {
    if (b<a) b+=n;
    return b-a;
}
void solve() {
    int k;
    cin >> k;
    vector<int> vals(2000, 1);
    vals[0] = -1;
    vals[1] = 2;
    for (int i=1;i<2000 && k;i++) {
        int left = 1000000 - vals[i];
        int sub = min(left, k);
        k-=sub;
        vals[i]+=sub;
    }
    cout << 2000 << endl;
    for (int i=0;i<2000;i++) {
        cout << vals[i] << " ";
    }
}
int main() {
	//freopen("input.txt","r", stdin);
	solve();
	return 0;
}


#include <bits/stdc++.h>
#define y0    lol
#define y1    lool
#define yn    loool
#define prev  looool
#define next  loooool
#define read  looooool
#define tm    loooooool
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#ifdef LOCAL
#define rall(x,a) for(x : a)
#define LL "%lld"
#else
#define rall(x,a) for(auto x : a)
#define LL "%I64d"
#endif
#define rng(a) a.begin(), a.end()
#define PI 3.14159265358979323846
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

const int N = 2000, X = 1000000;
//const int N = 200, X = 100;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int k;
    cin >> k;
    rep(n, 1, N - 1) {
        int need = k + n + 1;
        int maxi = n * X;
        if(need <= maxi) {
            cout << n + 1 << endl;
            cout << -1 << " ";
            rep(i, 1, n) {
                int cur = min(need, X);
                need -= cur;
                cout << cur << " ";
            }
            cout << endl;
            return 0;
        }
    }
    cout << -1 << endl;
    return 0;
}


#include <iostream>
#include <queue>
#include <set>
#include <cstring>
#include <stdio.h>
#include <unordered_map>
#include <cmath>
#include <iterator>
#include <algorithm>

using namespace std;

#define ll long long
#define mp make_pair

int read() {
    int f = 1;
    int res = 0;
    char ch;
    do {
        ch = getchar();
        if (ch == '-') f = -f;
    } while (ch < '0' || ch > '9');
    do {
        res = res * 10 + ch - '0';
        ch = getchar();
    } while (ch >= '0' && ch <= '9');
    return f == 1 ? res : -res;
}

const int N = 300005;
const int M = 19;
const int MAXNUM = 10;
const ll INF = 2000000000000LL;
int n,m;
int mod = 998244353;
int head[N], nxt[N * 2], to[N * 2], tot;

int main() {

//    freopen("/Users/mobike/Downloads/10.in", "r", stdin);
//    freopen("/Users/mobike/Downloads/10.out", "w", stdout);
    int k;
    cin >> k;
    if (k < 10000) {
        if (k % 2 == 1) {
            int tmp = (k + 1) / 2 + 1;
            cout << 0 << " " << -1 << " " << tmp << endl;
        } else {
            int tmp = (k + 2) / 2 + 2;
            cout << 0 << " " << -2 << " " << tmp << endl;
        }
    }
    return 0;
}


#include <iostream>
#include <queue>
#include <set>
#include <cstring>
#include <stdio.h>
#include <unordered_map>
#include <cmath>
#include <iterator>
#include <algorithm>

using namespace std;

#define ll long long
#define mp make_pair

int read() {
    int f = 1;
    int res = 0;
    char ch;
    do {
        ch = getchar();
        if (ch == '-') f = -f;
    } while (ch < '0' || ch > '9');
    do {
        res = res * 10 + ch - '0';
        ch = getchar();
    } while (ch >= '0' && ch <= '9');
    return f == 1 ? res : -res;
}

const int N = 300005;
const int M = 19;
const int MAXNUM = 10;
const ll INF = 2000000000000LL;
int n,m;
int mod = 998244353;
int head[N], nxt[N * 2], to[N * 2], tot;

int main() {

//    freopen("/Users/mobike/Downloads/10.in", "r", stdin);
//    freopen("/Users/mobike/Downloads/10.out", "w", stdout);
    int k;
    cin >> k;
    if (k <= 1500000) {
        cout << 3 << endl;
        if (k % 2 == 1) {
            int tmp = (k + 1) / 2 + 1;
            cout << 0 << " " << -1 << " " << tmp << endl;
        } else {
            int tmp = (k + 2) / 2 + 2;
            cout << 0 << " " << -2 << " " << tmp << endl;
        }
    } else {
        int len = k / 1000000 + 10;
        int left = k % (len - 1);
        int more = len - 1 - left;
        int m = more;
        int x = (k + m * len) / (len - 1);
        cout << len << endl;
        for (int i = 0; i < len - 2; i++) {
            cout << 0 << " ";
        }
        cout << -m << " " << x << endl;
    }
    return 0;
}


#include <iostream>
#include <queue>
#include <set>
#include <cstring>
#include <stdio.h>
#include <unordered_map>
#include <cmath>
#include <iterator>
#include <algorithm>

using namespace std;

#define ll long long
#define mp make_pair

int read() {
    int f = 1;
    int res = 0;
    char ch;
    do {
        ch = getchar();
        if (ch == '-') f = -f;
    } while (ch < '0' || ch > '9');
    do {
        res = res * 10 + ch - '0';
        ch = getchar();
    } while (ch >= '0' && ch <= '9');
    return f == 1 ? res : -res;
}

const int N = 300005;
const int M = 19;
const int MAXNUM = 10;
const ll INF = 2000000000000LL;
int n,m;
int mod = 998244353;
int head[N], nxt[N * 2], to[N * 2], tot;

int main() {

//    freopen("/Users/mobike/Downloads/10.in", "r", stdin);
//    freopen("/Users/mobike/Downloads/10.out", "w", stdout);
    int k;
    cin >> k;
    if (k <= 1500000) {
        cout << 3 << endl;
        if (k % 2 == 1) {
            int tmp = (k + 1) / 2 + 1;
            cout << 0 << " " << -1 << " " << tmp << endl;
        } else {
            int tmp = (k + 2) / 2 + 2;
            cout << 0 << " " << -2 << " " << tmp << endl;
        }
    } else {
        int len = k / 1000000 + 2;
        int left = k % (len - 1);
        int more = len - 1 - left;
        int m = more;
        int x = (k + m * len) / (len - 1);
        cout << len << endl;
        for (int i = 0; i < len - 2; i++) {
            cout << 0 << " ";
        }
        cout << -m << " " << x << endl;
    }
    return 0;
}


#include <iostream>
#include <queue>
#include <set>
#include <cstring>
#include <stdio.h>
#include <unordered_map>
#include <cmath>
#include <iterator>
#include <algorithm>

using namespace std;

#define ll long long
#define mp make_pair

int read() {
    int f = 1;
    int res = 0;
    char ch;
    do {
        ch = getchar();
        if (ch == '-') f = -f;
    } while (ch < '0' || ch > '9');
    do {
        res = res * 10 + ch - '0';
        ch = getchar();
    } while (ch >= '0' && ch <= '9');
    return f == 1 ? res : -res;
}

const int N = 300005;
const int M = 19;
const int MAXNUM = 10;
const ll INF = 2000000000000LL;
int n,m;
int mod = 998244353;
int head[N], nxt[N * 2], to[N * 2], tot;

int main() {

//    freopen("/Users/mobike/Downloads/10.in", "r", stdin);
//    freopen("/Users/mobike/Downloads/10.out", "w", stdout);
    int k;
    cin >> k;
    if (k <= 1500000) {
        cout << 3 << endl;
        if (k % 2 == 1) {
            int tmp = (k + 1) / 2 + 1;
            cout << 0 << " " << -1 << " " << tmp << endl;
        } else {
            int tmp = (k + 2) / 2 + 2;
            cout << 0 << " " << -2 << " " << tmp << endl;
        }
    } else {
        int len = k / 1000000 + 2;
        while (len <= 2000) {
            if ((k + len) % (len - 1) == 0) break;
            len ++;
        }
        if (len > 2000) {
            cout << -1 << endl;
        } else {
            int x = (k + len) / (len - 1);
            cout << len << endl;
            for (int i = 0; i < len - 2; i++) {
                cout << 0 << " ";
            }
            cout << -1 << " " << x << endl;
        }
    }
    return 0;
}


#include <iostream>
#include <queue>
#include <set>
#include <cstring>
#include <stdio.h>
#include <unordered_map>
#include <cmath>
#include <iterator>
#include <algorithm>

using namespace std;

#define ll long long
#define mp make_pair

int read() {
    int f = 1;
    int res = 0;
    char ch;
    do {
        ch = getchar();
        if (ch == '-') f = -f;
    } while (ch < '0' || ch > '9');
    do {
        res = res * 10 + ch - '0';
        ch = getchar();
    } while (ch >= '0' && ch <= '9');
    return f == 1 ? res : -res;
}

const int N = 300005;
const int M = 19;
const int MAXNUM = 10;
const ll INF = 2000000000000LL;
int n,m;
int mod = 998244353;
int head[N], nxt[N * 2], to[N * 2], tot;

int main() {

//    freopen("/Users/mobike/Downloads/10.in", "r", stdin);
//    freopen("/Users/mobike/Downloads/10.out", "w", stdout);
    int k;
    cin >> k;
    if (k < 10000) {
        cout << 3 << endl;
        if (k % 2 == 1) {
            int tmp = (k + 1) / 2 + 1;
            cout << 0 << " " << -1 << " " << tmp << endl;
        } else {
            int tmp = (k + 2) / 2 + 2;
            cout << 0 << " " << -2 << " " << tmp << endl;
        }
    }
    return 0;
}


#include <iostream>
#include <queue>
#include <set>
#include <cstring>
#include <stdio.h>
#include <unordered_map>
#include <cmath>
#include <iterator>
#include <algorithm>

using namespace std;

#define ll long long
#define mp make_pair

int read() {
    int f = 1;
    int res = 0;
    char ch;
    do {
        ch = getchar();
        if (ch == '-') f = -f;
    } while (ch < '0' || ch > '9');
    do {
        res = res * 10 + ch - '0';
        ch = getchar();
    } while (ch >= '0' && ch <= '9');
    return f == 1 ? res : -res;
}

const int N = 300005;
const int M = 19;
const int MAXNUM = 10;
const ll INF = 2000000000000LL;
int n,m;
int mod = 998244353;
int head[N], nxt[N * 2], to[N * 2], tot;

int main() {

//    freopen("/Users/mobike/Downloads/10.in", "r", stdin);
//    freopen("/Users/mobike/Downloads/10.out", "w", stdout);
    int k;
    cin >> k;
    int more = k / 1000000;
    int left = k % 1000000;
    int x = left + more + 2;
    if (x > 1000000) {
        x -= 999999;
        more++;
    }
    cout << more + 2 << endl;
    cout << -1 << " ";
    for (int i = 0; i < more; i++) cout << 1000000 << " ";
    cout << x << endl;
    return 0;
}


/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
ll n,m;
int main()
{
    cin>>n;
    if(n%2 == 0)
        m = n/2 + 3;
    else
        m = (n+9)/2;
    cout<<3<<endl<<m<<" "<<-1*(m+1)<<" "<< m-(1 + n%2);
    return 0;
}


/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
ll n,m;
#define lim 999999
ll getN(ll diff);
ll getA(ll diff, ll N);
bool test (ll N, ll A, ll x, ll diff);
ll start;
ll x;
int main()
{
    ll diff;
    cin>>diff;
    n = getN(diff);
    cout<<n<<endl;
    ll neg = -1*(start+1);
    for(long i=0;i<n;i++) {
        if(i%2 ==1)
            cout<<neg<<" ";
        else if(i==2)
            cout<<start-x<<" ";
        else
            cout<<start<<" ";
    }
    return 0;
}
ll getN(ll diff) {

    for(ll N = max((ll)3,(ll)((diff/lim)-1)); N <2000; N+=2) {
        ll A = getA(diff, N);
        if (A <= lim){
            start = A;
            x = A- (diff+A)/N - N/2;
            if(test(N,A,x,diff))
                return N;
            else
                cout<<"fail "<<N<<" "<<A<<" "<<x<<endl;
        }
    }
    return -1;
}
ll getA(ll diff, ll N) {
    ll x = 0;
    ll minA =(diff +N*(N/2))/(N-1); //(diff +N(N/2))/(N-1)
    ll rem = (diff+minA)%N;
    if(rem > 0)
        minA+=(N-rem);
    return minA;
}
bool test (ll N, ll A, ll x, ll diff) {
    if(N>2000 || A>lim || x<0)
        return false;
    ll sum = 0;
    for(ll index = 0; index < N; index++) {
        if(index %2 == 1)
            sum -= (A+1);
        else if (index == 2)
            sum += (A-x);
        else
            sum += A;
    }
    return (diff + A == sum*N);
}


/******************************************************************************

Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby,
C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS
Code, Compile, Run and Debug online from anywhere in world.

*******************************************************************************/
#include <stdio.h>
#include <iostream>
#include <cstring>
using namespace std;
typedef long long ll;
ll n,m;
#define lim 999999
ll getN(ll diff);
ll getA(ll diff, ll N);
bool test (ll N, ll A, ll x, ll diff);
ll start;
ll x;
int main()
{
    ll diff;
    cin>>diff;
    n = getN(diff);
    cout<<n<<endl;
    ll neg = -1*(start+1);
    for(long i=0;i<n;i++) {
        if(i%2 ==1)
            cout<<neg<<" ";
        else if(i==2)
            cout<<start-x<<" ";
        else
            cout<<start<<" ";
    }
    return 0;
}
ll getN(ll diff) {

    for(ll N = max((ll)3,(ll)((diff/lim)-1)); N <2000; N+=2) {
        if(N%2 == 0)
            N--;
        ll A = getA(diff, N);
        if (A <= lim){
            start = A;
            x = A- (diff+A)/N - N/2;
            if(test(N,A,x,diff))
                return N;
            else
                cout<<"fail "<<N<<" "<<A<<" "<<x<<endl;
        }
    }
    return -1;
}
ll getA(ll diff, ll N) {
    ll x = 0;
    ll minA =(diff +N*(N/2))/(N-1); //(diff +N(N/2))/(N-1)
    ll rem = (diff+minA)%N;
    if(rem > 0)
        minA+=(N-rem);
    return minA;
}
bool test (ll N, ll A, ll x, ll diff) {
    if(N>2000 || A>lim || x<0)
        return false;
    ll sum = 0;
    for(ll index = 0; index < N; index++) {
        if(index %2 == 1)
            sum -= (A+1);
        else if (index == 2)
            sum += (A-x);
        else
            sum += A;
    }
    return (diff + A == sum*N);
}


/**Lucky Boy**/
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define maxc 1000000007
#define maxn 2005
#define maxm 1000006
#define pii pair <int,int>
#define Task ""
template <typename T> inline void read(T &x){char c;bool nega=0;while((!isdigit(c=getchar()))&&(c!='-'));if(c=='-'){nega=1;c=getchar();}x=c-48;while(isdigit(c=getchar())) x=x*10+c-48;if(nega) x=-x;}
template <typename T> inline void writep(T x){if(x>9) writep(x/10);putchar(x%10+48);}
template <typename T> inline void write(T x){if(x<0){putchar('-');x=-x;}writep(x);putchar(' ');}
template <typename T> inline void writeln(T x){write(x);putchar('\n');}
using namespace std;
int k,n,a[maxn],ww;
int main()
{
    ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
    //freopen(Task".inp", "r",stdin);
    //freopens(Task".out", "w",stdout);
    cin >> k;
    if (k & 1) n = 1999;
    else n = 2000;
    a[1] = 0,a[2] = -1;
    k += n + 2;
    k /= 2;
    int cnt = k / 1000000;
    ww = 2;
    while (cnt--)
    {
        a[++ww] = 1e6;
    }
    cnt = k % 1000000;
    a[++ww] = cnt;
    cout << n << '\n';
    FOR(i,1,n) cout << a[i] << ' ';
    return 0;

}


/**Lucky Boy**/
#include <bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for (int i = (a); i >= (b); --i)
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define maxc 1000000007
#define maxn 2005
#define maxm 1000006
#define pii pair <int,int>
#define Task ""
template <typename T> inline void read(T &x){char c;bool nega=0;while((!isdigit(c=getchar()))&&(c!='-'));if(c=='-'){nega=1;c=getchar();}x=c-48;while(isdigit(c=getchar())) x=x*10+c-48;if(nega) x=-x;}
template <typename T> inline void writep(T x){if(x>9) writep(x/10);putchar(x%10+48);}
template <typename T> inline void write(T x){if(x<0){putchar('-');x=-x;}writep(x);putchar(' ');}
template <typename T> inline void writeln(T x){write(x);putchar('\n');}
using namespace std;
int k,n,a[maxn],ww;
int main()
{
    ios_base::sync_with_stdio(NULL);cin.tie(NULL);cout.tie(NULL);
    //freopen(Task".inp", "r",stdin);
    //freopens(Task".out", "w",stdout);
    cin >> k;
    n = 2000;
    a[1] = -1;
    k += n ;
    int cnt = k / 1000000;
    ww = 1;
    while (cnt--)
    {
        a[++ww] = 1e6;
    }
    cnt = k % 1000000;
    a[++ww] = cnt;
    cout << n << '\n';
    FOR(i,1,n) cout << a[i] << ' ';
    return 0;

}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<int>ans;
int main(){
	int k;cin>>k;
	ans.push_back(-1);
	int cnt=1;
	ll sum=0;
	while(1){
		if(k+cnt+1>=1000000){
			ans.push_back(1000000);
			k-=1000000;
		}
		else {
			ans.push_back(k+cnt+1);
			break;
		}
		cnt++;
	}
	cout<<ans.size()<<endl;
	for(auto t:ans){
		cout<<t<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<int>ans;
int main(){
	int k;cin>>k;
	ans.push_back(-1);
	ans.push_back(1);
	int cnt=1;
	ll sum=0;
	while(1){
		if(k+cnt+1>=1000000){
			ans.push_back(1000000);
			k-=1000000;
		}
		else {
			ans.push_back(k+cnt+1);
			break;
		}
		cnt++;
	}
	cout<<ans.size()<<endl;
	for(auto t:ans){
		cout<<t<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	int k;cin>>k;
	int len,x;
	for(int i=2;i<=2000;i++){
		if((k+i)%(i-1)==0&&(k+i)/(i-1)<=1000000){
			len = i;
			x = (k+i)/(i-1);
			break;
		}
	}
	cout<<len<<endl;
	for(int i=1;i<=len-2;i++){
		cout<<"0 ";
	}
	cout<<"-1 ";
	cout<<x<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
vector<int>ans;
int main(){
	int k;cin>>k;
	ans.push_back(-1);
	ans.push_back(1);
	int cnt=1;
	while(1){
		if(k>1000000)ans.push_back(1000000),k-=1000000;
		else {
			ans.push_back(k+cnt+1);
			break;
		}
		cnt++;
	}
	cout<<ans.size()<<endl;
	for(auto t:ans){
		cout<<t<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	int k;cin>>k;
	int len,x;
	for(int i=2;i<=2000;i++){
		if((k+i)%(i-1)==0&&(k+i)/(i-1)<=1000000){
			len = i;
			x = (k+i)/(i-1);
			break;
		}
	}
	for(int i=1;i<=len-2;i++){
		cout<<"0 ";
	}
	cout<<"-1 ";
	cout<<x<<endl;
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
using namespace std;
int main(){
	int k;cin>>k;
	cout<<"-1 1 ";
	int cnt=1;
	while(1){
		if(k>1000000)cout<<"1000000 ",k-=1000000;
		else {
			cout<<k+cnt+1;
			break;
		}
		cnt++;
	}
	return 0;
}


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

int main()
{
	int k;
	scanf("%d", &k);
	if (k <= 1000000) {
		printf("1\n%d\n", -k);
	}
	else {
		puts("-1");
	}
}


#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define N 100005
int k, n;
int main()
{
	scanf("%d", &k);
	printf("%d\n", n = 2000);
	k = k + n;
	printf("-1 ");
	for (int i = 2; i <= n; i++)
		printf("%d%c", min(k, 1000000), i == n ? 10 : 32), k = max(0, k - 1000000);
}


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

#define ll long long
#define maxx 1000000

int main(){
	ll k,s,b=1000,d=1,x;
	cin>>k;
	while(1){
		while((k+d)%b!=0) d+=1;
		s=(k+d+b)/b;
		if(d==1){
			b-=1;
			continue;
		}
		if(s>maxx){
			x=s-maxx;
			s=maxx;
		}
		else{
			x=0;
		}
		cout<<b+d<<"\n";
		for(int i=1;i<b;i++) cout<<"0 ";
		cout<<"-1 "<<x<<" ";
		for(int i=2;i<d;i++) cout<<"0 ";
		cout<<s<<"\n";
		break;
	}
	return 0;
}


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

#define ll long long
#define maxx 1000000

int main(){
	ll k,s,b=1000,d=1,x;
	cin>>k;
	while((k+d)%b!=0) d+=1;
	s=(k+d+b)/b;
	if(s>maxx){
		x=s-maxx;
		s=maxx;
	}
	else{
		x=0;
	}
	cout<<b+d<<"\n";
	for(int i=1;i<b;i++) cout<<"0 ";
	cout<<"-1 "<<x<<" ";
	for(int i=2;i<d;i++) cout<<"0 ";
	cout<<s<<"\n";
	return 0;
}


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

#define ll long long
#define maxx 1000000

int main(){
	ll k,s,b=1000,d=1,x;
	cin>>k;
	while((k+d)%b!=0) d+=1;
	s=(k+d+b)/b;
	if(s>maxx){
		x=maxx-s;
		s=maxx;
	}
	else{
		x=0;
	}
	cout<<b+d<<"\n";
	for(int i=1;i<b;i++) cout<<"0 ";
	cout<<"-1 "<<x<<" ";
	for(int i=2;i<d;i++) cout<<"0 ";
	cout<<s<<"\n";
	return 0;
}


#include <iostream>
#include <vector>

using namespace std;

namespace
{
    using valcol = std::vector<int>;

    valcol gen(int k)
    {
        const auto r = k+2;
        return {-1, r};
    }
}
int main()
{
    int k = 0;
    cin>>k;
    const auto r = gen(k);
    if(!r.empty())
    {
        cout<<r.size()<<endl;
        for(auto v : r)
            cout<<v<<' ';
        cout<<endl;
    }
    else
    {
        cout<<-1<<endl;
    }
    return 0;
}


#include <iostream>
#include <vector>

using namespace std;

namespace
{
    using valcol = std::vector<int>;

    valcol gen(int k)
    {
        const auto r = k+2;
        return {r, -1};
    }
}
int main()
{
    int k = 0;
    cin>>k;
    const auto r = gen(k);
    if(!r.empty())
    {
        cout<<r.size()<<endl;
        for(auto v : r)
            cout<<v<<' ';
        cout<<endl;
    }
    else
    {
        cout<<-1<<endl;
    }
    return 0;
}


#include <iostream>
#include <cstddef>
#include <vector>

using namespace std;

namespace
{
    using valcol = std::vector<int>;
    constexpr int MAXA = 1000000;
    constexpr int MAXN = 2000;

    valcol gen(int k)
    {
        for(int m = 2; m <= MAXN; ++m)
        {
            for(int da = 1; da <= MAXA; ++da)
            {
                const auto v = m*da + k;
                for(int dn = 2; dn <= MAXN; ++dn)
                {
                    if(v%dn == 0 && v/dn <= MAXA)
                    {
                        const auto a = v/dn;
                        const auto n = m+dn;
                        const auto b = a+da;
                        if(n <= MAXN && a <= MAXA)
                        {
                            valcol res;
                            for(int p = 1; p < dn; ++p)
                            {
                                res.push_back(0);
                            }
                            res.push_back(-da);
                            res.push_back(b);
                            for(int p = 1; p < m; ++p)
                            {
                                res.push_back(0);
                            }
                            return res;
                        }
                    }
                }
            }
        }
        return {};
    }
}
int main()
{
    int k = 0;
    cin>>k;
    const auto r = gen(k);
    if(!r.empty())
    {
        cout<<r.size()<<endl;
        for(auto v : r)
            cout<<v<<' ';
        cout<<endl;
    }
    else
    {
        cout<<-1<<endl;
    }
    return 0;
}


#include <iostream>
#include <cstddef>
#include <vector>

using namespace std;

namespace
{
    using valcol = std::vector<int>;
    constexpr int MAXA = 1000000;
    constexpr int MAXN = 2000;

    valcol gen(int k)
    {
        for(int m = 2; m <= MAXN; ++m)
        {
            for(int da = 1; da <= MAXA; ++da)
            {
                const auto v = m*da + k;
                for(int dn = 2; dn <= MAXN; ++dn)
                {
                    if(v%dn == 0 && v/dn <= MAXA)
                    {
                        const auto a = v/dn;
                        const auto n = m+dn;
                        const auto b = a+da;
                        if(n <= MAXN && b <= MAXA)
                        {
                            valcol res;
                            for(int p = 1; p < dn; ++p)
                            {
                                res.push_back(0);
                            }
                            res.push_back(-da);
                            res.push_back(b);
                            for(int p = 1; p < m; ++p)
                            {
                                res.push_back(0);
                            }
                            return res;
                        }
                    }
                }
            }
        }
        return {};
    }
}
int main()
{
    int k = 0;
    cin>>k;
    const auto r = gen(k);
    if(!r.empty())
    {
        cout<<r.size()<<endl;
        for(auto v : r)
            cout<<v<<' ';
        cout<<endl;
    }
    else
    {
        cout<<-1<<endl;
    }
    return 0;
}


#include <iostream>
#include <cstddef>
#include <vector>

using namespace std;

namespace
{
    using valcol = std::vector<int>;
    constexpr int MAXA = 1000000;
    constexpr int MAXN = 2000;

    valcol gen(int k)
    {
        for(int i = 2; i <= MAXN && (i-1) <= (k+1); ++i)
        {
            if((k+1)%(i-1) == 0)
            {
                const auto y = (k+1)/(i-1) + 1;
                if(y <= MAXA)
                {
                    valcol res;
                    for(int j = 2; j < i; ++j)
                    {
                        res.push_back(0);
                    }
                    res.push_back(-1);
                    res.push_back(y);
                    return res;
                }
            }
        }
        return {};
    }
}
int main()
{
    int k = 0;
    cin>>k;
    const auto r = gen(k);
    if(!r.empty())
    {
        cout<<r.size()<<endl;
        for(auto v : r)
            cout<<v<<' ';
        cout<<endl;
    }
    else
    {
        cout<<-1<<endl;
    }
    return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long k,S,a[2];
int main(){
	cin>>k; // S - n + 1 = k
	int n = 2000;
	S = k+n-1;
	a[0] = -1;
	a[1] = S-a[0]-(n-2); //其他都为1
	cout<<n<<endl;
	cout<<a[0]<<" "<<a[1]<<" ";
	for(int i=2; i<n; i++){
		cout<<1<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
using namespace std;
long long k,S,a[2];
int main(){
	cin>>k; // S - n + 1 = k
	int n = 2000;
	S = k+n-1;
	a[0] = -1;
	a[1] = S-a[0]-(n-2); //其他都为1
	cout<<n<<endl;
	cout<<a[0]<<" "<<a[1];
	for(int i=2; i<n; i++){
		cout<<1<<" ";
	}
	return 0;
}


#include<bits/stdc++.h>
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const ll mod= 1e9+7;
long double PI = acosl(-1);
const int inf = 1e8+1;
const int nmax = 5e3+5;

int seal(int n, int d){
    return n/d + (n%d?1:0);
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0);

//    freopen("bajeces.txt", "r", stdin);
//    freopen("mara.txt", "w", stdout);

    int k;
    cin>>k;
    for(int n=2; n<=2000; n++){
        for(int x=seal(k,n-1); x<=1000000; x++){
            int z = x*(n-1)-k;
            if(z%n or z/n<=1) continue;
            int y = z/n;
            cout<<n<<"\n";
            for(int i=1; i<n-1; i++) cout<<"0 ";
            cout<<-y<<" "<<x;
            return 0;
        }
    }
    cout<<"-1";

    return 0;
}


#include<bits/stdc++.h>
#define eps 1e-8
#define eq(x,y) (fabs((x)-(y)) < eps)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int>pii;
const ll mod= 1e9+7;
long double PI = acosl(-1);
const int inf = 1e8+1;
const int nmax = 5e3+5;

int n,m;
int deg[nmax];
int dis[nmax];
vector<int>boros;
int durotto(int u, int v){
    if(v>=u) return v-u;
    return n-u+v;
}

int main(){
    ios::sync_with_stdio(false); cin.tie(0);

//    freopen("bajeces.txt", "r", stdin);
//    freopen("mara.txt", "w", stdout);

    int k;
    cin>>k;

    for(int n=2; n<=2000; n++){
        for(int x=1; x<=1000000; x++){
            int z = x*(n-1)-k;
            if(z%n or z/n<=1) continue;
            int y = z/n;
            cout<<n<<"\n";
            for(int i=1; i<n-1; i++) cout<<"0 ";
            cout<<-y<<" "<<x;
            return 0;
        }
    }
    cout<<"-1";

    return 0;
}


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

int main()
{
    //freopen("input.txt","r",stdin);
    int i,j,k;
    cin>>k;
    int l2=-1,l1=-1,v;
    for(int len2=2;len2<=2000;len2++){
        for(int len1=1;len1<len2;len1++){
            int diff=len2-len1;
            if((k+len2)%diff)continue;
            int val=(k+len2)/diff;
            if(((len1*(int)1e6 )<val) || (val<len1))continue;
            l2=len2;l1=len1;v=val;
            //cout<<len1<<' '<<len2<<' '<<val<<' '<<<<endl;
            break;
        }
        if(l2!= -1)break;
    }
//    cout<<l1<<' '<<l2<<' '<<v<<endl;
//    return 0;
    if(l2==-1)cout<<-1<<endl;
    else{
        cout<<2000<<endl;
        int extra=l2-l1;
        for(i=1;i<extra;i++)cout<<0<<' ';
        cout<<-1<<' ';
        int pos=extra+1;
        for(i=1;i<=l1;i++){
            if(v-(int)1e6 <(l1-1)){
                int _x= v-(l1-1);
                cout<<_x<<' ';
            }
            else{
                int _x=(int)1e6;
                cout<<_x<<' ';
                v-=_x;
            }
            pos++;
        }

        for(;pos<=2000;pos++)cout<<-1000000<<' ';
    }
    cout<<endl;
}


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

#define int long long

int32_t main()
{
    //freopen("input.txt","r",stdin);
    int i,j,k;
    cin>>k;
    int l2=-1,l1=-1,v;
    for(int len2=2;len2<=2000;len2++){
        for(int len1=1;len1<len2;len1++){
            int diff=len2-len1;
            if((k+len2)%diff)continue;
            int val=(k+len2)/diff;
            if(((len1*(int)1e6 )<val))continue;
            l2=len2;l1=len1;v=val;
            //cout<<len1<<' '<<len2<<' '<<val<<' '<<<<endl;
            break;
        }
        if(l2!= -1)break;
    }
//    cout<<l1<<' '<<l2<<' '<<v<<endl;
//    return 0;
    if(l2==-1)cout<<-1<<endl;
    else{
        cout<<2000<<endl;
        int extra=l2-l1;
        for(i=1;i<extra;i++)cout<<0<<' ';
        cout<<-1<<' ';
        int pos=extra+1;
        for(i=1;i<=l1;i++){
            if(v-(int)1e6 <(l1-1)){
                int _x= v-(l1-1);
                cout<<_x<<' ';
            }
            else{
                int _x=(int)1e6;
                cout<<_x<<' ';
                v-=_x;
            }
            pos++;
        }

        for(;pos<=2000;pos++)cout<<-1000000<<' ';
    }
    cout<<endl;
}


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

int main()
{
    //freopen("input.txt","r",stdin);
    int i,j,k;
    cin>>k;
    int l2=-1,l1=-1,v;
    for(int len2=2;len2<=2000;len2++){
        for(int len1=1;len1<len2;len1++){
            int diff=len2-len1;
            if((k+len2)%diff)continue;
            int val=(k+len2)/diff;
            if(((len1*(int)1e6 )<val) || (val<len1))continue;
            l2=len2;l1=len1;v=val;
            //cout<<len1<<' '<<len2<<' '<<val<<' '<<<<endl;
            break;
        }
        if(l2!= -1)break;
    }
//    cout<<l1<<' '<<l2<<' '<<v<<endl;
//    return 0;
    if(l2==-1)cout<<-1<<endl;
    else{
        cout<<2000<<endl;
        int extra=l2-l1;
        for(i=1;i<extra;i++)cout<<0<<' ';
        cout<<-1<<' ';
        int pos=extra+1;
        for(i=1;i<=l1;i++){
            if(v-(int)1e6 <(l1-1)){
                int _x= v-(l1-1);
                cout<<_x<<' ';
            }
            else{
                int _x=(int)1e6;
                cout<<_x<<' ';
                v-=_x;
            }
            pos++;
        }

        for(;pos<=20;pos++)cout<<-1000000<<' ';
    }
}


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

int main()
{
    //freopen("input.txt","r",stdin);
    int i,j,k;
    cin>>k;
    int l2=-1,l1=-1,v;
    for(int len2=2;len2<=2000;len2++){
        for(int len1=1;len1<len2;len1++){
            int diff=len2-len1;
            if((k+len2)%diff)continue;
            int val=(k+len2)/diff;
            if(((len1*(int)1e6 )<val) || (val<len1))continue;
            l2=len2;l1=len1;v=val;
            //cout<<len1<<' '<<len2<<' '<<val<<' '<<<<endl;
            break;
        }
        if(l2!= -1)break;
    }
//    cout<<l1<<' '<<l2<<' '<<v<<endl;
//    return 0;
    if(l2==-1)cout<<-1<<endl;
    else{
        cout<<2000<<endl;
        int extra=l2-l1;
        for(i=1;i<extra;i++)cout<<0<<' ';
        cout<<-1<<' ';
        int pos=extra+1;
        for(i=1;i<=l1;i++){
            if(v-(int)1e6 <(l1-1)){
                int _x= v-(l1-1);
                cout<<_x<<' ';
            }
            else{
                int _x=(int)1e6;
                cout<<_x<<' ';
                v-=_x;
            }
            pos++;
        }

        for(;pos<=20;pos++)cout<<-1000000<<' ';
    }
    cout<<endl;
}


#include<cstdio>
#include<algorithm>
#include<vector>
#include<queue>
#include<stack>
using namespace std;

vector < vector < int > > L;
vector < vector < int > > L2;
queue < int > q;
stack < int > s;
int num[501][501][2];
bool odw[500*500*2+7];
int odl[500*500*2+7];
int R[500*500*2+7];
int t[501*500*2],t2[501*500*2];
void BFS(int a){
    q.push(a);
    odw[a] = 1;
    while(!q.empty()){
        a = q.front();
        q.pop();
        for(int i =0;i<L2[a].size();i++){
            int x =L2[a][i];
            if(!odw[x]){
                odw[x] = 1;
                odl[x] = odl[a]+1;
                q.push(x);
                R[x]=a;
            }
        }
    }
}

int main(void){
int n,m,x,c,d;
scanf("%d %d",&n,&m);
L.resize(n+1);
L2.resize(n*n*2+7);
for(int i =0;i<m;i++){
    scanf("%d %d",&c,&d);
    L[c].push_back(d);
    L[d].push_back(c);
}
int licznik = 1;
for(int i =1;i<=n;i++){
    for(int a =1; a<=n;a++){
        for(int b= 0; b <=1;b++){
            num[i][a][b]=licznik;
            t[licznik]=i;
            t2[licznik]=a;
            licznik++;
        }
    }
}
for(int i =1;i<=n;i++){
    odw[num[i][i][0]] = 1;
}
for(int i =1;i<=n;i++){
    for(int a =0;a <L[i].size();a++){
        for(int b=1;b<=n;b++){
            c = num[i][b][0];
            d=num[L[i][a]][b][1];
            L2[c].push_back(d);
            c = num[b][i][1];
            d = num[b][L[i][a]][0];
            L2[c].push_back(d);
        }
    }
}
BFS(num[1][n][0]);
if(odl[num[n][1][0]]){
    x = odl[num[n][1][0]];
    printf("%d\n",x/2);
    int b = num[n][1][0];
    printf("1 ");
    for(int i = 0;i<x/2;i++){
        s.push(t[b]);
        //printf("(%d %d %d %d) ",t[b],t2[b],b,odl[b]);
        b = R[b];
        b = R[b];
    }
    while(!s.empty()){
        printf("%d ",s.top());
        s.pop();
    }
    printf("\n");
    b = num[n][1][0];
    printf("%d ",n);
    for(int i = 0;i<x/2;i++){
        //printf("(%d %d %d) ",t2[b],b,odl[b]);
        s.push(t2[b]);
        b = R[b];
        b = R[b];
    }
    while(!s.empty()){
        printf("%d ",s.top());
        s.pop();
    }
}else{
printf("-1");
}

return 0;
}


#include<bits/stdc++.h>
#pragma G++ optimize(3)
#define read() Read<int>()
#define Edge(u) for(int e=fir[u],v;v=to[e],e;e=nxt[e])
using namespace std;
typedef long long ll;
const int N=5e2+5,M=2e4+5;
int fir[N],nxt[M],to[M],ect=0,n,m;
int f[N][N],G[N][N];
typedef pair<int,int> P;
P paf[N][N],pag[N][N];
//vector<short int>res1[N][N],res2[N][N];
//vector<short int>Gr1[N][N],Gr2[N][N];
struct state{
	int x,y,val;
	state(){x=y=val=0;}
	state(int _x,int _y,int _val){ x=_x;y=_y;val=_val;}
};
queue<state>q1,q2;
inline void bfs()
{
	//res1[1][n].push_back(1);
//	res2[1][n].push_back(n);
	q1.push(state(1,n,f[1][n]=0));
	while(!q1.empty()||!q2.empty())
	{
		state tmp1=state(),tmp2=state();
		if(!q1.empty()) tmp1=q1.front();

		if(!q2.empty()) tmp2=q2.front();
		if(!q1.empty())q1.pop();
		if(!q2.empty())q2.pop();

		int x1=tmp1.x,y1=tmp1.y,v1=f[x1][y1];
		int x2=tmp2.x,y2=tmp2.y,v2=G[x2][y2];
		if(x1)
		Edge(x1)
		{

		if(G[v][y1]>v1)
		{

			q2.push(state(v,y1,G[v][y1]=v1));
			pag[v][y1]=make_pair(x1,y1);
	//		Gr1[v][y1]=res1[x1][y1];
	//		Gr1[v][y1].push_back(v);
	//		Gr2[v][y1]=res2[x1][y1];
		}
		}

		if(y2)
		Edge(y2)
		{

		if(f[x2][v]>v2+1&&x2!=v)
		{

			q1.push(state(x2,v,f[x2][v]=v2+1));
			paf[x2][v]=make_pair(x2,y2);
	//		res1[x2][v]=Gr1[x2][y2];
	//		res2[x2][v]=Gr2[x2][y2];
	//		res2[x2][v].push_back(v);
		}
		}

	}
}
inline void addedge(int u1,int v1)
{
	nxt[++ect]=fir[u1];fir[u1]=ect;to[ect]=v1;
}
int res1[N],res2[N],cnt1=0,cnt2=0;

inline void print(int x,int y,int opt)
{
	if(!x&&!y) return;

	if(opt==1)
	print(paf[x][y].first,paf[x][y].second,2);
	if(opt==2)
	print(pag[x][y].first,pag[x][y].second,1);
//	if(opt==1) res2[++cnt2]=y;
//	if(opt==2) res1[++cnt1]=x;
	if(opt==1) res1[++cnt1]=x,res2[++cnt2]=y;

}

int main(){

//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	memset(f,63,sizeof f);
	memset(G,63,sizeof G);
	cin>>n>>m;
	for(int i=1,x,y;i<=m;i++)
	cin>>x>>y,addedge(x,y),addedge(y,x);
	bfs();
	if(f[n][1]>1e9) return cout<<-1<<endl,0;
	else cout<<f[n][1]<<endl;
	print(n,1,1);
	for(int i=1;i<=cnt1;i++) cout<<res1[i]<<' ';
	cout<<endl;
	for(int i=1;i<=cnt2;i++) cout<<res2[i]<<' ';
	cout<<endl;
//	for(int i=0;i<res1[n][1].size();i++)
//	cout<<res1[n][1][i]<<' ';
//	cout<<endl;
//	for(int i=0;i<res2[n][1].size();i++)
//	cout<<res2[n][1][i]<<' ';
//	for(int i=1;i<=n;i++)
//	for(int j=1;j<=n;j++)
//	{
//		printf("v1[%d][%d]:",i,j);
//		for(int k=0;k<res1[i][j].size();k++)
//		printf("%d ",res1[i][j][k]);
//		printf("\n");
//		printf("v2[%d][%d]:",i,j);
//		for(int k=0;k<res2[i][j].size();k++)
//		printf("%d ",res2[i][j][k]);
//		printf("\n");
//		printf("G1[%d][%d]:",i,j);
//		for(int k=0;k<Gr1[i][j].size();k++)
//		printf("%d ",Gr1[i][j][k]);
//		printf("\n");
//		printf("G2[%d][%d]:",i,j);
//		for(int k=0;k<Gr2[i][j].size();k++)
//		printf("%d ",Gr2[i][j][k]);
//		printf("\n");
//	}
	return 0;
}


#include<bits/stdc++.h>
//#pragma G++ optimize(3)
#define read() Read<int>()
#define Edge(u) for(int e=fir[u],v;v=to[e],e;e=nxt[e])
using namespace std;
typedef long long ll;
const int N=5e2+5,M=2e4+5;
int fir[N],nxt[M],to[M],ect=0,n,m;
int f[N][N],G[N][N];
typedef pair<int,int> P;
P paf[N][N],pag[N][N];
//vector<short int>res1[N][N],res2[N][N];
//vector<short int>Gr1[N][N],Gr2[N][N];
struct state{
	int x,y,val;
	state(){x=y=val=0;}
	state(int _x,int _y,int _val){ x=_x;y=_y;val=_val;}
};
queue<state>q1,q2;
inline void bfs()
{
	//res1[1][n].push_back(1);
//	res2[1][n].push_back(n);
	q1.push(state(1,n,f[1][n]=0));
	while(!q1.empty()||!q2.empty())
	{
		state tmp1=state(),tmp2=state();
		if(!q1.empty()) tmp1=q1.front();

		if(!q2.empty()) tmp2=q2.front();
		if(!q1.empty())q1.pop();
		if(!q2.empty())q2.pop();

		int x1=tmp1.x,y1=tmp1.y,v1=f[x1][y1];
		int x2=tmp2.x,y2=tmp2.y,v2=G[x2][y2];
		if(x1)
		Edge(x1)
		{

		if(G[v][y1]>v1)
		{

			q2.push(state(v,y1,G[v][y1]=v1));
			pag[v][y1]=make_pair(x1,y1);
	//		Gr1[v][y1]=res1[x1][y1];
	//		Gr1[v][y1].push_back(v);
	//		Gr2[v][y1]=res2[x1][y1];
		}
		}

		if(y2)
		Edge(y2)
		{

		if(f[x2][v]>v2+1&&x2!=v)
		{

			q1.push(state(x2,v,f[x2][v]=v2+1));
			paf[x2][v]=make_pair(x2,y2);
	//		res1[x2][v]=Gr1[x2][y2];
	//		res2[x2][v]=Gr2[x2][y2];
	//		res2[x2][v].push_back(v);
		}
		}

	}
}
inline void addedge(int u1,int v1)
{
	nxt[++ect]=fir[u1];fir[u1]=ect;to[ect]=v1;
}
int res1[N],res2[N],cnt1=0,cnt2=0;

inline void print(int x,int y,int opt)
{
	if(!x&&!y) return;

	if(opt==1)
	print(paf[x][y].first,paf[x][y].second,2);
	if(opt==2)
	print(pag[x][y].first,pag[x][y].second,1);

	if(opt==1) res1[++cnt1]=x,res2[++cnt2]=y;

}

int main(){

	memset(f,63,sizeof f);
	memset(G,63,sizeof G);
	cin>>n>>m;
	for(int i=1,x,y;i<=m;i++)
	cin>>x>>y,addedge(x,y),addedge(y,x);
	bfs();
	if(f[n][1]>1e9) return cout<<-1<<endl,0;
	else cout<<f[n][1]<<endl;
	print(n,1,1);
	for(int i=1;i<=cnt1;i++) cout<<res1[i]<<' ';
	cout<<endl;
	for(int i=1;i<=cnt2;i++) cout<<res2[i]<<' ';
	cout<<endl;
//	}
	return 0;
}


#include <bits/stdc++.h>

#define int long long
#define pb push_back
#define F first
#define S second
#define pii pair <int,int>

using namespace std;

const int N=509,INF=1e9;
vector <int> adj[N],v1,v2;
int dis[N][N][2],par[N][N][2];
bool mrk[N][N][2];

inline void BFS(int n){
    for(int i=0;i<N;i++) for(int j=0;j<N;j++) dis[i][j][0]=dis[i][j][1]=INF;
    queue <pair <pii,bool> > q;
    mrk[1][n][0]=1; dis[1][n][0]=0;
    q.push({{1,n},0});
    while(!q.empty()){
        int x=q.front().F.F,y=q.front().F.S,t=q.front().S;
        q.pop();
        if(!t){
            for(auto v:adj[x]){
                if(!mrk[v][y][1]){
                    par[v][y][1]=x;
                    dis[v][y][1]=dis[x][y][0]+1;
                    mrk[v][y][1]=1;
                    q.push({{v,y},1});
                }
            }
        }
        else for(auto v:adj[y]) if(!mrk[x][v][0] && v!=x){
            par[x][v][0]=y;
            dis[x][v][0]=dis[x][y][1]+1;
            mrk[x][v][0]=1;
            q.push({{x,v},0});
        }
    }
}

int32_t main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        adj[u].pb(v); adj[v].pb(u);
    }
    BFS(n);
    if(!mrk[n][1][0]) return cout<<-1,0;
    cout<<dis[n][1][0]/2<<endl;
    int x=n,y=1;
    while(x!=0){
        v2.pb(x),v1.pb(y);
        y=par[x][y][0];
        x=par[x][y][1];
    }
    for(auto i:v1) cout<<i<<" ";
    cout<<endl;
    for(auto i:v2) cout<<i<<" ";
    return 0;
}
//hellobig_tq


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}
vector<int>ed[505];
int d[505][505];
int n,m;
bool vis[505][505];
pii pa[505][505];
void solve(){
	cin>>n>>m;
	rep(i,m){
		int u,v;
		cin>>u>>v;
		ed[u].pb(v);
		ed[v].pb(u);
	}
	queue<pii>q;
	q.push(pii(1,n));
	d[1][n]=1;
	while(!q.empty()){
		int u=q.front().fi,v=q.front().se;
		q.pop();
		//if(d[u][v]>1)continue;
		for(int a:ed[u]){
			if(vis[a][v])continue;
			vis[a][v]=true;
			for(int b:ed[v]){
				if(a==b)continue;
				if(!d[a][b]){
					d[a][b]=d[u][v]+1;
					q.push(pii(a,b));
					pa[a][b]=pii(u,v);
				}
				if(d[n][1])break;
			}
			if(d[n][1])break;
		}
		if(d[n][1])break;
	}
	if(!d[n][1]){
		cout<<-1;
		return ;
	}
	vector<int>r1,r2;
	pii p=pii(n,1);
	while(p.fi!=1||p.se!=n){
		r1.pb(p.fi);
		r2.pb(p.se);
		p=pa[p.fi][p.se];
	}
	r1.pb(1),r2.pb(n);
	cout<<r1.size()-1<<"\n";
	for(int i:r2)cout<<i<<" ";
		cout<<"\n";
	for(int i:r1)cout<<i<<" ";
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


#include<bits/stdc++.h>
using namespace std;
int n, m;
const int maxN = 1e3 + 13;
vector<int> adj[maxN];
int sp[maxN][maxN];
pair<int, int> par[maxN][maxN];
queue<pair<int, int>> qu;
vector<int> vec1, vec2;
int main () {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
	int x, y;
	cin >> x >> y;
	adj[x].push_back(y);
	adj[y].push_back(x);
    }
    sp[1][n] = 1;
    qu.push({1, n});
    par[1][n] = {0, 0};
    while (!qu.empty()) {
    	int u = qu.front().first, v = qu.front().second;
    	qu.pop();
    	if (u != v) {
    	    for (auto a : adj[u])
        		for (auto b : adj[v]) {
        		    if (!sp[a][b]) {
        			sp[a][b] = sp[u][v] + 1;
        			qu.push({a, b});
        			par[a][b] = {u, v};
        		    }
        		}
    	}
    }

    int x = n, y = 1;
    if (!sp[x][y])
	return cout << -1 << endl, 0;
    while (x + y > 0) {
    	vec1.push_back(x);
    	vec2.push_back(y);
    	int tmp = par[x][y].first;
    	y = par[x][y].second;
    	x = tmp;
    }
    cout << vec1.size() - 1 << endl;
    for (int i = 0; i < vec2.size(); i++)
	cout << vec2[i] << " ";
    cout << endl;
    for (int i = 0; i < vec1.size(); i++)
	cout << vec1[i] << " ";
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}
vector<int>ed[505];
int d[505][505];
int n,m;
pii pa[505][505];
void solve(){
	cin>>n>>m;
	rep(i,m){
		int u,v;
		cin>>u>>v;
		ed[u].pb(v);
		ed[v].pb(u);
	}
	queue<pii>q;
	q.push(pii(1,n));
	d[1][n]=1;
	for(int i=1;i<=n;i++)d[i][i]=inf;
	while(q.size()){
		int u=q.front().fi,v=q.front().se;
		q.pop();
		//if(d[u][v]>1)continue;
		for(int a:ed[u]){
			if(d[n][1])break;
			for(int b:ed[v]){
				if(d[n][1])break;
				if(!d[a][b]){
					d[a][b]=d[u][v]+1;
					q.push(pii(a,b));
					pa[a][b]=pii(u,v);
				}
			}
		}
		if(d[n][1])break;
	}
	if(!d[n][1]){
		cout<<-1;
		return ;
	}
	vector<int>r1,r2;
	pii p=pii(n,1);
	while(p.fi!=1||p.se!=n){
		r1.pb(p.fi);
		r2.pb(p.se);
		p=pa[p.fi][p.se];
	}
	r1.pb(1),r2.pb(n);
	cout<<r1.size()-1<<"\n";
	for(int i:r2)cout<<i<<" ";
		cout<<"\n";
	for(int i:r1)cout<<i<<" ";
}
int main()
{
	//waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}
vector<int>ed[505];
int d[505][505];
int n,m;
pii pa[505][505];
void solve(){
	cin>>n>>m;
	rep(i,m){
		int u,v;
		cin>>u>>v;
		ed[u].pb(v);
		ed[v].pb(u);
	}
	queue<pii>q;
	q.push(pii(1,n));
	d[1][n]=1;
	for(int i=1;i<=n;i++)d[i][i]=inf;
	while(!q.empty()){
		int u=q.front().fi,v=q.front().se;
		q.pop();
		//if(d[u][v]>1)continue;
		for(int a:ed[u]){
			if(d[n][1])break;
			for(int b:ed[v]){
				if(d[n][1])break;
				if(!d[a][b]){
					d[a][b]=d[u][v]+1;
					q.push(pii(a,b));
					pa[a][b]=pii(u,v);
				}
			}
		}
		if(d[n][1])break;
	}
	if(!d[n][1]){
		cout<<-1;
		return ;
	}
	vector<int>r1,r2;
	pii p=pii(n,1);
	while(p.fi!=1||p.se!=n){
		r1.pb(p.fi);
		r2.pb(p.se);
		p=pa[p.fi][p.se];
	}
	r1.pb(1),r2.pb(n);
	cout<<r1.size()-1<<"\n";
	for(int i:r2)cout<<i<<" ";
		cout<<"\n";
	for(int i:r1)cout<<i<<" ";
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}
vector<int>ed[505];
int d[505][505];
int n,m;
pii pa[505][505];
void solve(){
	cin>>n>>m;
	rep(i,m){
		int u,v;
		cin>>u>>v;
		ed[u].pb(v);
		ed[v].pb(u);
	}
	queue<pii>q;
	q.push(pii(1,n));
	d[1][n]=1;
	pa[1][n]=pii(0,0);
	for(int i=1;i<=n;i++)d[i][i]=inf;
	while(!q.empty()){
		int u=q.front().fi,v=q.front().se;
		q.pop();
		for(int a:ed[u]){
			for(int b:ed[v]){
				if(!d[a][b]){
					d[a][b]=d[u][v]+1;
					q.push(pii(a,b));
					pa[a][b]=pii(u,v);
				}
			}
		}
		if(d[n][1])break;
	}
	if(!d[n][1]){
		cout<<-1;
		return ;
	}
	vector<int>r1,r2;
	pii p=pii(n,1);
	while(p.fi+p.se>0){
		r1.pb(p.fi);
		r2.pb(p.se);
		p=pa[p.fi][p.se];
	}
	cout<<r1.size()-1<<"\n";
	for(int i:r2)cout<<i<<" ";
		cout<<"\n";
	for(int i:r1)cout<<i<<" ";
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


#include<bits/stdc++.h>
using namespace std;
int n, m;
const int maxN = 1e3 + 13;
vector<int> adj[maxN];
int sp[maxN][maxN];
pair<int, int> par[maxN][maxN];
queue<pair<int, int>> qu;
vector<int> vec1, vec2;
int main () {
    cin >> n >> m;
    for (int i = 0; i < m; i++) {
	int x, y;
	cin >> x >> y;
	adj[x].push_back(y);
	adj[y].push_back(x);
    }
    sp[1][n] = 1;
    qu.push({1, n});
    par[1][n] = {0, 0};
    while (!qu.empty()) {
    	int u = qu.front().first, v = qu.front().second;
    	qu.pop();
    	if (u != v) {
    	    for (auto a : adj[u])
        		for (auto b : adj[v]) {
        		    if(sp[n][1])break;
        		    if (!sp[a][b]) {
        			sp[a][b] = sp[u][v] + 1;
        			qu.push({a, b});
        			par[a][b] = {u, v};
        		    }
        		}
    	}
    	if(sp[n][1])break;
    }

    int x = n, y = 1;
    if (!sp[x][y])
	return cout << -1 << endl, 0;
    while (x + y > 0) {
    	vec1.push_back(x);
    	vec2.push_back(y);
    	int tmp = par[x][y].first;
    	y = par[x][y].second;
    	x = tmp;
    }
    cout << vec1.size() - 1 << endl;
    for (int i = 0; i < vec2.size(); i++)
	cout << vec2[i] << " ";
    cout << endl;
    for (int i = 0; i < vec1.size(); i++)
	cout << vec1[i] << " ";
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}
vector<int>ed[505];
int d[505][505];
int n,m;
pii pa[505][505];
void solve(){
	cin>>n>>m;
	rep(i,m){
		int u,v;
		cin>>u>>v;
		ed[u].pb(v);
		ed[v].pb(u);
	}
	queue<pii>q;
	q.push(pii(1,n));
	d[1][n]=1;
	for(int i=1;i<=n;i++)d[i][i]=inf;
	while(!q.empty()){
		int u=q.front().fi,v=q.front().se;
		q.pop();
		for(int a:ed[u]){
			for(int b:ed[v]){
				if(!d[a][b]){
					d[a][b]=d[u][v]+1;
					q.push(pii(a,b));
					pa[a][b]=pii(u,v);
				}
				if(d[n][1])break;
			}
		}
	}
	if(!d[n][1]){
		cout<<-1;
		return ;
	}
	vector<int>r1,r2;
	pii p=pii(n,1);
	while(p.fi!=1||p.se!=n){
		r1.pb(p.fi);
		r2.pb(p.se);
		p=pa[p.fi][p.se];
	}
	r1.pb(1),r2.pb(n);
	cout<<r1.size()-1<<"\n";
	for(int i:r2)cout<<i<<" ";
		cout<<"\n";
	for(int i:r1)cout<<i<<" ";
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}
vector<int>ed[505];
int d[505][505];
int n,m;
pii pa[505][505];
void solve(){
	cin>>n>>m;
	rep(i,m){
		int u,v;
		cin>>u>>v;
		ed[u].pb(v);
		ed[v].pb(u);
	}
	queue<pii>q;
	q.push(pii(1,n));
	d[1][n]=1;
	pa[1][n]=pii(0,0);
	while(q.size()){
		int u=q.front().fi,v=q.front().se;
		q.pop();
		if(u!=v){
			for(int a:ed[u]){
				if(d[n][1])break;
				for(int b:ed[v]){
					if(d[n][1])break;
					if(!d[a][b]){
						d[a][b]=d[u][v]+1;
						q.push(pii(a,b));
						pa[a][b]=pii(u,v);
					}
				}
			}
		}
		if(d[n][1])break;
	}
	if(!d[n][1]){
		cout<<-1;
		return ;
	}
	vector<int>r1,r2;
	pii p=pii(n,1);
	while(p.fi+p.se>0){
		r1.pb(p.fi);
		r2.pb(p.se);
		p=pa[p.fi][p.se];
	}
	cout<<r1.size()-1<<"\n";
	for(int i:r2)cout<<i<<" ";
		cout<<"\n";
	for(int i:r1)cout<<i<<" ";
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}
vector<int>ed[505];
int d[505][505];
int n,m;
pii pa[505][505];
void solve(){
	cin>>n>>m;
	rep(i,m){
		int u,v;
		cin>>u>>v;
		ed[u].pb(v);
		ed[v].pb(u);
	}
	queue<pii>q;
	q.push(pii(1,n));
	d[1][n]=1;
	while(!q.empty()){
		int u=q.front().fi,v=q.front().se;
		q.pop();
		//if(d[u][v]>1)continue;
		for(int a:ed[u]){
			for(int b:ed[v]){
				if(a==b)continue;
				if(!d[a][b]){
					d[a][b]=d[u][v]+1;
					q.push(pii(a,b));
					pa[a][b]=pii(u,v);
				}
				if(d[n][1])break;
			}
		}
	}
	if(!d[n][1]){
		cout<<-1;
		return ;
	}
	vector<int>r1,r2;
	pii p=pii(n,1);
	while(p.fi!=1||p.se!=n){
		r1.pb(p.fi);
		r2.pb(p.se);
		p=pa[p.fi][p.se];
	}
	r1.pb(1),r2.pb(n);
	cout<<r1.size()-1<<"\n";
	for(int i:r2)cout<<i<<" ";
		cout<<"\n";
	for(int i:r1)cout<<i<<" ";
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#include<cstring>
#define initdp(a,b) for(int i=0;i<=a;i++)for(int j=0;j<=b;j++)dp[i][j]=-1;
#define fi first
#define se second
#define pb push_back
#define pii pair<int,int>
#define ll long long
#define pll pair<ll,ll>
#define rep(i,n) for(int i=0;i<n;i++)
#define repd(i,n) for(int i=n-1;i>=0;i--)
#define waste ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define inf 1e9+1
#define inf1 1e18+1
#define mod 1000000007
#define pie 3.14159265358979323846
#define N 1000005
#define mid(l,r) l+(r-l)/2
using namespace std;
int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1};
int ddx[8]={1,1,0,-1,-1,-1,0,1},ddy[8]={0,1,1,1,0,-1,-1,-1};
void mad(ll &a,ll b){a=(a+b)%mod;if(a<0)a+=mod;}
ll gcd(ll a,ll b){ if(a>b)swap(a,b);if(!a)return b;return gcd(b%a,a);}
vector<int>ed[505];
int d[505][505];
int n,m;
pii pa[505][505];
void solve(){
	cin>>n>>m;
	rep(i,m){
		int u,v;
		cin>>u>>v;
		ed[u].pb(v);
		ed[v].pb(u);
	}
	queue<pii>q;
	q.push(pii(1,n));
	d[1][n]=1;
	while(!q.empty()){
		int u=q.front().fi,v=q.front().se;
		q.pop();
		//if(d[u][v]>1)continue;
		for(int a:ed[u]){
			for(int b:ed[v]){
				if(a==b)continue;
				if(!d[a][b]){
					d[a][b]=d[u][v]+1;
					q.push(pii(a,b));
					pa[a][b]=pii(u,v);
				}
			}
		}
	}
	if(!d[n][1]){
		cout<<-1;
		return ;
	}
	vector<int>r1,r2;
	pii p=pii(n,1);
	while(p.fi!=1||p.se!=n){
		r1.pb(p.fi);
		r2.pb(p.se);
		p=pa[p.fi][p.se];
	}
	r1.pb(1),r2.pb(n);
	cout<<r1.size()-1<<"\n";
	for(int i:r2)cout<<i<<" ";
		cout<<"\n";
	for(int i:r1)cout<<i<<" ";
}
int main()
{
	waste;
	int t;
	//cin>>t;
	t=1;
	while(t--){
		solve();
	}
}


#include <bits/stdc++.h>
using namespace std;
#define ll int
#define N (501)

ll n,m,dis[N][N][2];
vector <ll> e[N];
pair <ll,ll> par[N][N][2];

int main()
{
	scanf("%d%d",&n,&m);
	for(int i=0;i<m;i++)
	{
		ll v,u;
		scanf("%d%d",&v,&u);
		e[v].push_back(u);
		e[u].push_back(v);
	}
	queue <pair<pair<ll,ll>,bool> > q;
	q.push({{1,n},0});
	dis[1][n][0]=1;
	while(q.size())
	{
		ll x=q.front().first.first,y=q.front().first.second;
		bool p=q.front().second;
		q.pop();
		if(p)
			for(int i=0;i<e[y].size();i++)
			{
				ll y2=e[y][i];
				if(y2!=x && !dis[x][y2][0])
					par[x][y2][0]={x,y},dis[x][y2][0]=dis[x][y][1]+1,q.push({{x,y2},0});
			}
		else
			for(int i=0;i<e[x].size();i++)
			{
				ll x2=e[x][i];
				if(!dis[x2][y][1])
					par[x2][y][1]={x,y},dis[x2][y][1]=dis[x][y][0]+1,q.push({{x2,y},1});
			}
	}
	stack <ll> ans1,ans2;
	if(!dis[n][1][0]){printf("-1");return 0;}
	printf("%d\n",(dis[n][1][0]-1)/2);
	ll x=n,y=1,tmp;
	for(int i=0;i<dis[n][1][0];i+=2)
		ans2.push(y),tmp=x,x=par[x][y][(i&1)].first,y=par[tmp][y][(i&1)].second,tmp=x,x=par[x][y][((i+1)&1)].first,y=par[tmp][y][((i+1)&1)].second;
	x=n,y=1;
	for(int i=0;i<dis[n][1][0];i+=2)
		ans1.push(x),tmp=x,x=par[x][y][(i&1)].first,y=par[tmp][y][(i&1)].second,tmp=x,x=par[x][y][((i+1)&1)].first,y=par[tmp][y][((i+1)&1)].second;
	while(ans1.size())printf("%d ",ans1.top()),ans1.pop();
	printf("\n");
	while(ans2.size())printf("%d ",ans2.top()),ans2.pop();
    return 0;
}


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

#define pb push_back

const int MAXN = 501;
const int INF = 0x7f7f7f7f;

struct Triple {
  int a, b, c;
  Triple(int a, int b, int c) : a(a), b(b), c(c) {}
};

int n, m;
vector<int> g[MAXN];
int d[MAXN][MAXN][2];
int p[MAXN][MAXN][2];

void bfs() {
  queue<Triple> q;
  memset(d, 0x7f, sizeof d);
  d[1][n][0] = 0;
  q.push(Triple(1, n, 0));
  while (!q.empty()) {
    Triple state = q.front();
    q.pop();
    int v = state.c ? state.b : state.a;
    for (int to : g[v]) {
      if (state.c) {
        if (state.a != to && d[state.a][to][0] > d[state.a][state.b][1] + 1) {
          d[state.a][to][0] = d[state.a][state.b][1] + 1;
          p[state.a][to][0] = v;
          q.push(Triple(state.a, to, 0));
        }
      } else {
        if (d[to][state.b][1] > d[state.a][state.b][0] + 1) {
          d[to][state.b][1] = d[state.a][state.b][0] + 1;
          p[to][state.b][1] = v;
          q.push(Triple(to, state.b, 1));
        }
      }
    }
  }
}

int main() {
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  scanf("%d%d", &n, &m);
  for (int i = 0, a, b; i < m; ++i) {
    scanf("%d%d", &a, &b);
    g[a].pb(b);
    g[b].pb(a);
  }
  bfs();
  if (d[n][1][0] == INF) puts("-1");
  else {
    int len = d[n][1][0];
    printf("%d\n", len / 2);
    vector<int> ans[2];
    Triple state(n, 1, 0);
    for (int i = 0; i < len + 2; ++i) {
      ans[state.c ^ 1].pb(state.c ? state.a : state.b);
      if (state.c)
        state = Triple(p[state.a][state.b][state.c], state.b, 0);
      else state = Triple(state.a, p[state.a][state.b][state.c], 1);
    }
    reverse(ans[0].begin(), ans[0].end());
    reverse(ans[1].begin(), ans[1].end());
    for (auto it : ans[0]) {
      printf("%d ", it);
    }
    puts("");
        for (auto it : ans[1]) {
      printf("%d ", it);
    }
    puts("");
  }
  return 0;
}


#include <bits/stdc++.h>

#define int long long
#define pb push_back
#define F first
#define S second
#define pii pair <int,int>

using namespace std;

const int N=509,INF=1e9;
vector <int> adj[N];
int dis[N][N][2],par[N][N][2];
bool mrk[N][N][2];

inline void BFS(int n){
    for(int i=0;i<N;i++) for(int j=0;j<N;j++) dis[i][j][0]=dis[i][j][1]=INF;
    queue <pair <pii,bool> > q;
    mrk[1][n][0]=1; dis[1][n][0]=0;
    q.push({{1,n},0});
    while(!q.empty()){
        int x=q.front().F.F,y=q.front().F.S,t=q.front().S;
        q.pop();
        if(!t){
            for(auto v:adj[x]){
                if(!mrk[v][y][1]){
                    par[v][y][1]=x;
                    dis[v][y][1]=dis[x][y][0]+1;
                    mrk[v][y][1]=1;
                    q.push({{v,y},1});
                }
            }
        }
        else{
            for(auto v:adj[y]){
                if(!mrk[x][v][0] && v!=x){
                    par[x][v][0]=y;
                    dis[x][v][0]=dis[x][y][1]+1;
                    mrk[x][v][0]=1;
                    q.push({{x,v},0});
                }
            }
        }
    }
}

int32_t main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        adj[u].pb(v); adj[v].pb(u);
    }
    BFS(n);
    if(!mrk[n][1][0]) return cout<<-1,0;
    cout<<dis[n][1][0]/2<<endl;
    vector <int> v1,v2;
    int x=n,y=1;
    while(x!=0){
        v2.pb(x),v1.pb(y);
        y=par[x][y][0];
        x=par[x][y][1];
    }
    for(auto i:v1) cout<<i<<" ";
    cout<<endl;
    for(auto i:v2) cout<<i<<" ";
    return 0;
}


#include <bits/stdc++.h>

#define int long long
#define pb push_back
#define F first
#define S second
#define pii pair <int,int>

using namespace std;

const int N=509,INF=1e9;
vector <int> adj[N],v1,v2;
int dis[N][N][2],par[N][N][2];
bool mrk[N][N][2];

inline void BFS(int n){
    for(int i=0;i<N;i++) for(int j=0;j<N;j++) dis[i][j][0]=dis[i][j][1]=INF;
    queue <pair <pii,bool> > q;
    mrk[1][n][0]=1; dis[1][n][0]=0;
    q.push({{1,n},0});
    while(!q.empty()){
        int x=q.front().F.F,y=q.front().F.S,t=q.front().S;
        q.pop();
        if(!t) for(auto v:adj[x]) if(!mrk[v][y][1]){
            par[v][y][1]=x;
            dis[v][y][1]=dis[x][y][0]+1;
            mrk[v][y][1]=1;
            q.push({{v,y},1});
        }
        else for(auto v:adj[y]) if(!mrk[x][v][0] && v!=x){
            par[x][v][0]=y;
            dis[x][v][0]=dis[x][y][1]+1;
            mrk[x][v][0]=1;
            q.push({{x,v},0});
        }
    }
}

int32_t main(){
    ios::sync_with_stdio(0);cin.tie(0);
    int n,m;
    cin>>n>>m;
    for(int i=0;i<m;i++){
        int u,v;
        cin>>u>>v;
        adj[u].pb(v); adj[v].pb(u);
    }
    BFS(n);
    if(!mrk[n][1][0]) return cout<<-1,0;
    cout<<dis[n][1][0]/2<<endl;
    int x=n,y=1;
    while(x!=0){
        v2.pb(x),v1.pb(y);
        y=par[x][y][0];
        x=par[x][y][1];
    }
    for(auto i:v1) cout<<i<<" ";
    cout<<endl;
    for(auto i:v2) cout<<i<<" ";
    return 0;
}