#include<iostream>
# include <cmath>
# include <algorithm>
# include <cstdio>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <stack>
# include <set>
# include <list>
# include <deque>
# include <functional>
using namespace std;
#define DEBUG
#define DEB(x) cout<<#x<<"="<<x<<" "
#define DEBN(x) cout<<#x<<"="<<x<<"\n"
#ifdef DEBUG
#define D(x) DEBN(x)
#define DN(x) DEBN(x)
#define DA(a,n) cout<<#a<<"=["; printarray(a,n); cout<<"]\n"
#define DAR(a,n,s) cout<<#a<<"["<<s<<"-"<<n-1<<"]=["; printarray(a,n,s); cout<<"]\n"
#else
#define D(x)
#define DN(x)
#define DA(a,n)
#define DAR(a,n,s)
#endif
#ifdef DEBUG
#define DPR(fmt, ...) \
do { printf(fmt, ## __VA_ARGS__); } while (0)
#else
#define DPR(fmt, ...) \
do { } while (0)
#endif
#define PR(fmt, ...) \
do { printf(fmt, ## __VA_ARGS__); } while (0)
// Useful constants
#define INF (int)1e9
#define EPS (double)1e-9
# define mod 1000000007
# define PI 3.14159265f
#define pii pair<int,int>
#define pll pair<long long,long long>
#define mp make_pair
#define F first
#define S second
#define ll long long
#define tri pair< int,pii >
#define trl pair< long long,pll >
#define Ft first
#define St second.first
#define Tt second.second
#define mkt(a,b,c) mp(a,mp(b,c))
#define Max(a,b) (a>b?a:b)
#define Min(a,b) (a<b?a:b)
#define FI(n) for(i=0;i<n;i++)
#define FI1(n) for(i=1;i<n;i++)
#define FJ(n) for(j=0;j<n;j++)
#define FJ1(n) for(j=1;j<n;j++)
#define FJI for(j=0;j<i;j++)
#define FJI1 for(j=1;j<i;j++)
#define FJIE for(j=0;j<=i;j++)
#define FJIE1 for(j=1;j<=i;j++)
#define For(i,a,b) for(i=a;i<b;i++)
// Input macros
#define s(n) scanf("%d",&n)
#define sc(n) scanf("%c",&n)
#define sl(n) scanf("%I64d",&n)
#define sf(n) scanf("%lf",&n)
#define ss(n) scanf("%s",n)
//Output macros
#define pr(n) printf("%d ",n)
#define prn(n) printf("%d\n",n)
#define prc(n) printf("%c",n)
#define prcn(n) printf("%c\n",n)
#define prl(n) printf("%I64d ",n)
#define prln(n) printf("%I64d\n",n)
#define prf(n) printf("%lf ",n)
#define prfn(n) printf("%lf\n",n)
#define prs(n) printf("%s ",n)
#define prsn(n) printf("%s\n",n)
//STL containers
#define foreach(v, c) for( typeof( (c).begin()) v = (c).begin(); v != (c).end(); ++v)
#define all(a) a.begin(), a.end()
#define in(a,b) ( (b).find(a) != (b).end())
#define in2(a,b) ( find(all(b),a) != (b).end())
#define pb push_back
#define sz(a) ((int)(a.size()))
#define vi vector<int>
#define vl vector<long long>
#define svi(vec,n) FI(n) s(vec[i])
#define svl(vec,n) FI(n) sl(vec[i])
#define it ::iterator
//fill char arrays
#define fill(a,v) memset(a, v, sizeof (a))
#define checkbit(n,b) ( (n >> b) & 1)
#define INDEX(arr,ind) (lower_bound(all(arr),ind)-arr.begin())
#define sor(a) sort(all(a))
#define rsor(a) sort(all(a)); reverse(all(a));
#define exchange(t,a,b) typeof(a) t =a; a=b; b=t
//STL output ********************************
template <typename T1, typename T2>
inline std::ostream& operator << (std::ostream& os, const std::pair<T1, T2>& p)
{
return os << "(" << p.first << ", " << p.second << ")";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v)
{
bool first = true;
os << "[";
for(unsigned int i = 0; i < v.size(); i++)
{
if(!first)
os << ", ";
os << v[i];
first = false;
}
return os << "]";
}
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::set<T>& v)
{
bool first = true;
os << "[";
for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
{
if(!first)
os << ", ";
os << *ii;
first = false;
}
return os << "]";
}
template<typename T1, typename T2>
inline std::ostream &operator << (std::ostream & os,const std::map<T1, T2>& v)
{
bool first = true;
os << "[";
for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
{
if(!first)
os << ", ";
os << *ii ;
first = false;
}
return os << "]";
}
//*****************************************
//printing array
template<typename T,typename T2>
void printarray(T a[],T2 sz,T2 beg=0)
{
for(T2 i=beg;i<sz;i++) cout<<a[i]<<" ";
}
//*********************************8
bool check(pii a,pii b)
{
int ds=pow(a.F-b.F,2)+pow(a.S-b.S,2);
D(a);D(b);
D((pow(sqrt(ds),2)==ds));
return pow(sqrt(ds),2)==ds;
}
int main()
{
//freopen(".txt","r",stdin);
//freopen(".txt","w",stdout);
int i,j,k;
int n,m;
s(n);s(m);
vector<pii > pnts;
FI(n+1) FJ(m+1)
{
if(i==0 && j==0) continue;
For(k,0,sz(pnts))
{
if(check(pnts[k],mp(i,j))) break;
}
if(k==sz(pnts)) pnts.pb(mp(i,j));
}
prn(sz(pnts));
FI(sz(pnts))
{
pr(pnts[i].F);
prn(pnts[i].S);
}
return 0;
nosol:
prn(-1);
return 0;
}
I2luY2x1ZGU8aW9zdHJlYW0+CiMgaW5jbHVkZSA8Y21hdGg+CiMgaW5jbHVkZSA8YWxnb3JpdGhtPgojIGluY2x1ZGUgPGNzdGRpbz4KIyBpbmNsdWRlIDxjc3RyaW5nPgojIGluY2x1ZGUgPHN0cmluZz4KIyBpbmNsdWRlIDxjc3RkbGliPgojIGluY2x1ZGUgPHZlY3Rvcj4KIyBpbmNsdWRlIDxiaXRzZXQ+CiMgaW5jbHVkZSA8bWFwPgojIGluY2x1ZGUgPHF1ZXVlPgojIGluY2x1ZGUgPHN0YWNrPgojIGluY2x1ZGUgPHNldD4KIyBpbmNsdWRlIDxsaXN0PgojIGluY2x1ZGUgPGRlcXVlPgojIGluY2x1ZGUgPGZ1bmN0aW9uYWw+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgojZGVmaW5lIERFQlVHCgoKI2RlZmluZSBERUIoeCkgY291dDw8I3g8PCI9Ijw8eDw8IiAiCiNkZWZpbmUgREVCTih4KSBjb3V0PDwjeDw8Ij0iPDx4PDwiXG4iCgoKI2lmZGVmIERFQlVHCiNkZWZpbmUgRCh4KSBERU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ZpcnN0CiNkZWZpbmUgU3Qgc2Vjb25kLmZpcnN0CiNkZWZpbmUgVHQgc2Vjb25kLnNlY29uZAojZGVmaW5lIG1rdChhLGIsYykgbXAoYSxtcChiLGMpKQoKCiNkZWZpbmUgTWF4KGEsYikgKGE+Yj9hOmIpCiNkZWZpbmUgTWluKGEsYikgKGE8Yj9hOmIpCiNkZWZpbmUgRkkobikgZm9yKGk9MDtpPG47aSsrKQojZGVmaW5lIEZJMShuKSBmb3IoaT0xO2k8bjtpKyspCiNkZWZpbmUgRkoobikgZm9yKGo9MDtqPG47aisrKQojZGVmaW5lIEZKMShuKSBmb3Ioaj0xO2o8bjtqKyspCiNkZWZpbmUgRkpJIGZvcihqPTA7ajxpO2orKykKI2RlZmluZSBGSkkxIGZvcihqPTE7ajxpO2orKykKI2RlZmluZSBGSklFIGZvcihqPTA7ajw9aTtqKyspCiNkZWZpbmUgRkpJRTEgZm9yKGo9MTtqPD1pO2orKykKI2RlZmluZSBGb3IoaSxhLGIpIGZvcihpPWE7aTxiO2krKykKCi8vIElucHV0IG1hY3JvcwojZGVmaW5lIHMobikgICAgICAgICAgICAgICAgICAgICAgICBzY2FuZigiJWQiLCZuKQojZGVmaW5lIHNjKG4pICAgICAgICAgICAgICAgICAgICAgICBzY2FuZigiJWMiLCZuKQojZGVmaW5lIHNsKG4pICAgICAgICAgICAgICAgICAgICAgICBzY2FuZigiJUk2NGQiLCZuKQojZGVmaW5lIHNmKG4pICAgICAgICAgICAgICAgICAgICAgICBzY2FuZigiJWxmIiwmbikKI2RlZmluZSBzcyhuKSAgICAgICAgICAgICAgICAgICAgICAgc2NhbmYoIiVzIixuKQoKLy9PdXRwdXQgbWFjcm9zCiNkZWZpbmUgcHIobikgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIlZCAiLG4pCiNkZWZpbmUgcHJuKG4pICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiJWRcbiIsbikKI2RlZmluZSBwcmMobikgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiJWMiLG4pCiNkZWZpbmUgcHJjbihuKSAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIlY1xuIixuKQojZGVmaW5lIHBybChuKSAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIlSTY0ZCAiLG4pCiNkZWZpbmUgcHJsbihuKSAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIlSTY0ZFxuIixuKQojZGVmaW5lIHByZihuKSAgICAgICAgICAgICAgICAgICAgICAgcHJpbnRmKCIlbGYgIixuKQojZGVmaW5lIHByZm4obikgICAgICAgICAgICAgICAgICAgICAgIHByaW50ZigiJWxmXG4iLG4pCiNkZWZpbmUgcHJzKG4pICAgICAgICAgICAgICAgICAgICAgICBwcmludGYoIiVzICIsbikKI2RlZmluZSBwcnNuKG4pICAgICAgICAgICAgICAgICAgICAgICBwcmludGYoIiVzXG4iLG4pCgoKCi8vU1RMIGNvbnRhaW5lcnMKI2RlZmluZSBmb3JlYWNoKHYsIGMpICAgICAgICAgICAgICAgZm9yKCB0eXBlb2YoIChjKS5iZWdpbigpKSB2ID0gKGMpLmJlZ2luKCk7ICB2ICE9IChjKS5lbmQoKTsgKyt2KQojZGVmaW5lIGFsbChhKSAgICAgICAgICAgICAgICAgICAgICBhLmJlZ2luKCksIGEuZW5kKCkKI2RlZmluZSBpbihhLGIpICAgICAgICAgICAgICAgICAgICAgKCAoYikuZmluZChhKSAhPSAoYikuZW5kKCkpCiNkZWZpbmUgaW4yKGEsYikgICAgICAgICAgICAgICAgICAgICAoIGZpbmQoYWxsKGIpLGEpICE9IChiKS5lbmQoKSkKI2RlZmluZSBwYiAgICAgICAgICAgICAgICAgICAgICAgICAgcHVzaF9iYWNrCiNkZWZpbmUgc3ooYSkgICAgICAgICAgICAgICAgICAgICAgICgoaW50KShhLnNpemUoKSkpCiNkZWZpbmUgdmkgdmVjdG9yPGludD4KI2RlZmluZSB2bCB2ZWN0b3I8bG9uZyBsb25nPgojZGVmaW5l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