Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

const qA, qB, qC = 200, 300, 500
const pA, pB, pC = 380, 550, 850
const dA, dB, dC = 5, 4, 3

func main() {
	stdin := bufio.NewScanner(os.Stdin)
	for stdin.Scan() {
		q, _ := strconv.Atoi(stdin.Text())
		if q == 0 {
			break
		}

		// A 0袋から始める
		curPrice, newPrice := 0, 0
		// B
		for a := 0; a <= int(q/qA); a++ {
			for b := 0; b <= int((q-qA*a)/qB); b++ {
				// 残り
				rem := q - qA*a - qB*b
				if rem == 0 || ((rem > 0) && ((rem % qC) == 0)) {
					// ちょうど買える
					newPrice = amount(a, b, int(rem/qC))
					if curPrice == 0 || newPrice < curPrice {
						// println(a, b, int(rem/qC), newPrice)
						curPrice = newPrice
					}
				}
			}
		}
		fmt.Println(curPrice)
	}
}

func amount(a, b, c int) int {
	tA := int(float64(int(a/dA)*dA*pA)*0.8) + (a%dA)*pA
	tB := int(float64(int(b/dB)*dB*pB)*0.85) + (b%dB)*pB
	tC := int(float64(int(c/dC)*dC*pC)*0.88) + (c%dC)*pC
	// println("amount:", a, b, c, tA, tB, tC, tA+tB+tC)
	return tA + tB + tC
}

C++: #include<stdio.h>
#include<iostream>
#include<string>
#include<algorithm>
#include <vector>
#include<math.h>
#include<iomanip>
#include<set>


using namespace std;

int main(){

	int x[500]={};
	x[1]=380;
	x[2]=380;
	for(int i=1;i<60;i++){
		x[i+2]=x[i]+380;
	}
	
	
	
	x[3]=550;x[5]=850;
	int RR=380*5*0.8;
	x[10]=RR;
	RR=550*4*0.85;
	x[12]=RR;
	RR=850*3*0.88;
	x[15]=RR;
	for(int i=2;i<60;i++){
		if(x[i+2]>x[i]+380)x[i+2]=x[i]+380;
		if(x[i+3]>x[i]+550)x[i+3]=x[i]+550;
		if(x[i+5]>x[i]+850)x[i+5]=x[i]+850;

		int R=380*5*0.8;
		if(x[i+10]>x[i]+R)x[i+10]=x[i]+R;
		R=550*4*0.85;
		if(x[i+12]>x[i]+R)x[i+12]=x[i]+R;
		R=850*3*0.88;
		if(x[i+15]>x[i]+R)x[i+15]=x[i]+R;
	}

	


	int n;
	double S=0;
	while(1){
		S=0;
		cin>>n;if(!n)return 0;
		/*
		while(n>0){
			if(n>=1500){
				n-=1500;S+=850*3*0.88;
			}
			else if(n>=1200){
				n-=1200;S+=550*4*0.85;
			}
			else if(n>=1000){
				n-=1000;S+=380*5*0.8;
			}
			else if(n>=500){
				n-=500;S+=850;
			}
			else if(n>=400){
				n-=400;S+=380;
			}
			else if(n>=300){
				n-=300;S+=550;
			}
			else {
				n-=200;S+=380;
			}
			cout<<n;
		}
		*/
		n/=100;
		cout<<x[n]<<endl;
	}
	return 0;
}

C++: #include <iostream>

using namespace std;

int soba[][2] = {
	{200, 380},
	{300, 550},
	{500, 850}
};

int main() {
	int n, m = 5000 * 500;
	cin >> n;
	if (n == 0){
		return 0;
	}
	for (int i = n / soba[2][0] + 100; i >= 0; i--) {
		for (int j = n / soba[1][0] + 100; j >= 0; j--) {
			for (int k = n / soba[0][0] + 100; k >= 0; k--) {
				int w = i * soba[2][0] + j * soba[1][0] + k * soba[0][0];
				if (w >= n) {
					int p = (i / 3 * 3 * soba[2][1] * 0.88) + (i % 3 * soba[2][1]) + (j / 4 * 4 * soba[1][1] * 0.85) + (j % 4 * soba[1][1]) + (k / 5 * 5 * soba[0][1] * 0.8) + (k % 5 * soba[0][1]);
					if (p < m) {
						m = p;
					}
				}
			}
		}
	}
	cout << m << endl;
	return main();
}

C++: #include<iostream>
#include<vector>
using namespace std;

struct SobaDisc {
  int gram;   //< ???
  int price;  //< ??????
};

vector<int> memo(5000+1, 1 << 20);

SobaDisc ShopInfo[6]{
  { 200, 380 },
  { 300, 550 },
  { 500, 850 },
  { 1000,1520 },
  { 1200,1870 },
  { 1500,2244 },
};

inline int min(int a, int b) { return a < b ? a : b; }

// ?????\??????????????????
void MinMoney() {
  for (int i = 0; i < 6; i++) {
    int gram  = ShopInfo[i].gram;
    int price = ShopInfo[i].price;
    memo[0] = 0;
    for (int j = 0; j + gram <= 5000; j+=100) {
      memo[j + gram] = min(memo[j + gram], memo[j] + price);
    }
  }
}

int main() {
  MinMoney();

  int input_gram;
  while (cin >> input_gram, input_gram != 0) {
    cout << memo[input_gram] << endl;
  }
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#include<iostream>
#include<string>
using namespace std;
#define INF (1<<29)
int N;
bool ok(int a,int b,int c){
  if(a*200+b*300+c*500>=N) return true;
  return false;
}
int calc(int a,int b,int c){
  return a*380-(a/5)*380 + b*550-(b/4)*330 + c*850-(c/3)*306;
}
int main(){
  while(scanf("%d",&N),N){
    int res = INF;
    for(int a=0;a<251;a++){
      for(int b=0;b<200;b++){
	for(int c=0;c<101;c++){
	  if(ok(a,b,c))
	    res = min(res,calc(a,b,c));
	}
      }
    }
    printf("%d\n",res);
  }
}

C++: #include <stdio.h>

int main() {
  int n;
  while (scanf("%d", &n) != EOF) {
    int ans = 1000000;
    for (int a = 0; a <= 50; a++) {
      for (int b = 0; b <= 50; b++) {
        for (int c = 0; c <= 50; c++) {
          int sum = (380 * a * 0.8) + (a % 5) * 380;
          sum += (550 * b * 0.85) + (b % 4) * 550;
          sum += (850 * c * 0.88) + (c % 3) * 850;
          if (a * 200 + b * 300 + c * 500 == n) {
            if (sum < ans)
              ans = sum;
          }
        }
      }
    }
    printf("%d\n", ans);
  }
  return 0;
}

C++: #include <iostream>
#include<string>
using namespace std;

int main(){
    int n;
    while(1){
        int num=0;
        int sum=0;
        int res=99999;;
        cin>>n;
        if(n==0)break;
        for(int a=0; a<5; a++) {
            for(int b=0; b<4; b++){
                for(int c=0; c<3; c++){
                    for(int d=0; d<6; d++){
                        for(int e=0; e<5; e++){
                            for(int f=0; f<4; f++){
                                num=a*200+b*380+c*500+d*1000+e*1200+f*1500;
                                sum=a*380+b*550+c*850+d*1520+e*1870+f*2244;
                                if(num==n&&sum<res){
                                    res=sum;
                                }
                            }
                        }
                    }
                }
            }
        }
        cout<<res<<endl;
    }
    return 0;
}

C++: #include <iostream>

using namespace std;

int main(int argc, char *argv[]) {
  int n, price[51];
  for (int i = 0; i < 51; i++)
    price[i] = -1;
  price[15] = 2244;
  price[12] = 1870;
  price[10] = 1520;
  price[5] = 850;
  price[3] = 550;
  price[2] = 380;
  for (int i = 0; i < 51; i++) {
    for (int j = 0; j < i; j++) {
      if (j + 15 == i && price[j] > 0) {
        if ((price[i] < 0 ) ||
            (price[i] > 0 && price[j] + 2244 < price[i])) {
          price[i] = price[j] + 2244;
        }
      } else if (j + 12 == i && price[j] > 0) {
        if ((price[i] < 0) ||
            (price[i] > 0 && price[j] + 1870 < price[i])) {
          price[i] = price[j] + 1870;
        }
      } else if (j + 10 == i && price[j] > 0) {
        if ((price[i] < 0) ||
            (price[i] > 0 && price[j] + 1520 < price[i])) {
          price[i] = price[j] + 1520;
        }
      } else if (j + 5 == i && price[j] > 0) {
        if ((price[i] < 0) ||
            (price[i] > 0 && price[j] + 850 < price[i])) {
          price[i] = price[j] + 850;
        }
      } else if (j + 3 == i && price[j] > 0) {
        if ((price[i] < 0) ||
            (price[i] > 0 && price[j] + 550 < price[i])) {
          price[i] = price[j] + 550;
        }
      } else if (j + 2 == i && price[j] > 0) {
        if ((price[i] < 0) ||
            (price[i] > 0 && price[j] + 380 < price[i])) {
          price[i] = price[j] + 380;
        }
      }
    }
  }
  /*                                                                                                                                                                                                        
  for (int i = 0; i < 51; i++)                                                                                                                                                                              
    cout << i*100 << " : " << price[i] << endl;                                                                                                                                                             
  */
  while (true) {
    cin >> n;
    if (n == 0)
      break;
    cout << price[n/100] << endl;
  }
  return 0;
}