#B3641. Solve a System of Two Linear Equations

    ID: 11300 Type: Default 1000ms 256MiB

Solve a System of Two Linear Equations

Solve a System of Two Linear Equations

You are given a system of two linear equations in the form \( ax+by=c \), where \( a \), \( b \), and \( c \) are integers (they may be negative) and the solution \( (x, y) \) consists of integers. Note that coefficients of 1 or -1 might be omitted (for example, x-y=-1 means \( 1x - 1y = -1 \)).

Your task is to find the unique solution of the given system.

Example:

-2x+3y=4
x-y=-1

The correct solution is \( x=1, y=2 \).

inputFormat

The input consists of two lines. Each line represents a linear equation in the form \( ax+by=c \). The coefficients \( a \), \( b \), and \( c \) are integers and may be negative. Note that if the coefficient is 1 or -1, it might be omitted (for example, x-y=-1 represents \( 1x-1y=-1 \)).

outputFormat

Output two integers \( x \) and \( y \), separated by a space, which are the solutions of the given system.

sample

-2x+3y=4
x-y=-1
1 2