/**************************************************
Write a program to compute dot-products of vectors.  If
v = [a1,a2,...,am] and w = [b1,b2,...,bm] are two vectors of
dimension m, the dot product of v and w is
a1*b1 + a2*b2 + ... + am*bm.  Your program will get a
dimension m from the user, read in two vectors of length m,
and print out their dot product.
**************************************************/
#include <iostream>
using namespace std;

int main()
{
  // Get dimension m
  int m;
  cout << "Enter dimension: ";
  cin >> m;

  // Read vector v
  char c;
  int *v = new int[m];
  for(int i = 0; i < m; ++i)
    cin >> c >> v[i];
  cin >> c;

  // Read vector w
  int *w = new int[m];
  for(int i = 0; i < m; ++i)
    cin >> c >> w[i];
  cin >> c;

  // Compute dot product
  int dp = 0;
  for(int i = 0; i < m; ++i)
    dp = dp + v[i]*w[i];

  // Print result
  cout << "Dot product = " << dp << endl;

  return 0;
}