function b = rshmat(bot, right, top, left)

n = length(bot);
b = [left(1) + bot(1) bot(2:(n-1)) right(1) + bot(n)];

b = [b; left(2:(n-1))' zeros(n-2) right(2:(n-1))'];

b = [b; left(n) + top(1) top(2:(n-1)) right(n) + top(n)];

b = reshape(b', n*n, 1);

