{ NOTE: it is recommended to use this even if you don't understand the following code }

var
    T, Bs, Bx, By, Ds, Dx, Dy : LongInt;
    dir                       : Char;

begin
{
    uncomment the two following lines if you want to read/write from files
    assign(input,  'input.txt');  reset(input);
    assign(output, 'output.txt'); rewrite(output);
}

    ReadLn(Dx, Dy, Ds);

    ReadLn(Bx, By, Bs);

    ReadLn(dir);

    T := 0;

    { INSERT YOUR CODE HERE }


    WriteLn(T);

end.
