#include<bits/stdc++.h>
using namespace std;
#define int long long
inline int read(){
	int x = 0, m = 1;
	char ch = getchar();
	while(!isdigit(ch)){
		if(ch == '-') m = -1;
		ch = getchar();
	}
	while(isdigit(ch)){
		x = x * 10 + ch - 48;
		ch = getchar();
	}
	return x * m;
}
inline void write(int x){
	if(x < 0){
		putchar('-');
		write(-x);
		return;
	}
	if(x >= 10) write(x / 10);
	putchar(x % 10 + '0');
}
signed main(){
	int k = read(), x = 0;
	for(int i = 1; i <= k; i++){
		for(int j = 1; j <= k / i; j++){
			x = x + k / (i * j);
		}
	}
	write(x);
}
#include <bits/stdc++.h>
using namespace std;
 
int main() {
 
  string a,b;
  cin >> a;
  for( int i = a.size()-1 ; i >= 0 ; i--){
    if (a.at(i) == '6'){
      a.at(i) = '9';
    }
    else if (a.at(i) == '9'){
      a.at(i) = '6';    
    }
       b += a.at(i);  
  }
  cout << b << endl;
}