# The Smoker Beggar Hackerearth coderinme

##### The Smoker Beggar

As they say,beggars can’t be choosers,in fact beggar take what they can get.
A beggar on the street can make one cigarette out of every 6 cigarette butts he finds. After one whole day of searching and checking public ashtrays the beggar finds a total of n cigarette butts.
You have to find the number of cigarettes he can make and smoke from the butts he found.

Constraints
1 ≤ T ≤ 100
1 ≤ n ≤ 10^13

Input
The first line contains T — the number of test cases.
Each test case contains a number n-the number of cigarette butts he found.

Output
Print the number of cigarettes the begger smoke.

```#include <iostream>
using namespace std;

int main()
{
//cout << "Hello World!" << endl;
int a,b,sum=0,n,i=1;
cin>>n;
while(n--) {
sum=0;
cin>>a;
while(a>=6) {
b=a%6;
a=a/6;
sum+=a;
a+=b;

}
cout<<"Case "<<i++<<": "<<sum<<endl;
}
return 0;
}```

### hasectic

A web developer(Front end and Back end), and DBA at csdamu.com. Currently working as Salesforce Developer @ Tech Matrix IT Consulting Private Limited. Check me @about.me/s.saifi