Go: package main

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

var scanner = bufio.NewScanner(os.Stdin)

const (
	LAST_MONTH = 4280
	BASE = 1150
)

func main() {
	for scanner.Scan() {
		w, _ := strconv.Atoi(scanner.Text())
		if w < 0 {
			break
		}
		s := BASE
		if  10 < w {
			if w <= 20 {
				s+= (w-10)*125
			} else {
				s+= 1250
			}
		}
		if 20 < w {
			if w <= 30 {
				s += (w-20)*140
			} else {
				s += 1400
			}
		}
		if 30 < w {
			s += (w-30)*160
		}
		fmt.Println(LAST_MONTH-s)
	}
}

C++: #include <iostream>
using namespace std;
int main(){
	while(1){
		int w;
		cin>>w;
		if(w==-1) break;
		if(w<=10){
			cout<<4280-1150<<endl;
		}else if(w<=20&&w>=11){
			cout<<4280-1150-125*(w-10)<<endl;
		}else if(w<=30&&w>=21){
			cout<<4280-1150-125*10-140*(w-20)<<endl;
		}else if(w<=40&&w>=31){
			cout<<4280-1150-125*10-140*10-160*(w-10)<<endl;
		}
	}
}

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

int main(void){
	int w;

	while(1){
		cin>>w;
		if(w == -1){
			break;
		}

		int ans = 1150;
		for(int i=11;i<=20 && i<=w;i++){
			ans += 125;
		}
		for(int i=21;i<=30 && i<=w;i++){
			ans += 140;
		}
		for(int i=31;i<=w;i++){
			ans += 160;
		}

		cout<<4280-ans<<endl;
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<algorithm>
#include<complex>
#include<cstdio>
using namespace std ;
typedef vector<int> vi ;
typedef vector<vi> vvi ;
typedef vector<string> vs ;
typedef pair<int, int> pii; 
typedef long long ll ;

#define loop(i,a,b) for(int i = a ; i < b ; i ++)
#define rep(i,a) loop(i,0,a)
#define all(a) (a).begin(),(a).end()

int main(void){
  vi used;
  vector<vector <double> > anum(24,vector<double>(2) );

  vector<vector <double> > fnum(8,vector<double>(2) );
  vector<vector <double> > snum(8,vector<double>(2) );
  vector<vector <double> > tnum(8,vector<double>(2) );
  
  
  rep(i,8){
    cin>>fnum[i][1]>>fnum[i][0];
    anum[i][0]=fnum[i][0];
    anum[i][1]=fnum[i][1];
  }

  
  rep(i,8){
    cin>>snum[i][1]>>snum[i][0];
    anum[i+8][0]=snum[i][0];
    anum[i+8][1]=snum[i][1];
  }
  
  rep(i,8){
    cin>>tnum[i][1]>>tnum[i][0];
    anum[i+16][0]=tnum[i][0];
    anum[i+16][1]=tnum[i][1];
  }
  /*
  rep(i,24){
    cout<<anum[i][0]<<" "<<anum[i][1]<<endl;
  }
  */
  sort(all(fnum));
  sort(all(snum));
  sort(all(tnum));
  sort(all(anum));
  rep(i,2){cout<<fnum[i][1]<< " " << fnum[i][0] <<endl; used.push_back(fnum[i][1]);}  
  rep(i,2){cout<<snum[i][1]<< " " << snum[i][0] <<endl; used.push_back(snum[i][1]);}  
  rep(i,2){cout<<tnum[i][1]<< " " << tnum[i][0] <<endl; used.push_back(tnum[i][1]);}
  int cnt = 0;
  int num = 0;
 
  while(cnt<2){
    bool next = false;
    rep(i,used.size()){
      if(anum[num][1]==used[i]){
	num++;
	next = true;
	break;
      }
    }
    if(next)continue;
    cout<< anum[num][1] <<  " " << anum[num][0] << endl;
    used.push_back(anum[num][1]);
    cnt++;
  }
 
}

C++: #include<iostream>

int w;

int solve(int w){
	int ans = 1150;
	if(w>10)
		ans += 125*(w-10);
	if(w>20)
		ans += 15*(w-20);
	if(w>30)
		ans += 20*(w-30);
	return ans;
}

int main(){
	while(true){
		std::cin >> w;
		if(w==-1)
			return 0;
		std::cout << 4280-solve(w) << std::endl;
	}
}

C++: #include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(void){

	for(;;){
        int w,v;

        cin>>w;


        if(w==-1)break;
        else if(w<=10)v=1150;
        else if(w<=20)v=1150+125*(w-10);
        else if(w<=30)v=2400+140*(w-20);
        else if(w>30)v=3800+160*(w-30);

        cout<<4280-v<<endl;




	}
	return 0;
}

C++: #include<iostream>
 
using namespace std;
 
const int p=4280,a[3]={125,140,160};
 
int main(void){
 
int w;
 
while(true){
cin >> w;
if(w==-1)break;
 
int res=1150;
 
for(int i=0;i<2;i++){
w-=10;
if(w<0)break;
res+=w%11*a[i];
}
if(w>0)res+=w*a[3];
cout << res-p << endl;
}
 
return 0;
}

C++: import java.util.Scanner;
public class P01{

public P01(){
Scanner scan = new Scanner(System.in)
for(int w; scan.hasNextInt() && w >= 0;){
 System.out.println( 4280-getCost(w));
}
}
public int getCost(int w){
 int cost = 1150; // ?¬¬?????????
 for (int i = 11; i <= w; i++ ){
 if ( i <= 20 ) cost += 125; // ?¬¬?????????
 else if ( 30 < i ) cost += 160; // ?¬¬?????????
 else cost += 140; // ?¬¬?????????
 }
 return cost;
}
public static void main(String[] args){
 P01 p01 = new P01();
 }
}

C++: #include <iostream>

using namespace std;

int main(int argc, char **argv)
{
  int w, c;

  while(1){
    cin >> w;
    if(w == -1){
      break;
    }
    c = 1150;

    w -= 10;
    if(w <= 0){
      cout << (4280-c) << endl;
      continue;
    }

    w -= 10;
    if(w <= 0){
      cout << (4280-(c+(w+10)*125)) << endl;
      continue;
    }
    c += 1250;
    w -= 10;
    if(w <= 0){
      cout << (4280-(c+(w+10)*140)) << endl;
      continue;
    }
    c += 1400;

    cout << (4280-(c+160*w)) << endl;
  }

  return 0;
}

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

int main() {

  int c = 4280;
  int a[3] = {125,140,160};
  int b = 1150;
  while(1) {

    int n;
    cin >> n;
    if(n == -1) break;

    b = 1150;
    if(n >=10 )n -= 10;
    else n = 0;
    int i =0;
    while(n >= 10){
      if(i == 3) i--;
      b += a[i]*10;
      n -= 10;
      i++;
      //  cout <<i<<" "<<n <<" "<< b<< endl;
     
    }
    // cout <<i << endl;
    for(int j=0;j<n;j++) b +=a[i];
      
    cout << c - b << endl;
    
  }

  return 0;

}

C++: #include<iostream>
   
using namespace std;
   
const int p=4280,a[3]={125,140,160};
   
int main(void){
   
int w;
   
while(true){
cin >> w;
if(w==-1)break;
   
int res=1150;
   
for(int i=0;i<2;i++){
w-=10;
if(w<0)break;
res+=w%11*a[i];
}
if(w>0)res+=w*a[2];
cout << p-res << endl;
}
   
return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
int fee4(int water) {
	if (water <= 0) return 0;
	return water * 160;
}
int fee3(int water) {
	if (water <= 0) return 0;
	return ((water > 10) ? 10 : water) * 140 + fee4(water - 10);
}
int fee2(int water) {
	if (water <= 0) return 0;
	return ((water > 10) ? 10 : water) * 125 + fee3(water - 10);
}
int fee1(int water) {
	return 1150 + fee2(water - 10);
}
int main() {
	int w;
	std::cin >> w;
	while (w != -1) {
		std::cout << 4280 - fee1(w) << std::endl;
		std::cin >> w;
	}
}

C++: #include <iostream>

using namespace std;

int main() {
  int n;
  while(cin >> n && n != -1) {
    int res = 3130;    
    for(int i=11; i<=n; i++) {
      if(i<=20) res -= 125;
      else if(i<=30) res -= 140;
      else if(i<=40) res -= 160;
    }
    cout << res << endl;
  }
  
  return 0;
}

C++: #include<iostream>
#include<cstdio>

using namespace std;

int main(void){
  int w,costs=4280;
  while(scanf("%d",&w) && w+1){
    costs=4280;
    do{
      if(w<=10){
	w=0;
	costs-=1150;
      }else if(w<=20){
	costs-=(w-10)*125;
	w=10;
      }else if(w<=30){
	costs-=(w-20)*140;
	w=20;
      }else{
	costs-=(w-30)*160;
	w=30;
      }
    }while(w>0);
    cout<<costs<<endl;
  }
  return 0;
}

C++: 
#include<cstdio>

int main(void){
	int p,r;
	scanf("%d",&p);
	while(p!=-1){while(1){
if(p<=20){
r=1150;
if(p>=10)r+=(p-10)*125;
break;
}
if(p<=30){
r=2400;
r+=(p-20)*140;
break;
}
r=3800;
r+=(p-30)*160;
break;
}
	printf("%d\n",4280-r);
	scanf("%d",&p);
}
return 0;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;

int main(){
	int w;
	while(1){
		cin>>w;
		if(w==-1) break;
		int cost=0;
		if(w>30){
			cost += (w-30)*160;
			w = 30;
		}
		if(w<=30 && w>20){
			cost += (w-20)*140;
			w = 20;
		}
		if(w<=20 && w>10){
			cost += (w-10)*125;
			w = 10;
		}
		if(w<=10){
			cost += 1150;
		}
		cout<<4280-cost<<endl;
	}
	return 0;
}