jiahuimbzuai/CoQuIR huggingface dataset:
//  [rust]
use std::io::*;
use std::str::FromStr;

pub fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

use std::cmp::min;

fn main() {
    let a: usize = read();
    let b: usize = read();
    let c: usize = read();
    if a == b {
        println!("{}", c);
    }
    if c == b {
        println!("{}", a);
    }
    if a == c {
        println!("{}", b);
    }
}
//  [swift]
import Glibc
extension String: CollectionType {}

var abc = readLine()!.split(" ").map { Int($0)! }
if abc[0] == abc[1] {
  print(abc[2])
} else if abc[1] == abc[2] {
  print(abc[0])
} else {
  print(abc[1])
}
//  [swift]
var i=readLine()!.characters.split(" ").map{Int(String($0))!},a=i[0];if i[0]==i[1]{a=i[2]};if i[0]==i[2]{a=i[1]};print(a)
//  [swift]
import Foundation

let line = readLine()!
let comps = line.componentsSeparatedByString(" ")
var dic = [String:Int]()
comps.forEach({ dic[$0] = (dic[$0] ?? 0) + 1 })
print(dic.filter({ $0.1 == 1 }).first!.0)
//  [swift]
var i=readLine()!.characters.split(" ").map{Int(String($0))!},a=i[0];if i[0]==i[1]{a=i[1]};if i[0]==i[2]{a=i[1]};print(a)
//  [typescript]
import * as fs from 'fs';

namespace AtCoder {
    export interface Paramable {
        readonly args: string[][];
    }

    export interface Task {
        main(this: Task): void;
    }
}

namespace AtCoder.abc001 {
    export class TaskA implements AtCoder.Task, AtCoder.Paramable {
        public constructor(public readonly args: string[][]) {
        }

        public main(this: TaskA): void {
            const abc: number[] = this.args[0].map(Number);

            abc.sort();

            if (abc[0]===abc[1]) {
                console.log(abc[2]);
            } else{
                console.log(abc[0]);
            }
        }
    }

    const args: string[][] = fs.readFileSync('/dev/stdin', 'utf8').trim().split('\n').map(r => r.split(' '));
    const task: AtCoder.Task = new TaskA(args);
    task.main();
}
//  [typescript]
const t={input:require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/),n:(arg:number=0):any=>{if(arg){const a:number[]=[];for(let i=0;i<arg;i++) {a.push(t.n());}return a;}else{const a = t.input[0];t.input.shift();return Number(a);}},s:(arg:number=0):any=>{if(arg){const a:string[]=[];for(let i=0;i<arg;i++){a.push(t.s());}return a;}else{const a=t.input[0];t.input.shift();return String(a);}},c:(arg:number=0):any=>{if(arg) {const a:string[]=[];for(let i=0;i<arg;i++) {a.push(t.c());}return a;}else{let a=t.input[0].split('');const b=a[0];a.shift();if(a.length>0){t.input[0]=a.join('');}else{t.input.shift();}return String(b);}},o: (...arg)=>{console.log(...arg);},abs:(a)=>{return Math.abs(a);},min:(...a)=>{return Math.min(...a);},max:(...a)=>{return Math.max(...a);},floor:(a)=>{return Math.floor(a);},asc:(ar:number[])=>{return ar.sort((a,b)=>{return a-b});},desc:(ar:number[])=>{ return ar.sort((a,b)=>{return b-a});},sw:(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length;i+=2){if(eval(a+op+arr[i]))return arr[i+1]}return arr[arr.length-1];}}
const main = ()=>{
  let [a,b,c] = t.n(3)
  t.o(a==b?c:a==c?b:a)
}
main()
//  [typescript]
"use strict";

main(require("fs").readFileSync("/dev/stdin", "utf8"));

function main(input) {
  const [a, b, c] = input.trim().split(" ").map(Number);

  const ans = a === b ? c : a === c ? b : a;
  console.log(ans);
}
//  [typescript]
const main = (input) => {
  input = input.split(' ');
  const A = parseInt(input[0], 10);
  const B = parseInt(input[1], 10);
  const C = parseInt(input[2], 10);
  
  if (A==B&&A!==C){
    console.log(C);
  }else if(A==C||A!=B) {
    console.log(B);
  }else{
    console.log(A);
  }
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [typescript]
const main = (input) => {
  input = input.split(' ');
  const A = parseInt(input[0], 10);
  const B = parseInt(input[1], 10);
  const C = parseInt(input[2], 10);
  
  if (A==B!==C){
    console.log(C);
  }else if(A==C!== B) {
    console.log(B);
  }else{
    console.log(A);
  }
  
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
//  [python]
r0,g0,b0,n=map(int,input().split())
ans=0
l=[r0,g0,b0]
l.sort(reverse=True)
r=l[0]
g=l[1]
b=l[2]
x=0
while x*r<=n:
    y=0
    if g==1:
        ans+=1+n-x*r
        x+=1
        continue
    if b==1:
        ans+=1+(n-x*r)//g
        x+=1
        continue
    while y*g<=n-x*r:
        if (n-x*r-y*g) % b == 0:
            ans+=1
        y+=1
    x+=1
print(ans)
//  [python]
r,g,b,n = map(int,input().split())
a = [0]*(n+1)
a[0] = 1
for j in range(n+1-r):
    a[j+r]=a[j]
for j in range(n+1-b):
    a[j+b]+=a[j]
for j in range(n+1-g):
    a[j+g]+=a[j]
    #print(a)
print(a[n])
//  [python]
r, g, b, n = map(int, input().split())

dp = [0 for i in range(n+1)]
dp[0] = 1

for i in range(r, n+1, r):
    dp[i] = 1

for i in range(g, n+1):
    dp[i] += dp[i-g]

for i in range(b, n+1):
    dp[i] += dp[i-b]

print(dp[n])
//  [python]
R, G, B, n = map(int, input().split())
cnt = 0
for r in range(n+1):
    for g in range(n+1):
        bb = n - r*R - g*G
        if bb >= 0 and bb%B == 0:
            cnt += 1
print(cnt)
//  [python]
r,g,b,n=map(int,input().split())
cnt=0
for i in range(n+1):
    for j in range(n+1):
        if (n-i*r-j*g) %b ==0 and 0<=(n-i*r-j*g) // b <= 3000:
            # print(i,j,(n-i*r-j*g)//3)
            cnt+=1
print(cnt)
//  [python]
r,g,b,n=map(int,input().split())
cnt=0
for i in range(int(n//r)+1):
    for j in range(int(n//g)+1):
        if (n-i*r-j*g) %b ==0 and 0<=(n-i*r-j*g) // b <= 3000:
            # print(i,j,(n-i*r-j*g)//3)
            cnt+=1
print(cnt)
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
	public static void main(String[] args) {
		FastScanner sc = new FastScanner(System.in);
		int[] a = new int[3];
		a[0] = sc.nextInt();
		a[1] = sc.nextInt();
		a[2] = sc.nextInt();
		int n = sc.nextInt();
		Arrays.sort(a);
		long ans = 0;
		int m = n/a[2];
		for(int i = m; m >= 0; m--) {
			int x = n - m*a[2];
			int y = x/a[1];
			for(int j = y; j >= 0; j--) {
				if((x - y*a[1])%a[0] == 0) {
					ans++;
				}
			}
		}
		System.out.println(ans);
	}

	static class FastScanner {
		private BufferedReader reader = null;
	    private StringTokenizer tokenizer = null;
	    public FastScanner(InputStream in) {
	        reader = new BufferedReader(new InputStreamReader(in));
	        tokenizer = null;
	    }

	    public String next() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                tokenizer = new StringTokenizer(reader.readLine());
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }
	        return tokenizer.nextToken();
	    }

	    public String nextLine() {
	        if (tokenizer == null || !tokenizer.hasMoreTokens()) {
	            try {
	                return reader.readLine();
	            } catch (IOException e) {
	                throw new RuntimeException(e);
	            }
	        }

	        return tokenizer.nextToken("\n");
	    }

	    public long nextLong() {
	        return Long.parseLong(next());
	    }

	    public int nextInt() {
	        return Integer.parseInt(next());
	    }

	    public double nextDouble() {
	         return Double.parseDouble(next());
	     }

	    public int[] nextIntArray(int n) {
	        int[] a = new int[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextInt();
	        return a;
	    }

	    public long[] nextLongArray(int n) {
	        long[] a = new long[n];
	        for (int i = 0; i < n; i++)
	            a[i] = nextLong();
	        return a;
	    }
	}
}
//  [java]
import java.util.*;

class Main{
  
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();
    int g = sc.nextInt();
    int b = sc.nextInt();
    int n = sc.nextInt();
    int ans = 0;
    
    for(int i = 0; i <= n; i++){
	  for(int j = 0; j <= n; j++){
        for(int k = 0; k <= n; k++){
          if(r * i + g * j + b * k == n) ans++;
        }
      }
    }
    
    System.out.println(ans);
    
  }
  
}
//  [java]
import java.util.*;

class Main{
  
  public static void main(String[] args){
    
    Scanner sc = new Scanner(System.in);
    int r = sc.nextInt();
    int g = sc.nextInt();
    int b = sc.nextInt();
    int n = sc.nextInt();
    int ans = 0;
    
    for(int i = 0; i <= n; i++){
	  for(int j = 0; j <= n; j++){
        if((n - r * i - g * j) % b == 0) ans++;
      }
    }
    
    System.out.println(ans);
    
  }
  
}
//  [cpp]
#include <iostream>
#define MAXN 3000
using namespace std;

int R, G, B, N;
long long int num[MAXN+5];

int main() {
  cin >> R >> G >> B >> N;
  num[0] = 1;
  for (int i = R; i <= N; i++) {
    num[i] += num[i-R];
  }
  for (int i = G; i <= N; i++) {
    num[i] += num[i-G];
  }
  for (int i = B; i <= N; i++) {
    num[i] += num[i-B];
  }
  cout << num[N] << endl;
}
//  [cpp]
#include<bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define yesno(flg) if(flg){cout<<"YES"<<endl;}else{cout<<"NO"<<endl;}
#define MAX_N 1002
#define i197 1000000007

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P1;
typedef pair<int,int> Pi;
typedef pair<double,Pi> Pdi;
typedef pair<ll,int>Pli;
typedef pair<P1,ll> P2;
const ll INF=100000000000000001;
struct edge{int to,cost;};
int dy[]={0, 0, 1, -1};
int dx[]={1, -1, 0, 0};
struct Road{double cost;int a,b;};

ll dp[3001][4]={};

int main() {

	int r,g,b,n;
	cin>>r>>g>>b>>n;


	if(r<=n)dp[r][1]++;
	if(g<=n)dp[g][2]++;
	if(b<=n)dp[b][3]++;

	for(int j=1; j<=3; j++){
		int t;
		if(j==1)t=r;
		if(j==2)t=g;
		if(j==3)t=b;
		for(int i=1; i<=n; i++){
			dp[i][j]+=dp[i][j-1];
			if(dp[i][j]==0)continue;
			if(i+t<=n)dp[i+t][j]+=dp[i][j];
		}
	}
	cout<<dp[n][3]<<endl;

	return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
void fastIO(){
  ios_base::sync_with_stdio(0); cin.tie(0);
}


int main(){
  fastIO();
  int r,g,b,n;
  cin>>r>>g>>b>>n;
  vector<int>dp(3030);
  vector<int>change(3);
  change[0]=r,change[1]=g,change[2]=b;
  dp[0]=1;
  for(int i=0;i<3;i++){
  	for(int j=change[i];j<=n;j++){
  		dp[j]+=dp[j-change[i]];
  	}
  }
  cout<<dp[n]<<endl;
}
//  [cpp]
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <cmath>
#include <map>
#include <iomanip>
#define intt long long

int main() {
	intt R, G, B, N; std::cin >> R >> G >> B >> N;
	intt ans = 0;
	for (intt i = 0; i < N / R; ++i) {
		for (intt j = 0; j < N / G; ++j) {
			if (i * R + j * G > N)
				continue;
			intt d = N - i * R - j * G;
			if (d % B != 0)
				continue;
			++ans;
		}
	}
	std::cout << ans << std::endl;
	return 0;
}
//  [cpp]
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);i++)
#define all(v) v.begin(),v.end()
#define len(x) (ll)(x).length()
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
const int INF=1e9;
const ll INFS=1e18;
const int MOD=INF+7;
const int di[] = {-1,0,1,0};
const int dj[] = {0,-1,0,1};
 
int main() {
  int r,g,b,n;
  cin>>r>>g>>b>>n;
  int ans=0;
  for(int i=0;i<=n/r;i++){
    for(int j=0;j<=n/g;j++){
      for(int k=0;k<=n/b;k++){
        if(r*i+g*j+b*k==n) ans++;
      }
    }
  }
  cout<<ans<<endl;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1);


int main(void)
{
    ll r,g,b,n,cnt=0; cin>>r>>g>>b>>n;
    rep(i,n/r+1){
        if(r*i > n) continue;
            rep(j,n/g+1){
            if(r*i+g*j > n) continue;
            rep(k,n/b+1){
                if(r*i+g*j+b*k > n) break;
                if(r*i+g*j+b*k == n) cnt++;
            }
        }
    }
    cout<<cnt<<endl;
    return 0;
}
//  [c]
#include <stdio.h>

int main(void) {
	// your code goes here
	int r[3],n;

	scanf("%d%d%d%d",&r[0],&r[1],&r[2],&n);
	int i,dp[n+1];
	for(i=0;i<n+1;i++)
		dp[i] = 0;
	dp[0] = 1;
	int j;
	for(i=0;i<3;i++)
		for(j=r[i];j<=n;j++)
			dp[j] = dp[j] + dp[j - r[i]];
	printf("%d\n",dp[n]);
	return 0;
}
//  [c]
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;

void trans (i32 a, i32 *dp, i32 n) {
  for (i32 i = a; i <= n; ++i) {
    dp[i] += dp[i - a];
  }
}

void run (void) {
  i32 a, b, c, n;
  scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32 "%" SCNi32, &a, &b, &c, &n);
  i32 *dp = (i32 *) calloc (n + 1, sizeof (i32));
  dp[0] = 1;
  trans (a, dp, n);
  trans (b, dp, n);
  trans (c, dp, n);
  printf ("%" PRIi32 "\n", dp[n]);
}

int main (void) {
  run();
  return 0;
}
//  [c]
#include<stdio.h>

int gcd(int n,int m){
  if(n<m)return gcd(m,n);
  if(m==0)return n;
  return gcd(m,n%m);
}

#define lcm(a,b) ((a)*(b)/gcd((a),(b)))

int main (void){
  int r,g,b,n;
  scanf("%d %d %d %d",&r,&g,&b,&n);

  int r_max,ans=0;
  r_max=n/r;

  int i,j,nn,del;
  del=gcd(g,b);
  g/=del; b/=del;
  nn=n+r;
  for(i=0;i<=r_max;i++){
    nn=n-r*i;
    if(nn%del) continue;
    nn/=del;
    j=0;
    while(nn%b){
      nn-=g;
    }
    if(nn>=0)    ans+=(nn/b/g+1);
    //    printf("i:%d %d\n",i, ans);
  }
    

  printf("%d",ans);
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>



void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


int gcd(int a, int b){
  int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}

int main(void){
  int r,g,b,n;
  scanf("%d%d%d%d",&r,&g,&b,&n);
  int ans=0;
  for(int i=0;i<=(n/r)+1;i++){
    for(int j=0;j<=(n-r*i)+1/g;j++){
      if((n-(r*i+g*j))%b==0){
        ans++;
      }
    }
  }
  printf("%d\n",ans);
  return 0;
}
//  [c]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>



void swap (int *x, int *y) {
  int temp;

  temp = *x;
  *x = *y;
  *y = temp;

  return;
}


int gcd(int a, int b){
  int c;

  while (b > 0){
    c = a % b;
    a = b;
    b = c;
  }

  return a;
}

long int modpow(long int a,long int n,long int mod){
  long int ans=1;
  while(n>0){
    if(n & 1){
      ans=ans*a%mod;
    }
    a=a*a%mod;
    n/=2;
  }
  return ans;
}

long int modinv(long int a,long int mod){
  return modpow(a,mod-2,mod);
}

int max(int a,int b){
  if(a<b){
    return b;
  }
  else{
    return a;
  }
}

int min(int a,int b){
  if(a<b){
    return a;
  }
  else{
    return b;
  }
}

void chmax(int *a,int b){
  if(*a < b){
    *a = b;
  }

  return;
}

void chmin(int *a,int b){
  if(*a > b){
    *a =b;
  }

  return;
}

int main(void){
  int r,g,b,n;
  scanf("%d%d%d%d",&r,&g,&b,&n);
  int ans=0;
  for(int i=0;i<=(n/r)+1;i++){
    for(int j=0;j<=(n-r*i)/g;j++){
      if((n-(r*i+g*j))%b==0){
        ans++;
      }
    }
  }
  printf("%d\n",ans);
  return 0;
}
//  [javascript]
'use strict'
function Main(input){
  input=input.trim().split(/\s+/).map(x=>x-0);
  const R=input[0],G=input[1],B=input[2],N=input[3];
  const dp=[[],[],[],[],];
  /*dp[i][j]はRGBの前からi色を使って
  のこりの玉をjにのする場合の数*/
  for(let i=0;i<=3;i++){
    for(let j=0;j<=N+R+G+B;j++){
      dp[i][j]=0;
    }
  }
  
  dp[0][N]=1;
  
  for(let i=1;i<=3;i++){
    for(let j=N;j>=0;j--){
      dp[i][j]+=dp[i-1][j]+dp[i][j+input[i-1]];
    }
  }
  console.log(dp[3][0]);
}

Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [javascript]
"use strict";
function I(t,i){this._s=t.split("\n"),this._c=0,this._l=0,this._f=i||Number}I.prototype.a=function(t){var i=this._s[this._l];if(i){var s=i.trim().split(" "),h=s[this._c];return this._c++,s.length===this._c&&(this._c=0,this._l++),t?t(h):this._f(h)}},I.prototype.l=function(t){var i=this._s[this._l];if(i)return this._c=0,this._l++,i.split(" ").map(t||this._f)},module.exports=I;

function main(input) {
  var o = new I(input);

  var R = o.a();
  var G = o.a();
  var B = o.a();
  var N = o.a();

  var count = 0;
  for (var r = 0; r <= N / R; r++) {
    for (var g = 0; g <= (N - r * R) / G; g++) {
      if ((N - r * R - g * G) % B === 0) count += 1;
    }
  }

  console.log(count);
}


main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function myOut(text){console.log(text);}//standard output
function Main(input) {
	input = input.trim();
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  
  var R = input[0];
  var G = input[1];
  var B = input[2];
  var N = input[3];
  var list = [R,G,B];
  var max = Math.max.apply(null,list);
  list.splice(list.indexOf(max), 1);
  var first = Math.floor(N / max);
  var next = Math.max.apply(null,list);
  var last = Math.min.apply(null,list);
  
  var output = 0;
  for(var i = 0; i <= first; i++){
    var tmp = N - (i * max);//残り10
    var tmp2 = Math.floor(tmp / next);
    if(i == 227){
       //console.log(tmp);
       }
    for(j = 0; j <= tmp2; j++){
      var tmp3 = tmp - (j * next);
      if(tmp3 % last == 0){
         output++
         }
    }
    
  }
  console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function myOut(text){console.log(text);}//standard output
function Main(input) {
	input = input.trim();
	//input = input.trim().split(" ");
	//input = input.trim().split("\n");
	input = input.trim().split(" ").map((a)=>Number(a));
	//input = input.trim().split("\n").map((a)=>Number(a));
  
  var R = input[0];
  var G = input[1];
  var B = input[2];
  var N = input[3];
  var list = [R,G,B];
  var max = Math.max.apply(null,list);
  list.splice(list.indexOf(max), 1);
  var first = Math.floor(N / max);
  var next = Math.max.apply(null,list);
  var last = Math.min.apply(null,list);
  
  var output = 0;
  for(var i = 0; i <= first; i++){
    var tmp = N - (i * max);//残り10
    var tmp2 = Math.floor(tmp / next);
    if(tmp2 % last == 0){
       output += Math.floor(tmp2 / last) + 1;
      //console.log(Math.floor(tmp2 / last));
       }
    
  }
  console.log(output);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict'

function Main(input) {
  const R = Number(input.split(" ")[0])
  const G = Number(input.split(" ")[1])
  const B = Number(input.split(" ")[2])
  const N = Number(input.split(" ")[3])

  const max = Math.max(R, G, B)
  const min = Math.min(R, G, B)
  const mid = [R, G, B].filter(x => x !== max && x !== min)[0]

  const maxDivided = Math.floor(N / max)

  let ans = 0
  for (let i=0; i<=maxDivided; i++) {
    const midDivided = Math.floor((N - (i * max)) / mid)
    for (let j=0; j<=midDivided; j++) {
      const reminder = N - (i * max) - (j * mid)
      if (reminder % min === 0) {
        ans++
      }
    }
  }

  console.log(ans)
}

Main(require("fs").readFileSync("/dev/stdin", "utf8").trim())
//  [javascript]
'use strict'
function Main(input){
  input=input.trim().split(/\s+/).map(x=>x-0);
  var R=input[0],G=input[1],B=input[2],N=input[3];
  function rg(M){
    var counter=0;
    var r=Math.floor(M/R);
    var g=0;
    while(r>=0){
      while(r*R+g*G<M)g++;
      if(r*R+g*G===M)counter++;
      r--;
    }
    return counter;
  }
  var b=0;
  var ans=0;
  while(b*B<=N){
    ans+=rg(N-b*B);
  }
  console.log(ans);
}

Main(require('fs').readFileSync('/dev/stdin','utf8'));
//  [go]
package main

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

func getNextLine(scanner *bufio.Reader) string {
	var buffer string
	for {
		line, isPrefix, _ := scanner.ReadLine()
		buffer += string(line)
		if isPrefix == false {
			break
		}
	}
	return buffer
}

func getIntList(scanner *bufio.Reader) []int {
	list := strings.Split(getNextLine(scanner), " ")
	l := len(list)
	result := make([]int, l)
	for i := 0; i < l; i++ {
		result[i], _ = strconv.Atoi(list[i])
	}
	return result
}

func main() {
	fp := os.Stdin
	if len(os.Args) > 1 {
		fp, _ = os.Open(os.Args[1])
	}

	scanner := bufio.NewReader(fp)

	var r, g, b, n int

	fmt.Sscan(getNextLine(scanner), &r, &g, &b, &n)

	arr := make([]int, n+1)
	ans := 0
	for i := 0; i <= n; i += r {
		for j := 0; j <= n; j += g {
			t := i + j
			if t > n {
				break
			}
			arr[t]++
		}
	}
	for i := 0; i <= n; i++ {
		for j := 0; j <= n; j += b {
			t := i + j
			if t > n {
				break
			}
			if t == n {
				ans += arr[i]
			}
		}
	}

	fmt.Println(ans)
}
//  [go]
package main

import "fmt"

func isInt(x float64) bool { return float64(int(x)) == x }

func main() {
	var r, g, b, n int
	fmt.Scan(&r, &g, &b, &n)
	bb := float64(b)

	ans := 0
	for i := 0; i <= n; i++ {
		for j := 0; i+j <= n; j++ {
			rest := float64(n - (r*i + g*j))
			if rest >= 0 && isInt(rest/bb) {
				ans++
			}
		}
	}
	fmt.Println(ans)
}
//  [go]
package main
import (
    "fmt"
)
    
func main(){
    var R, G, B, N int
    fmt.Scan(&R, &G, &B, &N)
    var ans int
    for i, hoge:=0, 0;R*i<=N;i++{
        hoge = N-R*i
        for hoge>=0{
            if hoge%B ==0 || hoge==0{
                ans++
            }
            hoge -= G
        }
    }
    fmt.Println(ans)
}
//  [go]
package main

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

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func powInt(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var R, G, B, N int

func main() {
	sc.Split(bufio.ScanWords)

	R, G, B, N = nextInt(), nextInt(), nextInt(), nextInt()
	ans := 0
	for r := 0; r <= N/R; r++ {
		for g := 0; g <= N/G; g++ {
			for b := 0; b <= N/B; b++ {
				if R*r+B*b+G*g == N {
					ans++
				}
			}
		}
	}
	fmt.Println(ans)
}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var r, g, b, n int
	fmt.Scan(&r, &g, &b, &n)

	ans := 0
	for x := 0; x <= n; x++ {
		for y := 0; y <= n; y++ {
			for z := 0; z <= n; z++ {
				if r*x+g*y+b*z == n {
					ans++
				}
			}
		}
	}

	fmt.Print(ans)
}
//  [ruby]
def valid?(current, stride, n)
  return false if current > n
  diff = n - current
  diff % stride == 0
end

r, g, b, n = gets.split.map(&:to_i)
nums = [r, g, b]
nums = nums.sort.reverse
maxes = nums.map do |num|
  ((n + num - 1) / num).to_i
end
ans = 0
count = 0
while count <= n
  rest = n - count
  c2 = 0
  valids = []
  while c2 <= rest && valids.length < 2
    if valid?(c2 + count, nums[2], n)
      valids << c2
    end
    c2 += nums[1]
  end
  if valids.length == 1
    ans += 1
  elsif valids.length == 2
    diff = valids[1] - valids[0]
    r = rest - valids[1]
    ans += 2
    ans += (r / diff)
  end
  count += nums[0]
end

puts ans
//  [ruby]
R, G, B, N = gets.strip.split(/ /).collect(&:to_i)

$cache = []
def countGB(n)
	if count = $cache[n]
		return count
	end
	x = 0
	count = 0
	while x <= n
		if (n - x) % B == 0
			count += 1
		end
		x += G
	end
	
	$cache[n] = count
end

x = 0
count = 0
while x <= N
	count += countGB(N - x)
	x += R
end

puts count
//  [ruby]
r,g,b,n=gets.split.map(&:to_i)

x,y,z=[r,g,b].sort

count=0

xs=0
while xs<=n
  ys=0
  while ys+xs<=n
    count+=1 if (n-(ys+xs))%z==0
    ys+=y
  end
  xs+=x
end

puts count
//  [ruby]
r, g, b, n = gets.chomp.split.map(&:to_i)
gc = (r.gcd(g)).gcd(b)
r /= gc
g /= gc
b /= gc
n /= gc
r, g, b = [r, g, b].sort

res = 0
0.step(n / b) do |k|
  0.step((n - k * b) / g) do |j|
    res += 1
  end
end
puts res
//  [ruby]
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
int main(void)
{
  ll R,G,B,N;
  cin >>R>>G>>B>>N;
  ll ans=0;
  for(ll r=0;r*R<N;r++) {
    for(ll g=0;g*G<N;g++) {
      ll bn=N-r*R-g*G;
      if(bn>=0&&bn<=N&&bn%B==0){
        ans++;
      }
    }
  }
  cout << ans << endl;
}
//  [ruby]
r,g,b,n = gets.split.map(&:to_i)
# p [r,g,b,n]

bb = (0..(n / b))
# p bb
# puts
cnt = 0
(n / r + 1).times do |rr|
  (n / g + 1).times do |gg|
    # p [rr * r,gg*g]
    next if rr*r + gg*g >= n+1
    if 0 <= (n - (rr*r + gg*g))/b && (n - (rr*r + gg*g))/b <= (n / b) && (n - (rr*r + gg*g)) % b == 0 
      cnt += 1
    end
    # if x = bb.bsearch{|x| x*b >= n - (rr*r + gg*g)}
    #   cnt += 1 if x*b == n - (rr*r + gg*g)
    # end
  end
end
p cnt
# 4 87058
//  [rust]
use std::io::*;
use std::str::FromStr;

#[allow(unused_macros)]
macro_rules! scan {
  ($e:expr; $t:ty) => {
    $e.get::<$t>()
  };
  ($e:expr; $($t:ty), *) => {
    ($($e.get::<$t>(),)*)
  };
  ($e:expr => $i:expr; $t:ty) => {
    (0..$i).map(|_| $e.get::<$t>()).collect::<Vec<$t>>()
  };
  ($e:expr => $row:expr, $col:expr; $t:ty) => {
    (0..$i).map(|_| scan!($e => $col; $t)).collect::<Vec<$t>>()
  }
}

struct Scanner<R: Read> {
  reader: R
}

#[allow(dead_code)]
impl<R: Read> Scanner<R> {
  fn new(reader: R) -> Scanner<R> {
    Scanner { reader: reader }
  }
  fn safe_get<T: FromStr>(&mut self) -> Option<T> {
    let token = self.reader.by_ref().bytes().map(|c| c.unwrap() as char)
      .skip_while(|c| c.is_whitespace())
      .take_while(|c| !c.is_whitespace())
      .collect::<String>();
    if token.is_empty() { None } else { token.parse().ok() }
  }
  fn get<T: FromStr>(&mut self) -> T {
    if let Some(v) = self.safe_get() { v } else {
      writeln!(stderr(), "Terminated with EOF").unwrap();
      std::process::exit(0);
    }
  }
}

trait Writable {
  fn write(&self, sep: &'static str) -> String;
}

impl<T: ToString> Writable for Vec<T> {
  fn write(&self, sep: &'static str) -> String {
    self.iter().map(|e| e.to_string()).collect::<Vec<String>>().join(sep)
  }
}

fn main() {
  let cin = stdin();
  let cin = cin.lock();
  let mut sc = Scanner::new(cin);
  let (r, g, b, n) = scan!(sc; i32, i32, i32, i32);
  let mut ans = 0;
  for rb in 0..(n / r) + 1 {
    for gb in 0..((n - r * rb) / g) + 1 {
      if (n - r * rb - g * gb) % b == 0 {
        ans += 1;
      }
    }
  }
  println!("{}", ans);
}
//  [rust]
fn main() {
    let mut input: String = String::new();
    let stdin = std::io::stdin();
    let _ = stdin.read_line(&mut input);
    let rgbn = input
        .trim()
        .split_whitespace()
        .map(|n| n.parse().expect("parse"))
        .collect::<Vec<u32>>();
    println!("{}", solve(rgbn[0], rgbn[1], rgbn[2], rgbn[3]));
}

fn solve(r: u32, g: u32, b: u32, n: u32) -> u32 {
    // no brain
    let mut ans = 0;
    for buy_r in 0..=(n / r) {
        for buy_g in 0..=((n - r * buy_r) / g) {
            if (n - r * buy_r - g * buy_g) % b == 0 {
                ans += 1;
            }
        }
    }
    ans
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        r: i32,
        g: i32,
        b: i32,
        n: i32,
    }
    let mut ans = 0;
    for i in 0..n / r + 1 {
        let mut balls = r * i;
        for j in 0..(n - balls) / g + 1 {
            balls = r * i + g * j;
            if balls + b * ((n - balls) / b) == n { ans += 1; }
        }
    }
    println!("{}", ans)
}
//  [rust]
use whiteread::parse_line;

/*
fn calc(n: usize, r: usize, g: usize, b: usize, dp: &mut Vec<usize>) -> usize {
    if dp[n] == std::usize::MAX {
        let mut res = 0;
        if n >= r {
            res += dp[n - r];
        }
    }
    dp[n]
}
*/

fn main() {
    let (r, g, b, n): (usize, usize, usize, usize) = parse_line().unwrap();
    let mut cnt = 0;
    //let mut dp: Vec<usize> = vec![std::usize::MAX; n + 1];

    //println!("{}", calc(n, r, g, b, &mut dp));
    for x in 0..=3000 {
        if x > n {
            break;
        }
        for y in 0..=3000 {
            if x * r + y * b > n {
                break;
            }
            for z in 0..=3000 {
                if x * r + y * b + z * g > n {
                    break;
                }
                if x * r + y * b + z * g == n {
                    cnt += 1;
                }
            }
        }
    }
    println!("{}", cnt);
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        r: i32,
        g: i32,
        b: i32,
        n: i32,
    }
    let mut ans = 0;
    for i in 0..n / r + 1 {
        let mut balls = r * i;
        for j in 0..(n - balls) / g + 1 {
            balls = r * i + g * j;
            for k in 0..(n - balls) / b + 1 {
                if balls + b * k == n { ans += 1; }
            }
        }
    }
    println!("{}", ans)
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input! {
        r: i32,
        g: i32,
        b: i32,
        n: i32,
    }
    let mut ans = 0;
    for i in 0..n / r + 1 {
        for j in 0..n / g + 1 {
            for k in 0..n / b + 1 {
                if r * i + g * j + b * k == n { ans += 1; }
            }
        }
    }
    println!("{}", ans)
}
//  [swift]
let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (R,G,B,N) = (input[0],input[1],input[2],input[3])
var ans = 0
for r in 0...N {
    for g in 0...N {
        let b = N-r*R-g*G
        if b>=0 && b%B==0 {
            ans += 1
        }
    }
}
print(ans)
//  [swift]
let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (R, G, B, N) = (input[0], input[1], input[2], input[3])
var ans = 0
for r in 0...N {
    for g in 0...N {
        let b = N - (r*R + g*G)
        if (b >= 0) && (b % B == 0) {
            ans += 1
        }
    }
}
print(ans)
//  [swift]
let i=readLine()!.characters.split(" ").map{Int(String($0))!},N=i[3]
var ans=0
for r in 0...N {
    for g in 0...N {
        let b = N-r*i[0]-g*i[1]
        if b>=0&&b%i[2]==0 {
            ans++
        }
    }
}
print(ans)
//  [swift]
let input = readLine()!.characters.split(" ").map{Int(String($0))}
let (R, G, B, N) = (input[0], input[1], input[2], input[3])
var ans = 0
for r in 0...N {
    for g in 0...N {
        let b = N - (r*R + g*G)
        if b >= 0 && b%B == 0 {
            ans += 1
        }
    }
}
print(ans)
//  [swift]
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var r: Int = 0, g: Int = 0, b: Int = 0
var i: Int = 0
var j: Int = 0
var k: Int = 0
var o: Int = 0

var z: Int = ( arr[3] / arr[0] )
var x: Int = ( arr[3] / arr[1] )
var c: Int = ( arr[3] / arr[2] )

for r = 0; r <= ( z ); r += 1 {
  if( ( i ) > arr[3] ) {
    break
  }
  j = 0
  for g = 0; g <= ( x ); g += 1 {
    if( ( i + j ) > arr[3] ) {
      break
    }
    k = 0
    for b = 0; b <= ( c ); b += 1 {
      if( ( i + j + k ) > arr[3] ) {
        break
      }
      if ( ( i + j + k )  == arr[3] ) {
        o += 1
      }
      k =  k + arr[2]
    }
    j = j + arr[1]
  }
  i = i + arr[0]
}
  
print( o )
//  [swift]
let arr=readLine()!.characters.split{$0==" "}.map{Int(String($0))!}

var r: Int = 0, g: Int = 0, b: Int = 0
var i: Int = 0
var j: Int = 0
var k: Int = 0
var o: Int = 0

var z: Int = ( arr[3] / arr[0] )
var x: Int = ( arr[3] / arr[1] )
var c: Int = ( arr[3] / arr[2] )

for r = 0; r <= ( z ); r += 1 {
  if( ( i ) > arr[3] ) {
    continue
  }
  j = 0
  for g = 0; g <= ( x ); g += 1 {
    if( ( i + j ) > arr[3] ) {
      continue
    }
    k = 0
    for b = 0; b <= ( c ); b += 1 {
      if( ( i + j + k ) > arr[3] ) {
        break
      }
      if ( ( i + j + k )  == arr[3] ) {
        o += 1
      }
      k =  k + arr[2]
    }
    j = j + arr[1]
  }
  i = i + arr[0]
}
  
print( o )
//  [typescript]
function readInt(str){
  return parseInt(str, 10);
}
function solve(R,G,B,N){
  let count=0;
  for(let r=0;r<=N;r+=R)
    for(let g=0;r+g<=N;g+=G)
      {
        if((N-r-g)%B==0)count++;
      }
  return count;
}
function Main(raw: string) {
  const input = raw.split(/ |\n/);
  const [R,G,B,N] = input.map(readInt);
  //出力
  console.log(solve(R,G,B,N));
}

//DO NOT EDIT
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function readInt(str){
  return parseInt(str, 10);
}
function solve(R,G,B,N){
  let count=0;
  for(let r=0;r<=N;r+=R)
    for(let g=0;r+g<=N;g+=G)
      {
        if((N-r-g)%B==0)count++;
      }
  return count;
}
function Main(raw: string) {
  const input = raw.split("\n");
  const [R,G,B,N] = input[0].split(" ").map(readInt);
  //出力
  console.log(solve(R,G,B,N));
}

//DO NOT EDIT
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function Main(input) {
    const [R, G, B, n] = input.split(" ").map(num => Number(num));
    const maxR = Math.ceil(n / R);
    // const maxG = Math.ceil(n / G);
    // const maxB = Math.ceil(n / B);
    let result = 0;
    for (let r = 0; r <= maxR; r++) {
        const sumR = r * R;
        const maxG = Math.ceil((n - sumR) / G);
        for (let g = 0; g <= maxG; g++) {
            const sumRG = sumR + g * G;
            const remain = n - sumRG;
            if (remain < 0) break;
            if (remain % B === 0) result++;
        }
    }
    console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function Main(input) {
    const [R, G, B, n] = input.split(" ").map(num => Number(num));
    const maxR = Math.ceil(n / R);
    // const maxG = Math.ceil(n / G);
    // const maxB = Math.ceil(n / B);
    let result = 0;
    for (let r = 0; r <= maxR; r++) {
        const sumR = r * R;
        const maxG = Math.ceil((n - sumR) / G);
        for (let g = 0; g <= maxG; g++) {
            const sumRG = sumR + g * G;
            if ((n - sumRG) % B === 0) result++;
        }
    }
    console.log(result);
}
 
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
function Main(input) {
    const [R, G, B, n] = input.split(" ").map(num => Number(num));
    const maxR = Math.ceil(n / R);
    let result = 0;
    for (let r = 0; r <= maxR; r++) {
        const sumR = r * R;
        const maxG = Math.ceil((n - sumR) / G);
        for (let g = 0; g <= maxG; g++) {
            const sumRG = sumR + g * G;
            const remain = n - sumRG;
            if (remain < 0) break;
            if (remain % B === 0) result++;
        }
    }
    console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function Main(input) {
    const [R, G, B, n] = input.split(" ").map(num => Number(num));
    const maxR = Math.ceil(n / R);
    // const maxG = Math.ceil(n / G);
    // const maxB = Math.ceil(n / B);
    let result = 0;
    for (let r = 0; r <= maxR; r++) {
        const sumR = r * R;
        const maxG = Math.ceil((n - sumR) / G);
        for (let g = 0; g <= maxG; g++) {
            const sumRG = sumR + g * G;
            if ((n - sumRG) % B === 0) result++;
        }
    }
    console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
function Main(input) {
    const [R, G, B, n] = input.split(" ").map(num => Number(num));
    const maxR = Math.ceil(n / R);
    let result = 0;
    for (let r = 0; r <= maxR; r++) {
        const sumR = r * R;
        const maxG = Math.ceil((n - sumR) / G);
        for (let g = 0; g <= maxG; g++) {
            const sumRG = sumR + g * G;
            const maxB = Math.ceil((n - sumRG) / B);
            for (let b = 0; b <= maxB; b++) {
                const sum = sumRG + b * B;
                if (n <= sum) {
                    if (n === sum) result++;
                    break;
                }
            }
        }
    }
    console.log(result);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [python]
L, R, d = map(int, input().split())
a = 0

for i in range(L,R+1):
  if i%d==0:
    a += 1
  else:
    a += 0

print(a)
//  [python]
L,R,d = map(int,input().split())
cnt=0
for i in range(L, R+1):
    if i%d == 0:
        cnt +=1
print(cnt)
//  [python]
a,b,c = map(int,input().split())
print(b//c - (a-1)//c)
//  [python]
import math

l = int(input())
r = int(input())
d = int(input())

min = math.floor(l/d)
max = math.floor(r/d)
if math.floor(l/d) == l/d:
  p = 1
else:
  p = 0
print(max - min + p)
//  [python]
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <stack>
#include <numeric>
#include <map>
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;

int main()
{
    int l,r,d;
    cin >> l >> r >> d;
    int cnt = 0;
    for (int i = l; i <= r; i++)
    {
        if (i%d == 0)
        {
            cnt++;
        }
        
    }
    cout << cnt << endl;
}
//  [python]
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
from math import sqrt
from collections import defaultdict
def main():
    n = int(input())
    n2 = int(sqrt(n) + 1)
    d1 = defaultdict(int)

    for i1 in range(1, n2):
        for i2 in range(1, n2):
            for i3 in range(1, n2):
                #p = (i1 + i2) ** 2 - (i1 * i2) + i3 * (i1 + i2 + i3)
                p = i1 ** 2 + i2 ** 2 + i3 ** 2 + i1 * i2 + i2 * i3 + i1 * i3
                d1[p] += 1

    for j1 in range(1, n + 1):
        print(d1[j1])

if __name__ == '__main__':
    main()
//  [java]
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.InputMismatchException;
import java.util.LinkedList;
import java.util.PriorityQueue;
import java.util.TreeSet;
 
 
 
public class Main {
  public static void main(String[] args) {
    InputReader sc = new InputReader(System.in);
 
    int n = sc.nextInt();
    int m = sc.nextInt();
    int d = sc.nextInt();

    int ans = 0;
    for(int i = n; i <= m; i++){
      if(i % d == 0){
        ans++;
      }
    }
    System.out.println(ans);


  }
 
 //ここからテンプレ
  static class InputReader {
      private InputStream stream;
      private byte[] buf = new byte[1024];
      private int curChar;
      private int numChars;
      private SpaceCharFilter filter;
 
      public InputReader(InputStream stream) {
          this.stream = stream;
      }
 
      public int next() {
          if (numChars == -1)
              throw new InputMismatchException();
          if (curChar >= numChars) {
              curChar = 0;
              try {
                  numChars = stream.read(buf);
              } catch (IOException e) {
                  throw new InputMismatchException();
              }
              if (numChars <= 0)
                  return -1;
          }
          return buf[curChar++];
      }
 
      public String nextStr() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        StringBuffer str = new StringBuffer();
        do{
          str.append((char)c);
          c = next();
        }while(!isSpaceChar(c));
        return str.toString();
      }
 
      public char nextChar() {
        int c = next();
        while(isSpaceChar(c)){c = next();}
        char ret;
        do{
          ret = (char)c;
          c = next();
        }while(!isSpaceChar(c));
        return ret;
      }
 
      public int nextInt() {
          int c = next();
          while (isSpaceChar(c))
              c = next();
          int sgn = 1;
          if (c == '-') {
              sgn = -1;
              c = next();
          }
          int res = 0;
          do {
              if (c < '0' || c > '9')
                  throw new InputMismatchException();
              res *= 10;
              res += c - '0';
              c = next();
          } while (!isSpaceChar(c));
          return res * sgn;
      }
 
      public boolean isSpaceChar(int c) {
          if (filter != null)
              return filter.isSpaceChar(c);
          return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1;
      }
 
      public interface SpaceCharFilter {
          public boolean isSpaceChar(int ch);
      }
  }
}
//  [java]
import java.util.*;
import java.util.stream.Collectors;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.StandardCharsets;

public class Main {

	public static void main(String[] args) throws IOException {
		InputStreamReader reader = new InputStreamReader(System.in, StandardCharsets.UTF_8);
		BufferedReader in = new BufferedReader(reader);
		Main ins = new Main(in);
		ins.calc();
		ins.showResult();
	}

	Main(BufferedReader in) throws IOException {
		String[] tokens = in.readLine().split(" ");
		int L = Integer.parseInt(tokens[0]);
		int R = Integer.parseInt(tokens[1]);
		int d = Integer.parseInt(tokens[2]);
		int count = 0;
		for (int i = L; i <= R; ++i) {
			if (i % d == 0)
				++count;
		}
		System.out.println(count);
	}

	void calc() {
	}

	void showResult() {
	}
}
//  [java]
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		int L = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		int d = Integer.parseInt(sc.next());
		int x = R/d;
		int y = L/d;
		System.out.println(x-y);

	}

}
//  [java]
package エイシングプログラミングコンテスト2020;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc  = new Scanner(System.in);
		int L = Integer.parseInt(sc.next());
		int R = Integer.parseInt(sc.next());
		int d = Integer.parseInt(sc.next());
		int x = R/d;
		int y = L/d;
		System.out.println(x-y);

	}

}
//  [java]
import java.util.Scanner;

public class test {
    public static int valid(long x, long y,long z,long n){
        return (z*z+x*x+y*y+y*z+x*y+x*z==n?1:0);
    }
    public static int solve(int n){
        int ans=0;
        for (long x = 1; x*x+x*2 <= n ; x++) {
            for (long y = 1; y*y+x*y+x*x+x+y <= n ; y++) {
                for (long z = 1; z*z+x*x+y*y+y*z+x*y+x*z<= n ; z++) {
                    ans+= valid(x,y,z,n);
                }
            }
        }
        return ans;
    }
    public static void main(String args[]){
        Scanner scan = new Scanner(System.in);
        int n;
        n = scan.nextInt();
        for (int i = 1; i <= n ; i++) {
            System.out.println(solve(i));
        }
    }
}
//  [cpp]
#include<stdio.h>

int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	int ctr=0;
	for(int i=a;i<=b;i++)
	{
		if(i%c==0)
		{
			ctr++;
		}
	}
	printf("%d\n",ctr);
	return 0;
}