using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Numerics; using System.Text; using static System.Console; using static System.Convert; using static System.Math; using static Extentions; class IO { int idx; string[] input = In.ReadToEnd().Split(new[] { " ", "\n", "\r" }, StringSplitOptions.RemoveEmptyEntries); T Get(Func parser) => parser(input[idx++]); public string S => Get(s => s); public char C => Get(char.Parse); public int I => Get(int.Parse); public long L => Get(long.Parse); public double F => Get(double.Parse); public decimal D => Get(decimal.Parse); public BigInteger B => Get(BigInteger.Parse); T[] Gets(int n, Func parser) => input.Skip((idx += n) - n).Take(n).Select(parser).ToArray(); public string[] Ss(int n) => Gets(n, s => s); public char[] Cs(int n) => Gets(n, char.Parse); public int[] Is(int n) => Gets(n, int.Parse); public long[] Ls(int n) => Gets(n, long.Parse); public double[] Fs(int n) => Gets(n, double.Parse); public decimal[] Ds(int n) => Gets(n, decimal.Parse); public BigInteger[] Bs(int n) => Gets(n, BigInteger.Parse); public void Write(params T[] xs) => WriteLine(string.Join(" ", xs)); public void Write(params object[] xs) => WriteLine(string.Join(" ", xs)); } interface IInteger { T MinusOne { get; } T One { get; } T Zero { get; } T Add(T left, T right); int Compare(T left, T right); T Divide(T dividend, T divisor); T Multiply(T left, T right); T Negate(T value); T Remainder(T dividend, T divisor); T Subtract(T left, T right); } static class Integer { static IInteger i = new IntOperations(); static IInteger l = new LongOperations(); static IInteger bi = new BigIntegerOperations(); public static IInteger Default { get { if (typeof(T) == typeof(int)) return (IInteger)i; else if (typeof(T) == typeof(long)) return (IInteger)l; else if (typeof(T) == typeof(BigInteger)) return (IInteger)bi; else throw new NotSupportedException(); } } } class IntOperations : IInteger { public int MinusOne => -1; public int One => 1; public int Zero => 0; public int Add(int left, int right) => checked(left + right); public int Compare(int left, int right) => left.CompareTo(right); public int Divide(int dividend, int divisor) => dividend / divisor; public int Multiply(int left, int right) => checked(left * right); public int Negate(int value) => checked(-value); public int Remainder(int dividend, int divisor) => dividend % divisor; public int Subtract(int left, int right) => checked(left - right); } class LongOperations : IInteger { public long MinusOne => -1; public long One => 1; public long Zero => 0; public long Add(long left, long right) => checked(left + right); public int Compare(long left, long right) => left.CompareTo(right); public long Divide(long dividend, long divisor) => dividend / divisor; public long Multiply(long left, long right) => checked(left * right); public long Negate(long value) => checked(-value); public long Remainder(long dividend, long divisor) => dividend % divisor; public long Subtract(long left, long right) => checked(left - right); } class BigIntegerOperations : IInteger { public BigInteger MinusOne => BigInteger.MinusOne; public BigInteger One => BigInteger.One; public BigInteger Zero => BigInteger.Zero; public BigInteger Add(BigInteger left, BigInteger right) => BigInteger.Add(left, right); public int Compare(BigInteger left, BigInteger right) => BigInteger.Compare(left, right); public BigInteger Divide(BigInteger dividend, BigInteger divisor) => BigInteger.Divide(dividend, divisor); public BigInteger Multiply(BigInteger left, BigInteger right) => BigInteger.Multiply(left, right); public BigInteger Negate(BigInteger value) => BigInteger.Negate(value); public BigInteger Remainder(BigInteger dividend, BigInteger divisor) => BigInteger.Remainder(dividend, divisor); public BigInteger Subtract(BigInteger left, BigInteger right) => BigInteger.Subtract(left, right); } struct Rational : IComparable>, IEquatable> { T numer; T denom; public T Numer { get { this.Reduce(); return numer; } } public T Denom { get { this.Reduce(); return denom; } } IInteger i; public int Sign => i.Compare(numer, i.Zero) * i.Compare(denom, i.Zero); public Rational(T numer, T denom) { this.numer = numer; this.denom = denom; i = Integer.Default; } void Reduce() { if (i.Compare(numer, i.Zero) == 0) { denom = i.One; return; } var d = Gcd(numer, denom, i); numer = i.Divide(numer, d); denom = i.Divide(denom, d); if (i.Compare(denom, i.Zero) < 0) { numer = i.Negate(numer); denom = i.Negate(denom); } } public Rational Invert() => new Rational(denom, numer); public static Rational operator -(Rational r) => new Rational(r.i.Negate(r.numer), r.denom); public static Rational operator +(Rational left, Rational right) { var i = left.i; left.Reduce(); right.Reduce(); var d = Lcm(left.denom, right.denom, i); var n = i.Add(i.Divide(i.Multiply(left.numer, d), left.denom), i.Divide(i.Multiply(right.numer, d), right.denom)); return new Rational(n, d); } public static Rational operator *(Rational left, Rational right) { var i = left.i; left.Reduce(); right.Reduce(); var n = i.Multiply(left.numer, right.numer); var d = i.Multiply(left.denom, right.denom); return new Rational(n, d); } public static Rational operator -(Rational left, Rational right) => left + -right; public static Rational operator /(Rational left, Rational right) => left * right.Invert(); public static bool operator ==(Rational left, Rational right) => left.Equals(right); public static bool operator !=(Rational left, Rational right) => !left.Equals(right); public static bool operator <(Rational left, Rational right) => left.CompareTo(right) < 0; public static bool operator >(Rational left, Rational right) => left.CompareTo(right) > 0; public static bool operator <=(Rational left, Rational right) => left.CompareTo(right) <= 0; public static bool operator >=(Rational left, Rational right) => left.CompareTo(right) >= 0; public static implicit operator Rational(T x) => new Rational(x, Integer.Default.One); public int CompareTo(Rational other) => (this - other).Sign; public bool Equals(Rational other) { var r = this / other; return r.i.Compare(r.numer, r.denom) == 0; } public override bool Equals(object obj) { if (!(obj is Rational)) return false; var r = (Rational)obj / this; return r.i.Compare(r.numer, r.denom) == 0; } public override int GetHashCode() => this.Numer.GetHashCode() ^ this.Denom.GetHashCode(); public override string ToString() => $"{this.Numer}/{this.Denom}"; } static partial class Extentions { public static T Gcd(T x, T y, IInteger integer) { T r; while (integer.Compare((r = integer.Remainder(x, y)), integer.Zero) != 0) { x = y; y = r; } return y; } public static T Lcm(T x, T y, IInteger integer) => integer.Multiply(integer.Divide(x, Gcd(x, y, integer)), y); } static class Program { public static void Main() { var sw = new StreamWriter(OpenStandardOutput()) { NewLine = "\n" }; #if DEBUG sw.AutoFlush = true; #else sw.AutoFlush = false; #endif SetOut(sw); Solve(new IO()); Out.Flush(); } static void Solve(IO io) { var b = io.Bs(3); var d = new Rational(b[0] * b[2] - b[1] * b[1], b[0] - b[1]); var r = b[0] != 0 ? -(d - b[1]) / b[0] : -(d - b[2]) / b[1]; io.Write((r * b[2] + d).Numer); } }