#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
template<class T1,class T2> bool cmin(T1 &x,const T2 &y) { if (y<x) { x=y; return 1; }return 0; }
template<class T1,class T2> bool cmax(T1 &x,const T2 &y) { if (x<y) { x=y; return 1; }return 0; }
#define all(x) (x).begin(),(x).end()
int main()
{
ios::sync_with_stdio(0); cin.tie(0);
cout<<fixed<<setprecision(15);
ll n,m; char xxx;
cin>>n>>xxx>>m;
if(n<m)
ll d=10/m;
m=m*d;
n=n*d;
vector a(1,m-1);
if (n<m-1||n>m*(m-1)/2)
{
cout<<"impossible\n";
return 0;
}
ll sum=m-1;
if (sum<n)
for (int i=2; i<=m; i++)
{
if (sum+m-i<=n)
sum+=m-i,a.push_back(m-i);
else
{
a.push_back(n-sum);
sum=n;
break;
}
}
a.push_back(0);
int cnt=1,pre=1;
cout<<m<<'\n';
for (int i=0; i<a.size()-1; i++)
{
ll tp;
for (int j=1; j<=a[i]-a[i+1]; j++)
{
cout<<pre<<' '<<cnt+j<<'\n';
tp=cnt+j;
}
pre=tp;
cnt+=a[i]-a[i+1];
}
}
asdfdasf