#include<iostream>
#include<fstream>
using namespace std;

int main()
{    
    fstream inFile,outFile;
    inFile.open("DATA1.txt",ios::in);
    outFile.open("OUT1.txt",ios::out|ios::trunc);
    //-------------
    int loop=5;
    int xi,yi,x,y;
    char c[2][2];
    
    while (loop--)
    {
          inFile>>c[0];
          inFile>>c[1];
          xi = atoi(c[0]);
          yi = atoi(c[1]);
          x = 50; 
          y = 25;
          
          bool b = true;
          
          while (b){
                x=x+xi;
                y=y+yi;
                if ((x>=100) || (x<=0)) {b=false;}
                if ((y>=50) || (y<=0)) {b=false;}
          }
                
          outFile<<x<<","<<y<<endl;
          
    }
    //-------------
    inFile.close();
    outFile.close();
    return 0;
}

