#include<iostream>
#include<string>
#include<string.h>
#include<algorithm>
#include<stdio.h>
#include<cmath>
#include<vector>
#include<utility>
#include<stack>
#include<queue>

#define FOR(i, a, b) for(int i=(a);i<=(b);i++)
#define RFOR(i, a, b) for(int i=(a);i>=(b);i--)
#define MOD 1000000007

using namespace std;

int main(void) {
	int total = 0;
	int n;
	int t;
	
	while (cin >> n) {
		total = 0;
		t = 600 - n;
		while (t>0) {
			total += t*t*n;
			t -= n;
		}
		cout << total << endl;
	}
	
	return 0;
}
#include <iostream>
#include <iomanip>
using namespace std;
#define REP(i,k,n) for(int i=k;i<n;i++)
#define rep(i,j) for(int i=0;i<j;i++)

bool has3(int p){
	while(p){
		if(p % 10 == 3) return true;
		p /= 10;
	}
	return false;
}

void call(int n){
	REP(i,1,n + 1){
		if(i % 3 == 0 || has3(i))
			cout << " " << i;
	}
}

int main(void){
	int a;
	cin >> a;
	call(a);
	cout << endl;
}