#include <bits/stdc++.h>
int main() {
  int n, i, j, sum = 0;
  scanf("%d", &n);
  int arr[n][3];
  for (i = 0; i < n; i++) scanf("%d%d%d", &arr[i][0], &arr[i][1], &arr[i][2]);
  for (i = 0; i < n; i++) {
    if (arr[i][0] <= i + 1)
      sum = sum + arr[i][1];
    else
      sum = sum + arr[i][2];
  }
  printf("%d", sum);
  return 0;
}
