read H W
tr ' ' '\n'|paste -d' ' <(eval echo {1..$H},{1..$W}|tr ' ,' '\n ') -|awk '$3%2'|awk 'NR%2{x=$1;y=$2}NR%2==0{while(x<$1)print x++,y,x,y;while(x>$1)print x--,y,x,y;while(y<$2)print x,y++,x,y;while(y>$2)print x, y--,x,y}'|awk '{a[NR]=$0}END{print NR;for(i=1;i<=NR;i++)print a[i]}'