#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  ;
  long long x, y, z;
  cin >> x >> y >> z;
  long long n = x % z;
  long long m = y % z;
  long long ans1, ans2;
  ans1 = ((x + m) / z) + (y / z);
  ans2 = (x / z) + ((y + n) / z);
  if (ans1 > ans2) {
    long long d = (x + m) - (((x + m) / z) * z);
    cout << ans1 << " " << max((long long)0, m - d) << "\n";
  } else if (ans2 > ans1) {
    long long d = (y + n) - (((y + n) / z) * z);
    cout << ans2 << " " << max((long long)0, n - d) << "\n";
  } else {
    long long d1 = (y + n) - (((y + n) / z) * z);
    long long d2 = (x + m) - (((x + m) / z) * z);
    cout << ans1 << " " << max(min(n - d1, m - d2), (long long)0) << "\n";
  }
  return 0;
}
