#include <stdlib.h>
#include <iostream>
#include <istream> 
#include <fstream> 

using std::cin; 
using std::cout;
using std::endl;
using std::ifstream;
using std::ofstream;
using std::cerr;
using std::ios;

int main(int argc, char* argv[]) 
{
  std::string inFile, outFile;

  inFile = argv[1];
  outFile = argv[2];

  double scale = 1.0;
  if (argc > 3) 
    {
      //cout << argv[3] << endl;
      scale = atoi(argv[3]);
    }


  //cout << "filename" << endl;
  //cin >> inFile;

  //cout << "outfile" << endl;
  //cin >> outFile;

  
  cout << " infile = " << inFile << ", outfile = " << outFile << endl;

  ifstream is(inFile.c_str(), ios::in);
  ofstream os(outFile.c_str(), ios::out);

  os.width(18);
  os.precision(10);
  os.setf(ios::showpoint);
  os.setf(ios::scientific);

  if (is.fail())
    {
      cerr << "Cannot open input file";
      return 1;
    }
  
  double initVal;
  double time;
  double val;
  double diff;

  bool initValSet = false;
  bool done = false;
  is >> time;
  is >> val;
  if (!initValSet)
    {
      initVal = val;
      initValSet = true;
    }
  
  diff = val - initVal;
  
  os << time << "  " <<  diff << endl;

  while (is.good())
    {
      while (is.get() != '\n');
      is >> time;
      is >> val;

      diff = val - initVal;
       
      os << time << "  " <<  diff << endl;

      
    }

}
