title: get minimum cost to produce unavailable chemical algorithm
body: <p>Lets say I need a chemical which consists 2 substances with ratio of Rx:Ry where GCD(Rx,Ry) = 1, but unfortunately I dont find it in medical shops,</p>
  <p>We have different medicines which consists these substances</p>
  <p>AiX + BiY = Ci where Ai is ratio of substance X, Bi is ratio of substance Y and Ci is cost</p>
  <p>We have list of few medicines</p>
  <p>A0X + B0Y = C0;
  A1X + B1Y = C1;
  .
  .
  .
  AnX + BnY = Cn;</p>
  <p>I can use any item only once and if I use it, I will use whole.
  Now I want to know which all medicines should I use to get the required chemical with minimum cost?</p>
  <p>Thanks in advance.</p>
  <p>I tried something like</p>
  <p><a href="https://i.stack.imgur.com/N76LJ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N76LJ.png" alt="enter image description here" /></a></p>
  <p>with this I am getting the result, but not the minimum cost,</p>
  <p>Can you please suggest me to go in right direction. thanks in advance</p>