/* IO(1) */

double f( int N, int M)
{
  return 24*N*M + 4*N*N*N + M*N*N*N*N;
}

matrix g( vector N, vector M)
{
  int n = cols(N);
  int m = cols(M);
  double r = zeros(n,m);
  int i, j;

  for( i = 1; i <= n; ++i)
    for( j = 1; j <= m; ++j)
      r(i,j) = f(N(i),M(j));

  return r;
}
