#include <iostream>
#include <vector>

using namespace std;

int main() {
  unsigned int m, n;
  cout << "m, n: "; cin >> m >> n;

  vector<double> b(n);
  cout << "b: ";
  for (vector<double>::iterator i = b.begin();
    i != b.end();
    ++i)
    cin >> *i;

  vector<vector<double>> a(m, vector<double>(n));
  for (unsigned int i = 0; i < m; i++) {
    cout << "a[" << i << "][...]: ";
    for (unsigned int j = 0; j < n; j++)
      cin >> a[i][j];
  }

  vector<double> c(m);
  vector<double>::iterator cpos = c.begin();

  for (vector<vector<double>>::iterator apos_i = a.begin();
    apos_i != a.end();
    apos_i++, cpos++) {
    vector<double>::iterator bpos = b.begin();
    for (vector<double>::iterator apos_j = (*apos_i).begin();
      apos_j != (*apos_i).end();
      apos_j++, bpos++)
      *cpos += *apos_j * *bpos;
  }

  cout << "a*b: ";
  for (cpos = c.begin(); cpos != c.end(); cpos++)
    cout << *cpos << " ";
  return 0;
}
