#include <bits/stdc++.h> using namespace std; signed main() { int n; while (cin >> n) { long long res = 0; for (int i = 1; i <= n; i++) if (!(i % 7 == 0 || to_string(i).find('7') != string::npos)) res += i * i; cout << res << '\n'; } return 0; }
#include <bits/stdc++.h> using namespace std; signed main() { int n; while (cin >> n) { long long res = 0; for (int i = 1; i <= n; i++) if (!(i % 7 == 0 || to_string(i).find('7') != string::npos)) res += i * i; cout << res << '\n'; } return 0; }