title: How can I find the mistake in the below code?
body: <p><strong>PROBLEM DESCRIPTION:</strong> Sanjay has <code>m</code> rupees, each chocolate costs <code>c</code> rupees, the shopkeeper will give away <code>k</code> chocolates for <code>w</code> wrappers. Can you find now how many chocolates Sanjay will be able to eat?</p>
  
  <p><strong>INPUT:</strong> 4 integers separated by space in order <code>m</code>, <code>c</code>, <code>w</code>, <code>k</code> by condition</p>
  
  <ul>
  <li><code>c,w &gt; 0</code></li>
  <li><code>m, k &gt;= 0</code></li>
  <li><code>k &lt; w</code></li>
  </ul>
  
  <p><strong>OUTPUT:</strong> An integer denoting the number of chocolates Sanjay will be able to get.</p>
  
  <hr>
  
  <p><strong>Sample 1</strong></p>
  
  <p><strong>INPUT:</strong> 15, 2, 3, 1</p>
  
  <p><strong>OUTPUT:</strong> 10</p>
  
  <p><strong>EXPLANATION:</strong> </p>
  
  <ul>
  <li>Sanjay has 15 rupees, buys 7 chocolates for 2 rupees each. </li>
  <li>Sanjay now has 7 wrappers, exchanges 6 of them for 2 more chocolates. </li>
  <li>Sanjay now has 3 wrappers and exchanges them for 1 more chocolate making a total of 10 chocolates</li>
  </ul>
  
  <hr>
  
  <p><strong>Sample 2</strong> </p>
  
  <p><strong>INPUT:</strong> 15, 2, 3, 2</p>
  
  <p><strong>OUTPUT:</strong> 17</p>
  
  <p><strong>EXPLANATION:</strong></p>
  
  <ul>
  <li>Sanjay has 15 rupees, buys 7 chocolates for 2 rupees each.</li>
  <li>Sanjay now has 7 wrappers, exchanges 6 of them for 4 more chocolates.</li>
  <li>Sanjay now has 5 wrappers and exchanges 3 of them for 2 more chocolates.</li>
  <li>Sanjay now has 4 wrappers and exchanges 3 of them for 2 more chocolates.</li>
  <li>Sanjay now has 3 wrappers and exchanges them for 2 chocolates making a total of 17 chocolates.</li>
  </ul>
  
  <hr>
  
  <p>I tried the below code but getting the wrong answer.</p>
  
  <pre class="lang-py prettyprint-override"><code>    n = input()
      i = n.split(',')
      m = int(i[0])
      c = int(i[1])
      w = m//c
      choc = m//c
  
      while(w//3!=0):
          choc = choc + (w//3)
          w = (w//3) + (w%3)
      print(choc)
  </code></pre>
  
  <p>What am I doing wrong in the code?</p>