function s = add(x, y, z)

if nargin < 2
   error('At least two input arguments are required.')
end

if nargin == 2
   s = x + y;
else
   s = x + y + z;
end
