#include <bits/stdc++.h>
using namespace std;
template <typename T>
T& input(T& v) {
  for (int i = 0; i < v.size(); i++) cin >> v[i];
  return v;
}
template <typename T>
T& input_2d(T& v) {
  int N = v.size();
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < v[i].size(); j++) cin >> v[i][j];
  }
}
template <typename T>
T& input_pair(T& v) {
  for (int i = 0; i < v.size(); i++) cin >> v[i].first >> v[i].second;
  return v;
}
template <typename T>
void print(const T& v) {
  int N = v.size();
  for (int i = 0; i < N; i++) cout << v[i] << " ";
}
template <typename T>
void print_2d(T& v) {
  int N = v.size();
  for (int i = 0; i < N; i++) {
    for (int j = 0; j < v[i].size(); j++) cout << v[i][j] << " ";
    cout << '\n';
  }
}
template <typename T>
void print_pair(const T& v) {
  int N = v.size();
  for (int i = 0; i < N; i++) cout << v[i].first << " " << v[i].second << '\n';
}
template <typename T>
inline int digits(const T& N) {
  return (N > 0 ? (int)((log(N) / log(10)) + 1) : 0);
}
inline bool ispoweroftwo(int x) { return (x && (!(x & (x - 1)))); }
bool if_integer(double x) {
  if (x - floor(x) == 0 && x > 0)
    return true;
  else
    return false;
}
int binomial(int n, int k) {
  vector<int> C(k + 1, 0);
  C[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = min(i, k); j > 0; j--) C[j] = C[j] + C[j - 1];
  }
  return C[k];
}
inline double distance(int a, int b, int c, int d) {
  return sqrt(((long long)(a - c)) * (a - c) + ((long long)(b - d)) * (b - d));
}
struct compare {
  bool operator()(pair<int, int>& p1, pair<int, int>& p2) {
    if (p1.first == p2.first) return p1.second > p2.second;
    return p1.first > p2.first;
  }
};
bool sortbysec(const pair<int, int>& a, const pair<int, int>& b) {
  if (a.first == b.first) return (a.second < b.second);
  return (a.first > b.first);
}
bool sortcmp(const string& a, const string& b) {
  if (a.size() == b.size()) return (a < b);
  return (a.size() < b.size());
}
int main() {
  int n, z = 0, r = 0, m;
  cin >> n >> m;
  double d = distance(0, 0, n, m);
  double max_distance = 0;
  int x1, y1, x2, y2;
  for (int i = 1; i < n; i++) {
    double distance1 = 2 * max(distance(0, 0, i, 0), distance(n, m, i, 0));
    if (distance1 > max_distance) {
      x1 = i;
      y1 = 0;
      x2 = n - i;
      y2 = m;
      z = 1;
      max_distance = distance1;
    }
    for (int j = 1; j <= m; j++) {
      if (distance(i, 0, 0, j) +
              max(distance(0, j, n, m), distance(0, j, 0, 0)) >
          max_distance) {
        x1 = i;
        y1 = 0;
        x2 = 0;
        y2 = j;
        max_distance = distance(i, 0, 0, j) +
                       max(distance(0, j, n, m), distance(0, j, 0, 0));
        z = 0;
      }
    }
    if (m == 0) r = 1;
    for (int j = r; j < n; j++) {
      if (distance(i, 0, j, m) +
              max(distance(j, m, n, m), distance(j, m, 0, 0)) >
          max_distance) {
        x1 = i;
        y1 = 0;
        x2 = j;
        y2 = m;
        max_distance = distance(i, 0, j, m) +
                       max(distance(j, m, n, m), distance(j, m, 0, 0));
        z = 0;
      }
    }
  }
  int s = 0;
  if (n == 0) {
    r = m - 1;
    s = 1;
  } else {
    r = m;
    s = 0;
  }
  for (int i = s; i < m; i++) {
    double distance1 = 2 * max(distance(0, 0, n, i), distance(n, m, n, i));
    if (distance1 > max_distance) {
      x1 = n;
      y1 = i;
      x2 = 0;
      y2 = m - i;
      z = 1;
      max_distance = distance1;
    }
    for (int j = 1; j <= r; j++) {
      if (distance(n, i, 0, j) +
              max(distance(0, j, n, m), distance(0, j, 0, 0)) >
          max_distance) {
        x1 = n;
        y1 = i;
        x2 = 0;
        y2 = j;
        max_distance = distance(n, i, 0, j) +
                       max(distance(0, j, n, m), distance(0, j, 0, 0));
        z = 0;
      }
    }
    for (int j = 0; j < n; j++) {
      if (distance(n, i, j, m) +
              max(distance(j, m, n, m), distance(j, m, 0, 0)) >
          max_distance) {
        x1 = n;
        y1 = i;
        x2 = j;
        y2 = m;
        max_distance = distance(n, i, j, m) +
                           max(distance(j, m, n, m), distance(j, m, 0, 0)) >
                       max_distance;
        z = 0;
      }
    }
  }
  if (z == 0) {
    cout << x1 << " " << y1 << '\n';
    if (distance(x2, y2, n, m) > distance(x2, y2, 0, 0))
      cout << x2 << " " << y2 << '\n' << n << " " << m << '\n' << 0 << " " << 0;
    else
      cout << x2 << " " << y2 << '\n' << 0 << " " << 0 << '\n' << n << " " << m;
  }
  if (z == 1) {
    cout << x1 << " " << y1 << '\n';
    if (distance(x1, y1, n, m) > distance(x1, y1, 0, 0))
      cout << n << " " << m << '\n' << 0 << " " << 0 << '\n' << x2 << " " << y2;
    else
      cout << 0 << " " << 0 << '\n' << n << " " << m << '\n' << x2 << " " << y2;
  }
  return 0;
}
