#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
  ios::sync_with_stdio(0); cin.tie(0);
  ll n;
  cin >> n;
  ll sum = 0, len = 0;
  for (int i = 0; i < n; i++) {
    ll d, c;
    cin >> d >> c;
    sum += d*c;
    len += c;
  }
  cout << (sum-1)/9+len-1 << endl;
}
