#include<iostream> #include <algorithm> using namespace std; bool cmp(int a,int b) { return a<b; } int main() { int key[3000]={0}; int key1[3000]={0}; int key2[3000]={0}; int n=0; int m=0; int p=0; while(cin>>m&&m!=0) { p++; int j=0; int x=0,y=0,z=0; int w=m/7; int s=m/5; if(m-m/5*5!=0) s++; for(x=1;x<s;x++) if(x>w) key[j++]=x; cout<<"Case "<<p<<":"<<endl; cout<<m<<" pencils for "<<m<<" cents"<<endl; if(j==0) cout<<"No solution found."<<endl; else{ sort(key,key+j,cmp); for(int k=0;k<j;k++){ cout<<key[k]<<" at four cents each"<<endl; cout<<m-key[k]-14*key[k]+2*m<<" at two for a penny"<<endl; cout<<14*key[k]-2*m<<" at four for a penny"<<endl; if(k!=j-1) cout<<endl; } } for(int v=0;v<3000;v++) { key[v]=0; key1[v]=0; key2[v]=0; } cout<<endl; } return 0; }